| | 37 | | static SERVER_CONNECT_REC *get_server_connect(const char *data, int *plus_addr, |
| | 38 | | char **rawlog_file) |
| | 39 | | { |
| | 40 | | CHAT_PROTOCOL_REC *proto; |
| | 41 | | SERVER_CONNECT_REC *conn; |
| | 42 | | GHashTable *optlist; |
| | 43 | | char *addr, *portstr, *password, *nick, *chatnet, *host, *tmp; |
| | 44 | | void *free_arg; |
| | 45 | | |
| | 46 | | g_return_val_if_fail(data != NULL, NULL);
|
| | 47 | | |
| | 48 | | if (!cmd_get_params(data, &free_arg, 4 | PARAM_FLAG_OPTIONS,
|
| | 49 | | "connect", &optlist, &addr, &portstr, |
| | 50 | | &password, &nick)) |
| | 51 | | return NULL;
|
| | 52 | | if (plus_addr != NULL) *plus_addr = *addr == '+';
|
| | 53 | | if (*addr == '+') addr++; |
| | 54 | | if (*addr == '\0') { |
| | 55 | | signal_emit("error command", 1, |
| | 56 | | GINT_TO_POINTER(CMDERR_NOT_ENOUGH_PARAMS));
|
| | 57 | | cmd_params_free(free_arg); |
| | 58 | | return NULL;
|
| | 59 | | } |
| | 60 | | |
| | 61 | | if (strcmp(password, "-") == 0) |
| | 62 | | *password = '\0'; |
| | 63 | | |
| | 64 | | |
| | 65 | | proto = chat_protocol_find_net(optlist); |
| | 66 | | |
| | 67 | | |
| | 68 | | chatnet = proto == NULL ? NULL :
|
| | 69 | | g_hash_table_lookup(optlist, proto->chatnet); |
| | 70 | | |
| | 71 | | if (chatnet == NULL)
|
| | 72 | | chatnet = g_hash_table_lookup(optlist, "network"); |
| | 73 | | |
| | 74 | | conn = server_create_conn(proto != NULL ? proto->id : -1, addr,
|
| | 75 | | atoi(portstr), chatnet, password, nick); |
| | 76 | | if (proto == NULL)
|