static void irc_login(GaimAccount *account) { GaimConnection *gc; struct irc_conn *irc; char **userparts; const char *username = gaim_account_get_username(account); gc = gaim_account_get_connection(account); gc->flags |= GAIM_CONNECTION_NO_NEWLINES; if (strpbrk(username, " \t\v\r\n") != NULL) { gaim_connection_error(gc, _("IRC nicks may not contain whitespace")); return; } gc->proto_data = irc = g_new0(struct irc_conn, 1); irc->fd = -1; irc->account = account; irc->outbuf = gaim_circ_buffer_new(512); userparts = g_strsplit(username, "@", 2); gaim_connection_set_display_name(gc, userparts[0]); irc->server = g_strdup(userparts[1]); g_strfreev(userparts); irc->buddies = g_hash_table_new_full((GHashFunc)irc_nick_hash, (GEqualFunc)irc_nick_equal, NULL, (GDestroyNotify)irc_buddy_free); irc->cmds = g_hash_table_new(g_str_hash, g_str_equal); irc_cmd_table_build(irc); irc->msgs = g_hash_table_new(g_str_hash, g_str_equal); irc_msg_table_build(irc); gaim_connection_update_progress(gc, _("Connecting"), 1, 2); if (gaim_account_get_bool(account, "ssl", FALSE)) { if (gaim_ssl_is_supported()) { irc->gsc = gaim_ssl_connect(account, irc->server, gaim_account_get_int(account, "port", IRC_DEFAULT_SSL_PORT), irc_login_cb_ssl, irc_ssl_connect_failure, gc); } else { gaim_connection_error(gc, _("SSL support unavailable")); return; } } if (!irc->gsc) { if (gaim_proxy_connect(gc, account, irc->server, gaim_account_get_int(account, "port", IRC_DEFAULT_PORT), irc_login_cb, gc) == NULL) { gaim_connection_error(gc, _("Couldn't create socket")); return; } } }
static void rea_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) { /* TODO: This might be for us too */ MsnSession *session; GaimConnection *gc; const char *friendly; session = cmdproc->session; gc = session->account->gc; friendly = gaim_url_decode(cmd->params[3]); gaim_connection_set_display_name(gc, friendly); }
static void usr_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) { MsnSession *session; GaimAccount *account; GaimConnection *gc; session = cmdproc->session; account = session->account; gc = gaim_account_get_connection(account); if (!g_ascii_strcasecmp(cmd->params[1], "OK")) { /* OK */ const char *friendly = gaim_url_decode(cmd->params[3]); gaim_connection_set_display_name(gc, friendly); msn_session_set_login_step(session, MSN_LOGIN_STEP_SYN); msn_cmdproc_send(cmdproc, "SYN", "%s", "0"); } else if (!g_ascii_strcasecmp(cmd->params[1], "TWN")) { /* Passport authentication */ char **elems, **cur, **tokens; session->nexus = msn_nexus_new(session); /* Parse the challenge data. */ elems = g_strsplit(cmd->params[3], ",", 0); for (cur = elems; *cur != NULL; cur++) { tokens = g_strsplit(*cur, "=", 2); g_hash_table_insert(session->nexus->challenge_data, tokens[0], tokens[1]); /* Don't free each of the tokens, only the array. */ g_free(tokens); } g_strfreev(elems); msn_session_set_login_step(session, MSN_LOGIN_STEP_AUTH_START); msn_nexus_connect(session->nexus); } }
static void gaym_login(GaimAccount * account) { GaimConnection *gc; struct gaym_conn *gaym; char *buf; const char *username = gaim_account_get_username(account); gc = gaim_account_get_connection(account); gc->flags |= GAIM_CONNECTION_NO_NEWLINES | GAIM_CONNECTION_AUTO_RESP; if (strpbrk(username, " \t\v\r\n") != NULL) { gaim_connection_error(gc, _("IRC nicks may not contain whitespace")); return; } gc->proto_data = gaym = g_new0(struct gaym_conn, 1); gaym->account = account; /** * gaim_connection_set_display_name(gc, userparts[0]); */ gaim_connection_set_display_name(gc, username); gaym->server = g_strdup(gaim_account_get_string (account, "server", "www.gay.com")); /** * gaym->server = "www.gay.com"; */ gaym->buddies = g_hash_table_new_full((GHashFunc) gaym_nick_hash, (GEqualFunc) gaym_nick_equal, NULL, (GDestroyNotify) gaym_buddy_free); gaym->channel_members = g_hash_table_new_full((GHashFunc) gaym_nick_hash, (GEqualFunc) gaym_nick_equal, NULL, (GDestroyNotify) gaym_channel_member_free); gaym->cmds = g_hash_table_new(g_str_hash, g_str_equal); gaym_cmd_table_build(gaym); gaym->msgs = g_hash_table_new(g_str_hash, g_str_equal); gaym_msg_table_build(gaym); gaym->roomlist_filter = NULL; gaym->hammers = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, (GDestroyNotify)hammer_cb_data_destroy); /** * The last parameter needs to be NULL here, since the same * field is added for both the key and the value (and if we * free it twice, thats bad and causes crashing!). */ gaym->info_window_needed = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); gaym->entry_order = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); /** * This is similar to gaym->info_window_needed, except this is * for thumbails inside the IM conversation window if the * person is not already on the buddy list */ buf = g_strdup_printf(_("Signon: %s"), username); gaim_connection_update_progress(gc, buf, 1, 6); g_free(buf); /** * Making a change to try cached password first. * gaym_try_cached_password(account, gaym_login_with_chat_key); */ gaym_get_chat_key_from_weblogin(account, gaym_login_with_chat_key); }