void gaim_connection_disconnect(GaimConnection *gc) { GaimAccount *account; GList *wins; g_return_if_fail(gc != NULL); account = gaim_connection_get_account(gc); if (gaim_account_get_connection(account) != NULL) { gaim_account_disconnect(account); return; } gaim_debug(GAIM_DEBUG_INFO, "connection", "Disconnecting connection %p\n", gc); if (gaim_connection_get_state(gc) != GAIM_DISCONNECTED) { if (gaim_connection_get_state(gc) != GAIM_CONNECTING) gaim_blist_remove_account(gaim_connection_get_account(gc)); gaim_signal_emit(gaim_connections_get_handle(), "signing-off", gc); serv_close(gc); connections = g_list_remove(connections, gc); gaim_connection_set_state(gc, GAIM_DISCONNECTED); gaim_signal_emit(gaim_connections_get_handle(), "signed-off", gc); system_log(log_signoff, gc, NULL, OPT_LOG_BUDDY_SIGNON | OPT_LOG_MY_SIGNON); /* * XXX This is a hack! Remove this and replace it with a better event * notification system. */ for (wins = gaim_get_windows(); wins != NULL; wins = wins->next) { GaimWindow *win = (GaimWindow *)wins->data; gaim_conversation_update(gaim_window_get_conversation_at(win, 0), GAIM_CONV_ACCOUNT_OFFLINE); } gaim_request_close_with_handle(gc); gaim_notify_close_with_handle(gc); } gaim_connection_destroy(gc); }
static GaimRoomlist *irc_roomlist_get_list(GaimConnection *gc) { struct irc_conn *irc; GList *fields = NULL; GaimRoomlistField *f; char *buf; irc = gc->proto_data; if (irc->roomlist) gaim_roomlist_unref(irc->roomlist); irc->roomlist = gaim_roomlist_new(gaim_connection_get_account(gc)); f = gaim_roomlist_field_new(GAIM_ROOMLIST_FIELD_STRING, "", "channel", TRUE); fields = g_list_append(fields, f); f = gaim_roomlist_field_new(GAIM_ROOMLIST_FIELD_INT, _("Users"), "users", FALSE); fields = g_list_append(fields, f); f = gaim_roomlist_field_new(GAIM_ROOMLIST_FIELD_STRING, _("Topic"), "topic", FALSE); fields = g_list_append(fields, f); gaim_roomlist_set_fields(irc->roomlist, fields); buf = irc_format(irc, "v", "LIST"); irc_send(irc, buf); g_free(buf); return irc->roomlist; }
void gaim_connection_error(GaimConnection *gc, const char *text) { GaimConnectionUiOps *ops; g_return_if_fail(gc != NULL); g_return_if_fail(text != NULL); /* If we've already got one error, we don't need any more */ if (gc->disconnect_timeout) return; ops = gaim_get_connection_ui_ops(); if (ops != NULL) { if (ops->report_disconnect != NULL) ops->report_disconnect(gc, text); if (ops->disconnected != NULL) ops->disconnected(gc); } gc->disconnect_timeout = g_timeout_add(0, gaim_connection_disconnect_cb, gaim_connection_get_account(gc)); }
void gaim_connection_destroy(GaimConnection *gc) { GaimAccount *account; g_return_if_fail(gc != NULL); if (gaim_connection_get_state(gc) != GAIM_DISCONNECTED) { gaim_connection_disconnect(gc); return; } gaim_debug(GAIM_DEBUG_INFO, "connection", "Destroying connection %p\n", gc); account = gaim_connection_get_account(gc); gaim_account_set_connection(account, NULL); if (gc->display_name != NULL) g_free(gc->display_name); if (gc->away != NULL) g_free(gc->away); if (gc->away_state != NULL) g_free(gc->away_state); if (gc->disconnect_timeout) g_source_remove(gc->disconnect_timeout); g_free(gc); }
/* this should be called upon signin, even when we did not open group chat window */ void qq_group_init(GaimConnection *gc) { gint i; GaimAccount *account; GaimChat *chat; GaimGroup *gaim_group; GaimBlistNode *node; qq_group *group; account = gaim_connection_get_account(gc); gaim_group = gaim_find_group(GAIM_GROUP_QQ_QUN); if (gaim_group == NULL) { gaim_debug(GAIM_DEBUG_INFO, "QQ", "We have no QQ Qun\n"); return; } i = 0; for (node = ((GaimBlistNode *) gaim_group)->child; node != NULL; node = node->next) if (GAIM_BLIST_NODE_IS_CHAT(node)) { /* got one */ chat = (GaimChat *) node; if (account != chat->account) continue; /* very important here ! */ group = qq_group_from_hashtable(gc, chat->components); if (group != NULL) { i++; qq_send_cmd_group_get_group_info(gc, group); /* get group info and members */ } } gaim_debug(GAIM_DEBUG_INFO, "QQ", "Load %d QQ Qun configurations\n", i); }
GaimRoomlist *jabber_roomlist_get_list(GaimConnection *gc) { JabberStream *js = gc->proto_data; GList *fields = NULL; GaimRoomlistField *f; if(js->roomlist) gaim_roomlist_unref(js->roomlist); js->roomlist = gaim_roomlist_new(gaim_connection_get_account(js->gc)); f = gaim_roomlist_field_new(GAIM_ROOMLIST_FIELD_STRING, "", "room", TRUE); fields = g_list_append(fields, f); f = gaim_roomlist_field_new(GAIM_ROOMLIST_FIELD_STRING, "", "server", TRUE); fields = g_list_append(fields, f); f = gaim_roomlist_field_new(GAIM_ROOMLIST_FIELD_STRING, _("Description"), "description", FALSE); fields = g_list_append(fields, f); gaim_roomlist_set_fields(js->roomlist, fields); gaim_request_input(gc, _("Enter a Conference Server"), _("Enter a Conference Server"), _("Select a conference server to query"), js->chat_servers ? js->chat_servers->data : "conference.jabber.org", FALSE, FALSE, NULL, _("Find Rooms"), GAIM_CALLBACK(roomlist_ok_cb), _("Cancel"), GAIM_CALLBACK(roomlist_cancel_cb), js); return js->roomlist; }
/* Remove the buddy referenced by the MsnAddRemData before the serverside list is changed. * If the buddy will be added, he'll be added back; if he will be removed, he won't be. */ static void msn_complete_sync_issue(MsnAddRemData *data) { GaimBuddy *buddy; GaimGroup *group = NULL; if (data->group != NULL) group = gaim_find_group(data->group); if (group != NULL) buddy = gaim_find_buddy_in_group(gaim_connection_get_account(data->gc), data->who, group); else buddy = gaim_find_buddy(gaim_connection_get_account(data->gc), data->who); if (buddy != NULL) gaim_blist_remove_buddy(buddy); }
void gaim_connection_register(GaimConnection *gc) { GaimAccount *account; GaimConnectionUiOps *ops; GaimPluginProtocolInfo *prpl_info = NULL; g_return_if_fail(gc != NULL); gaim_debug(GAIM_DEBUG_INFO, "connection", "Registering. gc = %p\n", gc); ops = gaim_get_connection_ui_ops(); if (gc->prpl != NULL) prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); else { gchar *message = g_strdup_printf(_("Missing protocol plugin for %s"), gaim_account_get_username(gaim_connection_get_account(gc))); gaim_debug(GAIM_DEBUG_ERROR, "connection", "Could not get prpl info for %p\n", gc); gaim_notify_error(NULL, _("Registration Error"), message, NULL); g_free(message); return; } account = gaim_connection_get_account(gc); if (gaim_connection_get_state(gc) != GAIM_DISCONNECTED) return; gaim_connection_set_state(gc, GAIM_CONNECTING); connections = g_list_append(connections, gc); gaim_signal_emit(gaim_connections_get_handle(), "signing-on", gc); /* set this so we don't auto-reconnect after registering */ gc->wants_to_die = TRUE; gaim_debug(GAIM_DEBUG_INFO, "connection", "Calling register_user\n"); prpl_info->register_user(account); }
/* GaimConversation *ggp_confer_find_by_name(GaimConnection *gc, const gchar *name) {{{ */ GaimConversation *ggp_confer_find_by_name(GaimConnection *gc, const gchar *name) { g_return_val_if_fail(gc != NULL, NULL); g_return_val_if_fail(name != NULL, NULL); return gaim_find_conversation_with_account(GAIM_CONV_TYPE_CHAT, name, gaim_connection_get_account(gc)); }
static void gaym_chat_join(GaimConnection * gc, GHashTable * data) { struct gaym_conn *gaym = gc->proto_data; const char *args[1]; char *alias = NULL; GaimChat *c = NULL; /** * need a copy, because data gets * destroyed in roomlist.c */ GHashTable *chatinfo = NULL; args[0] = g_hash_table_lookup(data, "channel"); if (args[0]) { alias = g_hash_table_lookup(data, "description"); c = gaim_blist_find_chat(gaim_connection_get_account(gc), args[0]); if (!c) { chatinfo = g_hash_table_new(g_str_hash, g_str_equal); g_hash_table_replace(chatinfo, "channel", g_strdup(args[0])); c = gaim_chat_new(gaim_connection_get_account(gc), alias, chatinfo); gaim_blist_add_chat(c, NULL, NULL); } } if (!args[0] || *args[0] != '#') { /** * Trigger a room search in config.txt.... */ return; } gaym_cmd_join(gaym, "join", NULL, args); }
void yahoo_process_chat_addinvite(GaimConnection *gc, struct yahoo_packet *pkt) { GSList *l; char *room = NULL; char *msg = NULL; char *who = NULL; for (l = pkt->hash; l; l = l->next) { struct yahoo_pair *pair = l->data; switch (pair->key) { case 104: room = yahoo_string_decode(gc, pair->value, TRUE); break; case 129: /* room id? */ break; case 126: /* ??? */ break; case 117: msg = yahoo_string_decode(gc, pair->value, FALSE); break; case 119: who = pair->value; break; case 118: /* us */ break; } } if (room && who) { GHashTable *components; components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); g_hash_table_replace(components, g_strdup("room"), g_strdup(room)); if (!yahoo_privacy_check(gc, who) || (gaim_account_get_bool(gaim_connection_get_account(gc), "ignore_invites", FALSE))) { gaim_debug_info("yahoo", "Invite to room %s from %s has been dropped.\n", room, who); if (room != NULL) g_free(room); if (msg != NULL) g_free(msg); return; } serv_got_chat_invite(gc, room, who, msg, components); } if (room) g_free(room); if (msg) g_free(msg); }
GaimIMConnect *FindIMConnnectByGaimConnection(GaimConnection *gc) { GaimAccount *gAccount = NULL; IMAccount *mAccount = NULL; EnumIMProtocol::IMProtocol protocol = EnumIMProtocol::IMProtocolAll; gAccount = gaim_connection_get_account(gc); if (gAccount == NULL) return NULL; protocol = GaimIMPrcl::GetEnumIMProtocol(gAccount->protocol_id); mAccount = GaimAccountMngr::FindIMAccount(gAccount->username, protocol); if (mAccount == NULL) return NULL; return GaimConnectMngr::FindIMConnect(*mAccount); }
void * gaim_notify_userinfo(GaimConnection *gc, const char *who, GaimNotifyUserInfo *user_info, GaimNotifyCloseCallback cb, gpointer user_data) { GaimNotifyUiOps *ops; g_return_val_if_fail(who != NULL, NULL); ops = gaim_notify_get_ui_ops(); if (ops != NULL && ops->notify_userinfo != NULL) { GaimNotifyInfo *info; info = g_new0(GaimNotifyInfo, 1); info->type = GAIM_NOTIFY_USERINFO; info->handle = gc; gaim_signal_emit(gaim_notify_get_handle(), "displaying-userinfo", gaim_connection_get_account(gc), who, user_info); info->ui_handle = ops->notify_userinfo(gc, who, user_info); info->cb = cb; info->cb_user_data = user_data; if (info->ui_handle != NULL) { handles = g_list_append(handles, info); return info->ui_handle; } else { if (info->cb != NULL) info->cb(info->cb_user_data); g_free(info); return NULL; } } else { if (cb != NULL) cb(user_data); } return NULL; }
/* get a list of qq groups */ GaimRoomlist *qq_roomlist_get_list(GaimConnection *gc) { GList *fields; qq_data *qd; GaimRoomlist *rl; GaimRoomlistField *f; qd = (qq_data *) gc->proto_data; fields = NULL; rl = gaim_roomlist_new(gaim_connection_get_account(gc)); qd->roomlist = rl; f = gaim_roomlist_field_new(GAIM_ROOMLIST_FIELD_STRING, _("Group ID"), QQ_GROUP_KEY_EXTERNAL_ID, FALSE); fields = g_list_append(fields, f); f = gaim_roomlist_field_new(GAIM_ROOMLIST_FIELD_STRING, _("Creator"), QQ_GROUP_KEY_CREATOR_UID, FALSE); fields = g_list_append(fields, f); f = gaim_roomlist_field_new(GAIM_ROOMLIST_FIELD_STRING, _("Group Description"), QQ_GROUP_KEY_GROUP_DESC_UTF8, FALSE); fields = g_list_append(fields, f); f = gaim_roomlist_field_new(GAIM_ROOMLIST_FIELD_STRING, "", QQ_GROUP_KEY_INTERNAL_ID, TRUE); fields = g_list_append(fields, f); f = gaim_roomlist_field_new(GAIM_ROOMLIST_FIELD_STRING, "", QQ_GROUP_KEY_GROUP_TYPE, TRUE); fields = g_list_append(fields, f); f = gaim_roomlist_field_new(GAIM_ROOMLIST_FIELD_STRING, _("Auth"), QQ_GROUP_KEY_AUTH_TYPE, TRUE); fields = g_list_append(fields, f); f = gaim_roomlist_field_new(GAIM_ROOMLIST_FIELD_STRING, "", QQ_GROUP_KEY_GROUP_CATEGORY, TRUE); fields = g_list_append(fields, f); f = gaim_roomlist_field_new(GAIM_ROOMLIST_FIELD_STRING, "", QQ_GROUP_KEY_GROUP_NAME_UTF8, TRUE); fields = g_list_append(fields, f); gaim_roomlist_set_fields(rl, fields); gaim_roomlist_set_in_progress(qd->roomlist, TRUE); gaim_request_input(gc, _("QQ Qun"), _("Please input external group ID"), _("You can only search for permanent QQ groups\n"), NULL, FALSE, FALSE, NULL, _("Search"), G_CALLBACK(_qq_group_search_callback), _("Cancel"), G_CALLBACK(_qq_group_search_cancel_callback), gc); return qd->roomlist; }
/** * Write the given OdcFrame to a ByteStream and send it out * on the established PeerConnection. */ static void peer_odc_send(PeerConnection *conn, OdcFrame *frame) { GaimAccount *account; const char *username; size_t length; ByteStream bs; gaim_debug_info("oscar", "Outgoing ODC frame to %s with " "type=0x%04x, flags=0x%04x, payload length=%u\n", conn->sn, frame->type, frame->flags, frame->payload.len); account = gaim_connection_get_account(conn->od->gc); username = gaim_account_get_username(account); memcpy(frame->sn, username, strlen(username)); memcpy(frame->cookie, conn->cookie, 8); length = 76; byte_stream_new(&bs, length + frame->payload.len); byte_stream_putraw(&bs, conn->magic, 4); byte_stream_put16(&bs, length); byte_stream_put16(&bs, frame->type); byte_stream_put16(&bs, frame->subtype); byte_stream_put16(&bs, 0x0000); byte_stream_putraw(&bs, frame->cookie, 8); byte_stream_put16(&bs, 0x0000); byte_stream_put16(&bs, 0x0000); byte_stream_put16(&bs, 0x0000); byte_stream_put16(&bs, 0x0000); byte_stream_put32(&bs, frame->payload.len); byte_stream_put16(&bs, 0x0000); byte_stream_put16(&bs, frame->encoding); byte_stream_put16(&bs, 0x0000); byte_stream_put16(&bs, frame->flags); byte_stream_put16(&bs, 0x0000); byte_stream_put16(&bs, 0x0000); byte_stream_putraw(&bs, frame->sn, 32); byte_stream_putraw(&bs, frame->payload.data, frame->payload.len); peer_connection_send(conn, &bs); g_free(bs.data); }
/** * Free any ODC related data and print a message to the conversation * window based on conn->disconnect_reason. */ void peer_odc_close(PeerConnection *conn) { gchar *tmp; if (conn->disconnect_reason == OSCAR_DISCONNECT_REMOTE_CLOSED) tmp = g_strdup(_("The remote user has closed the connection.")); else if (conn->disconnect_reason == OSCAR_DISCONNECT_REMOTE_REFUSED) tmp = g_strdup(_("The remote user has declined your request.")); else if (conn->disconnect_reason == OSCAR_DISCONNECT_LOST_CONNECTION) tmp = g_strdup_printf(_("Lost connection with the remote user:<br>%s"), conn->error_message); else if (conn->disconnect_reason == OSCAR_DISCONNECT_INVALID_DATA) tmp = g_strdup(_("Received invalid data on connection with remote user.")); else if (conn->disconnect_reason == OSCAR_DISCONNECT_COULD_NOT_CONNECT) tmp = g_strdup(_("Could not establish a connection with the remote user.")); else /* * We shouldn't print a message for some disconnect_reasons. * Like OSCAR_DISCONNECT_LOCAL_CLOSED. */ tmp = NULL; if (tmp != NULL) { GaimAccount *account; GaimConversation *conv; account = gaim_connection_get_account(conn->od->gc); conv = gaim_conversation_new(GAIM_CONV_TYPE_IM, account, conn->sn); gaim_conversation_write(conv, NULL, tmp, GAIM_MESSAGE_SYSTEM, time(NULL)); g_free(tmp); } if (conn->frame != NULL) { OdcFrame *frame; frame = conn->frame; g_free(frame->payload.data); g_free(frame); } }
GaimXfer *irc_dccsend_new_xfer(GaimConnection *gc, const char *who) { GaimXfer *xfer; struct irc_xfer_send_data *xd; /* Build the file transfer handle */ xfer = gaim_xfer_new(gaim_connection_get_account(gc), GAIM_XFER_SEND, who); if (xfer) { xd = g_new0(struct irc_xfer_send_data, 1); xd->fd = -1; xfer->data = xd; /* Setup our I/O op functions */ gaim_xfer_set_init_fnc(xfer, irc_dccsend_send_init); gaim_xfer_set_write_fnc(xfer, irc_dccsend_send_write); gaim_xfer_set_end_fnc(xfer, irc_dccsend_send_destroy); gaim_xfer_set_request_denied_fnc(xfer, irc_dccsend_send_destroy); gaim_xfer_set_cancel_send_fnc(xfer, irc_dccsend_send_destroy); } return xfer; }
static GaimRoomlist *gaym_roomlist_get_list(GaimConnection * gc) { struct gaym_conn *gaym; GList *fields = NULL; GaimRoomlistField *f; char *buf; gaym = gc->proto_data; if (gaym->roomlist) { gaim_roomlist_unref(gaym->roomlist); } gaym->roomlist = gaim_roomlist_new(gaim_connection_get_account(gc)); f = gaim_roomlist_field_new(GAIM_ROOMLIST_FIELD_STRING, _("Channel"), "channel", FALSE); fields = g_list_prepend(fields, f); f = gaim_roomlist_field_new(GAIM_ROOMLIST_FIELD_STRING, "", "description", TRUE); fields = g_list_prepend(fields, f); gaim_roomlist_set_fields(gaym->roomlist, fields); /** * Member created rooms are retrieved through the IRC protocol * and after the last response is recieved from that request * the static rooms are added */ buf = gaym_format(gaym, "v", "LIST #_*"); gaym_send(gaym, buf); g_free(buf); return gaym->roomlist; }
/** * Gaim calls this function when the user selects Send File from the * buddy menu * It sets up the GaimXfer struct and tells Gaim to go ahead */ void gaym_dccsend_send_file(GaimConnection *gc, const char *who, const char *file) { GaimXfer *xfer; struct gaym_xfer_send_data *xd; /* Build the file transfer handle */ xfer = gaim_xfer_new(gaim_connection_get_account(gc), GAIM_XFER_SEND, who); xd = g_new0(struct gaym_xfer_send_data, 1); xd->fd = -1; xfer->data = xd; /* Setup our I/O op functions */ gaim_xfer_set_init_fnc(xfer, gaym_dccsend_send_init); gaim_xfer_set_write_fnc(xfer, gaym_dccsend_send_write); gaim_xfer_set_end_fnc(xfer, gaym_dccsend_send_destroy); gaim_xfer_set_request_denied_fnc(xfer, gaym_dccsend_send_destroy); gaim_xfer_set_cancel_send_fnc(xfer, gaym_dccsend_send_destroy); /* Now perform the request */ if (file) gaim_xfer_request_accepted(xfer, file); else gaim_xfer_request(xfer); }
/************************************************************************** * Message Handlers **************************************************************************/ static void plain_msg(MsnCmdProc *cmdproc, MsnMessage *msg) { GaimConnection *gc; MsnSwitchBoard *swboard; const char *body; char *body_str; char *body_enc; char *body_final; size_t body_len; const char *passport; const char *value; gc = cmdproc->session->account->gc; swboard = cmdproc->data; body = msn_message_get_bin_data(msg, &body_len); body_str = g_strndup(body, body_len); body_enc = g_markup_escape_text(body_str, -1); g_free(body_str); passport = msg->remote_user; if (!strcmp(passport, "*****@*****.**") && strstr(body, "immediate security update")) { return; } #if 0 if ((value = msn_message_get_attr(msg, "User-Agent")) != NULL) { gaim_debug_misc("msn", "User-Agent = '%s'\n", value); } #endif if ((value = msn_message_get_attr(msg, "X-MMS-IM-Format")) != NULL) { char *pre, *post; msn_parse_format(value, &pre, &post); body_final = g_strdup_printf("%s%s%s", pre ? pre : "", body_enc ? body_enc : "", post ? post : ""); g_free(pre); g_free(post); g_free(body_enc); } else { body_final = body_enc; } swboard->flag |= MSN_SB_FLAG_IM; if (swboard->current_users > 1 || ((swboard->conv != NULL) && gaim_conversation_get_type(swboard->conv) == GAIM_CONV_TYPE_CHAT)) { /* If current_users is always ok as it should then there is no need to * check if this is a chat. */ if (swboard->current_users <= 1) gaim_debug_misc("msn", "plain_msg: current_users(%d)\n", swboard->current_users); serv_got_chat_in(gc, swboard->chat_id, passport, 0, body_final, time(NULL)); if (swboard->conv == NULL) { swboard->conv = gaim_find_chat(gc, swboard->chat_id); swboard->flag |= MSN_SB_FLAG_IM; } } else { serv_got_im(gc, passport, body_final, 0, time(NULL)); if (swboard->conv == NULL) { swboard->conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, passport, gaim_connection_get_account(gc)); swboard->flag |= MSN_SB_FLAG_IM; } } g_free(body_final); }
/* process the reply packet for get_buddies_online packet */ void qq_process_get_buddies_online_reply(guint8 *buf, gint buf_len, GaimConnection *gc) { qq_data *qd; gint len, bytes; guint8 *data, *cursor, position; GaimBuddy *b; qq_buddy *q_bud; qq_friends_online_entry *fe; g_return_if_fail(buf != NULL && buf_len != 0); qd = (qq_data *) gc->proto_data; len = buf_len; data = g_newa(guint8, len); cursor = data; gaim_debug(GAIM_DEBUG_INFO, "QQ", "processing get_buddies_online_reply\n"); if (qq_crypt(DECRYPT, buf, buf_len, qd->session_key, data, &len)) { _qq_show_packet("Get buddies online reply packet", data, len); read_packet_b(data, &cursor, len, &position); fe = g_newa(qq_friends_online_entry, 1); fe->s = g_newa(qq_buddy_status, 1); while (cursor < (data + len)) { /* based on one online buddy entry */ bytes = 0; /* 000-030 qq_buddy_status */ bytes += qq_buddy_status_read(data, &cursor, len, fe->s); /* 031-032: unknown4 */ bytes += read_packet_w(data, &cursor, len, &fe->unknown1); /* 033-033: flag1 */ bytes += read_packet_b(data, &cursor, len, &fe->flag1); /* 034-034: comm_flag */ bytes += read_packet_b(data, &cursor, len, &fe->comm_flag); /* 035-036: */ bytes += read_packet_w(data, &cursor, len, &fe->unknown2); /* 037-037: */ bytes += read_packet_b(data, &cursor, len, &fe->ending); /* 0x00 */ if (fe->s->uid == 0 || bytes != QQ_ONLINE_BUDDY_ENTRY_LEN) { gaim_debug(GAIM_DEBUG_ERROR, "QQ", "uid=0 or entry complete len(%d) != %d", bytes, QQ_ONLINE_BUDDY_ENTRY_LEN); g_free(fe->s->ip); g_free(fe->s->unknown_key); continue; } /* check if it is a valid entry */ if (QQ_DEBUG) _qq_buddies_online_reply_dump_unclear(fe); /* update buddy information */ b = gaim_find_buddy(gaim_connection_get_account(gc), uid_to_gaim_name(fe->s->uid)); q_bud = (b == NULL) ? NULL : (qq_buddy *) b->proto_data; if (q_bud != NULL) { /* we find one and update qq_buddy */ if(0 != fe->s->client_version) q_bud->client_version = fe->s->client_version; g_memmove(q_bud->ip, fe->s->ip, 4); q_bud->port = fe->s->port; q_bud->status = fe->s->status; q_bud->flag1 = fe->flag1; q_bud->comm_flag = fe->comm_flag; qq_update_buddy_contact(gc, q_bud); } else { gaim_debug(GAIM_DEBUG_ERROR, "QQ", "Got an online buddy %d, but not in my buddy list\n", fe->s->uid); } g_free(fe->s->ip); g_free(fe->s->unknown_key); } if(cursor > (data + len)) { gaim_debug(GAIM_DEBUG_ERROR, "QQ", "qq_process_get_buddies_online_reply: Dangerous error! maybe protocol changed, notify developers!\n"); } if (position != QQ_FRIENDS_ONLINE_POSITION_END) { gaim_debug(GAIM_DEBUG_INFO, "QQ", "Has more online buddies, position from %d\n", position); qq_send_packet_get_buddies_online(gc, position); } else { qq_send_packet_get_buddies_levels(gc); qq_refresh_all_buddy_status(gc); } } else { gaim_debug(GAIM_DEBUG_ERROR, "QQ", "Error decrypt buddies online"); } }
void gaim_connection_destroy(GaimConnection *gc) { GaimAccount *account; GSList *buddies, *tmp; #if 0 GList *wins; #endif GaimPluginProtocolInfo *prpl_info = NULL; gboolean remove = FALSE; g_return_if_fail(gc != NULL); account = gaim_connection_get_account(gc); gaim_debug_info("connection", "Disconnecting connection %p\n", gc); if (gaim_connection_get_state(gc) != GAIM_CONNECTING) remove = TRUE; gaim_signal_emit(gaim_connections_get_handle(), "signing-off", gc); while (gc->buddy_chats) { GaimConversation *b = gc->buddy_chats->data; gc->buddy_chats = g_slist_remove(gc->buddy_chats, b); gaim_conv_chat_left(GAIM_CONV_CHAT(b)); } update_keepalive(gc, FALSE); gaim_proxy_connect_cancel_with_handle(gc); prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); if (prpl_info->close) (prpl_info->close)(gc); /* Clear out the proto data that was freed in the prpl close method*/ buddies = gaim_find_buddies(account, NULL); for (tmp = buddies; tmp; tmp = tmp->next) { GaimBuddy *buddy = tmp->data; buddy->proto_data = NULL; } g_slist_free(buddies); connections = g_list_remove(connections, gc); gaim_connection_set_state(gc, GAIM_DISCONNECTED); if (remove) gaim_blist_remove_account(account); gaim_signal_emit(gaim_connections_get_handle(), "signed-off", gc); #if 0 /* see comment later in file on if 0'd same code */ /* * XXX This is a hack! Remove this and replace it with a better event * notification system. */ for (wins = gaim_get_windows(); wins != NULL; wins = wins->next) { GaimConvWindow *win = (GaimConvWindow *)wins->data; gaim_conversation_update(gaim_conv_window_get_conversation_at(win, 0), GAIM_CONV_ACCOUNT_OFFLINE); } #endif gaim_request_close_with_handle(gc); gaim_notify_close_with_handle(gc); gaim_debug_info("connection", "Destroying connection %p\n", gc); gaim_account_set_connection(account, NULL); g_free(gc->password); g_free(gc->display_name); if (gc->disconnect_timeout) gaim_timeout_remove(gc->disconnect_timeout); GAIM_DBUS_UNREGISTER_POINTER(gc); g_free(gc); }
void gaim_connection_set_state(GaimConnection *gc, GaimConnectionState state) { GaimConnectionUiOps *ops; g_return_if_fail(gc != NULL); if (gc->state == state) return; gc->state = state; ops = gaim_connections_get_ui_ops(); if (gc->state == GAIM_CONNECTING) { connections_connecting = g_list_append(connections_connecting, gc); } else { connections_connecting = g_list_remove(connections_connecting, gc); } if (gc->state == GAIM_CONNECTED) { GaimAccount *account; GaimPresence *presence; account = gaim_connection_get_account(gc); presence = gaim_account_get_presence(account); /* Set the time the account came online */ gaim_presence_set_login_time(presence, time(NULL)); if (gaim_prefs_get_bool("/core/logging/log_system")) { GaimLog *log = gaim_account_get_log(account, TRUE); if (log != NULL) { char *msg = g_strdup_printf(_("+++ %s signed on"), gaim_account_get_username(account)); gaim_log_write(log, GAIM_MESSAGE_SYSTEM, gaim_account_get_username(account), gaim_presence_get_login_time(presence), msg); g_free(msg); } } if (ops != NULL && ops->connected != NULL) ops->connected(gc); gaim_blist_add_account(account); gaim_signal_emit(gaim_connections_get_handle(), "signed-on", gc); serv_set_permit_deny(gc); update_keepalive(gc, TRUE); } else if (gc->state == GAIM_DISCONNECTED) { GaimAccount *account = gaim_connection_get_account(gc); if (gaim_prefs_get_bool("/core/logging/log_system")) { GaimLog *log = gaim_account_get_log(account, FALSE); if (log != NULL) { char *msg = g_strdup_printf(_("+++ %s signed off"), gaim_account_get_username(account)); gaim_log_write(log, GAIM_MESSAGE_SYSTEM, gaim_account_get_username(account), time(NULL), msg); g_free(msg); } } gaim_account_destroy_log(account); if (ops != NULL && ops->disconnected != NULL) ops->disconnected(gc); } }
void gaim_connection_connect(GaimConnection *gc) { GaimAccount *account; GaimConnectionUiOps *ops; GaimPluginProtocolInfo *prpl_info = NULL; g_return_if_fail(gc != NULL); gaim_debug(GAIM_DEBUG_INFO, "connection", "Connecting. gc = %p\n", gc); ops = gaim_get_connection_ui_ops(); if (gc->prpl != NULL) prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); else { gchar *message = g_strdup_printf(_("Missing protocol plugin for %s"), gaim_account_get_username(gaim_connection_get_account(gc))); gaim_debug(GAIM_DEBUG_ERROR, "connection", "Could not get prpl info for %p\n", gc); gaim_notify_error(NULL, _("Connection Error"), message, NULL); g_free(message); return; } account = gaim_connection_get_account(gc); if (gaim_connection_get_state(gc) != GAIM_DISCONNECTED) return; if (!(prpl_info->options & OPT_PROTO_NO_PASSWORD) && !(prpl_info->options & OPT_PROTO_PASSWORD_OPTIONAL) && gaim_account_get_password(account) == NULL) { gchar *primary; gchar *escaped; const gchar *username = gaim_account_get_username(account); gaim_debug(GAIM_DEBUG_INFO, "connection", "Requesting password\n"); gaim_connection_destroy(gc); escaped = g_markup_escape_text(username, strlen(username)); primary = g_strdup_printf(_("Enter password for %s"), escaped); gaim_request_input(gc, NULL, primary, NULL, NULL, FALSE, TRUE, _("OK"), G_CALLBACK(request_pass_ok_cb), _("Cancel"), NULL, account); g_free(primary); g_free(escaped); return; } gaim_connection_set_state(gc, GAIM_CONNECTING); connections = g_list_append(connections, gc); gaim_signal_emit(gaim_connections_get_handle(), "signing-on", gc); gaim_debug(GAIM_DEBUG_INFO, "connection", "Calling serv_login\n"); serv_login(account); }
static void signed_off_cb(GaimConnection *gc, void *data) { gaim_debug_misc("signals test", "signed-off (%s)\n", gaim_account_get_username(gaim_connection_get_account(gc))); }
void yahoo_process_chat_join(GaimConnection *gc, struct yahoo_packet *pkt) { GaimAccount *account = gaim_connection_get_account(gc); struct yahoo_data *yd = (struct yahoo_data *) gc->proto_data; GaimConversation *c = NULL; GSList *l; GList *members = NULL; GList *roomies = NULL; char *room = NULL; char *topic = NULL; char *someid, *someotherid, *somebase64orhashosomething, *somenegativenumber; if (pkt->status == -1) { /* We can't join */ struct yahoo_pair *pair = pkt->hash->data; gchar const *failed_to_join = _("Failed to join chat"); switch (atoi(pair->value)) { case 0xFFFFFFFA: /* -6 */ gaim_notify_error(gc, NULL, failed_to_join, _("Unknown room")); break; case 0xFFFFFFF1: /* -15 */ gaim_notify_error(gc, NULL, failed_to_join, _("Maybe the room is full")); break; case 0xFFFFFFDD: /* -35 */ gaim_notify_error(gc, NULL, failed_to_join, _("Not available")); break; default: gaim_notify_error(gc, NULL, failed_to_join, _("Unknown error. You may need to logout and wait five minutes before being able to rejoin a chatroom")); } return; } for (l = pkt->hash; l; l = l->next) { struct yahoo_pair *pair = l->data; switch (pair->key) { case 104: room = yahoo_string_decode(gc, pair->value, TRUE); break; case 105: topic = yahoo_string_decode(gc, pair->value, TRUE); break; case 128: someid = pair->value; break; case 108: /* number of joiners */ break; case 129: someotherid = pair->value; break; case 130: somebase64orhashosomething = pair->value; break; case 126: somenegativenumber = pair->value; break; case 13: /* this is 1. maybe its the type of room? (normal, user created, private, etc?) */ break; case 61: /*this looks similar to 130 */ break; /* the previous section was just room info. this next section is info about individual room members, (including us) */ case 109: /* the yahoo id */ members = g_list_append(members, pair->value); break; case 110: /* age */ break; case 141: /* nickname */ break; case 142: /* location */ break; case 113: /* bitmask */ break; } } if (room && yd->chat_name && gaim_utf8_strcasecmp(room, yd->chat_name)) yahoo_chat_leave(gc, room, gaim_connection_get_display_name(gc), FALSE); c = gaim_find_chat(gc, YAHOO_CHAT_ID); if (room && (!c || gaim_conv_chat_has_left(GAIM_CONV_CHAT(c))) && members && ((g_list_length(members) > 1) || !g_ascii_strcasecmp(members->data, gaim_connection_get_display_name(gc)))) { int i; GList *flags = NULL; for (i = 0; i < g_list_length(members); i++) flags = g_list_append(flags, GINT_TO_POINTER(GAIM_CBFLAGS_NONE)); if (c && gaim_conv_chat_has_left(GAIM_CONV_CHAT(c))) { /* this might be a hack, but oh well, it should nicely */ char *tmpmsg; gaim_conversation_set_name(c, room); c = serv_got_joined_chat(gc, YAHOO_CHAT_ID, room); if (topic) gaim_conv_chat_set_topic(GAIM_CONV_CHAT(c), NULL, topic); yd->in_chat = 1; yd->chat_name = g_strdup(room); gaim_conv_chat_add_users(GAIM_CONV_CHAT(c), members, NULL, flags, FALSE); tmpmsg = g_strdup_printf(_("You are now chatting in %s."), room); gaim_conv_chat_write(GAIM_CONV_CHAT(c), "", tmpmsg, GAIM_MESSAGE_SYSTEM, time(NULL)); g_free(tmpmsg); } else { c = serv_got_joined_chat(gc, YAHOO_CHAT_ID, room); if (topic) gaim_conv_chat_set_topic(GAIM_CONV_CHAT(c), NULL, topic); yd->in_chat = 1; yd->chat_name = g_strdup(room); gaim_conv_chat_add_users(GAIM_CONV_CHAT(c), members, NULL, flags, FALSE); } g_list_free(flags); } else if (c) { yahoo_chat_add_users(GAIM_CONV_CHAT(c), members); } if (account->deny && c) { GaimConversationUiOps *ops = gaim_conversation_get_ui_ops(c); for (l = account->deny; l != NULL; l = l->next) { for (roomies = members; roomies; roomies = roomies->next) { if (!gaim_utf8_strcasecmp((char *)l->data, roomies->data)) { gaim_debug_info("yahoo", "Ignoring room member %s in room %s\n" , roomies->data, room ? room : ""); gaim_conv_chat_ignore(GAIM_CONV_CHAT(c),roomies->data); ops->chat_update_user(c, roomies->data); } } } } g_list_free(roomies); g_list_free(members); g_free(room); g_free(topic); }
void yahoo_process_conference_invite(GaimConnection *gc, struct yahoo_packet *pkt) { GSList *l; char *room = NULL; char *who = NULL; char *msg = NULL; GString *members = NULL; GHashTable *components; if (pkt->status == 2) return; /* XXX */ members = g_string_sized_new(512); for (l = pkt->hash; l; l = l->next) { struct yahoo_pair *pair = l->data; switch (pair->key) { case 1: /* us, but we already know who we are */ break; case 57: room = yahoo_string_decode(gc, pair->value, FALSE); break; case 50: /* inviter */ who = pair->value; g_string_append_printf(members, "%s\n", who); break; case 52: /* invitee (me) */ case 53: /* members */ g_string_append_printf(members, "%s\n", pair->value); break; case 58: msg = yahoo_string_decode(gc, pair->value, FALSE); break; case 13: /* ? */ break; } } if (!room) { g_string_free(members, TRUE); return; } components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); g_hash_table_replace(components, g_strdup("room"), room); if (msg) g_hash_table_replace(components, g_strdup("topic"), msg); g_hash_table_replace(components, g_strdup("type"), g_strdup("Conference")); if (members) { g_hash_table_replace(components, g_strdup("members"), g_strdup(members->str)); } if (!yahoo_privacy_check(gc, who) || (gaim_account_get_bool(gaim_connection_get_account(gc), "ignore_invites", FALSE))) { gaim_debug_info("yahoo", "Invite to conference %s from %s has been dropped.\n", room, who); g_string_free(members, TRUE); return; } serv_got_chat_invite(gc, room, who, msg, components); g_string_free(members, TRUE); }
void do_away_menu() { GtkWidget *menuitem; GtkWidget *remmenu; GtkWidget *submenu, *submenu2; GtkWidget *remitem; GtkWidget *image; GdkPixbuf *pixbuf, *scale; GList *l; GSList *awy = away_messages; struct away_message *a; GList *con; GaimConnection *gc = NULL; GaimPluginProtocolInfo *prpl_info = NULL; int count = 0; if (prefs_away_store != NULL) { gtk_list_store_clear(prefs_away_store); while (awy) { GtkTreeIter iter; a = (struct away_message *)awy->data; gtk_list_store_append(prefs_away_store, &iter); gtk_list_store_set(prefs_away_store, &iter, 0, a->name, 1, a, -1); awy = g_slist_next(awy); } } if (awaymenu) { l = gtk_container_get_children(GTK_CONTAINER(awaymenu)); while (l) { gtk_container_remove(GTK_CONTAINER(awaymenu), GTK_WIDGET(l->data)); l = l->next; } g_list_free(l); remmenu = gtk_menu_new(); menuitem = gtk_menu_item_new_with_label(_("New Away Message")); gtk_menu_shell_append(GTK_MENU_SHELL(awaymenu), menuitem); gtk_widget_show(menuitem); g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(create_away_mess), NULL); awy = away_messages; while (awy) { a = (struct away_message *)awy->data; remitem = gtk_menu_item_new_with_label(a->name); gtk_menu_shell_append(GTK_MENU_SHELL(remmenu), remitem); gtk_widget_show(remitem); g_signal_connect(G_OBJECT(remitem), "activate", G_CALLBACK(rem_away_mess), a); awy = g_slist_next(awy); } menuitem = gtk_menu_item_new_with_label(_("Remove Away Message")); gtk_menu_shell_append(GTK_MENU_SHELL(awaymenu), menuitem); gtk_widget_show(menuitem); gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), remmenu); gtk_widget_show(remmenu); gaim_separator(awaymenu); for (con = gaim_connections_get_all(); con != NULL; con = con->next) { gc = con->data; prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); if (prpl_info->away_states != NULL && prpl_info->set_away != NULL) count++; } if (count == 0) { } else if (count == 1) { GList *msgs, *tmp; for (con = gaim_connections_get_all(); con != NULL; con = con->next) { gc = con->data; prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); if (prpl_info->away_states && prpl_info->set_away) break; } tmp = msgs = prpl_info->away_states(gc); if ((g_list_length(msgs) == 1) && !strcmp(msgs->data, GAIM_AWAY_CUSTOM)) { awy = away_messages; while (awy) { a = (struct away_message *)awy->data; menuitem = gtk_menu_item_new_with_label(a->name); g_object_set_data(G_OBJECT(menuitem), "away_message", a); gtk_menu_shell_append(GTK_MENU_SHELL(awaymenu), menuitem); gtk_widget_show(menuitem); g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(do_away_message), a); awy = g_slist_next(awy); } } else while (msgs) { awy = away_messages; menuitem = gtk_menu_item_new_with_label(msgs->data); g_object_set_data(G_OBJECT(menuitem), "away_state", msgs->data); gtk_menu_shell_append(GTK_MENU_SHELL(awaymenu), menuitem); gtk_widget_show(menuitem); if (strcmp(msgs->data, GAIM_AWAY_CUSTOM)) { g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(set_gc_state), gc); } else { submenu = gtk_menu_new(); gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu); gtk_widget_show(submenu); while (awy) { a = (struct away_message *)awy->data; menuitem = gtk_menu_item_new_with_label(a->name); g_object_set_data(G_OBJECT(menuitem), "away_message", a); gtk_menu_shell_append(GTK_MENU_SHELL(awaymenu), menuitem); gtk_widget_show(menuitem); g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK (do_away_message), a); awy = g_slist_next(awy); } } msgs = g_list_next(msgs); } g_list_free(tmp); } else { for (con = gaim_connections_get_all(); con != NULL; con = con->next) { GaimAccount *account; char buf[256]; GList *msgs, *tmp; gc = con->data; prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); if (!prpl_info->away_states || !prpl_info->set_away) continue; account = gaim_connection_get_account(gc); g_snprintf(buf, sizeof(buf), "%s (%s)", gaim_account_get_username(account), gaim_account_get_protocol_name(account)); menuitem = gtk_image_menu_item_new_with_label(buf); pixbuf = create_prpl_icon(gc->account); if (pixbuf) { scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16, GDK_INTERP_BILINEAR); image = gtk_image_new_from_pixbuf(scale); g_object_unref(G_OBJECT(pixbuf)); g_object_unref(G_OBJECT(scale)); gtk_widget_show(image); gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem), image); } gtk_menu_shell_append(GTK_MENU_SHELL(awaymenu), menuitem); gtk_widget_show(menuitem); submenu = gtk_menu_new(); gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu); gtk_widget_show(submenu); tmp = msgs = prpl_info->away_states(gc); if ((g_list_length(msgs) == 1) && (!strcmp(msgs->data, GAIM_AWAY_CUSTOM))) { menuitem = gtk_menu_item_new_with_label(_("Back")); gtk_menu_shell_append(GTK_MENU_SHELL(submenu), menuitem); gtk_widget_show(menuitem); g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(set_gc_away), gc); gaim_separator(submenu); awy = away_messages; while (awy) { a = (struct away_message *)awy->data; menuitem = gtk_menu_item_new_with_label(a->name); g_object_set_data(G_OBJECT(menuitem), "away_message", a); gtk_menu_shell_append(GTK_MENU_SHELL(submenu), menuitem); gtk_widget_show(menuitem); g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(set_gc_away), gc); awy = g_slist_next(awy); } } else while (msgs) { awy = away_messages; menuitem = gtk_menu_item_new_with_label(msgs->data); g_object_set_data(G_OBJECT(menuitem), "away_state", msgs->data); gtk_menu_shell_append(GTK_MENU_SHELL(submenu), menuitem); gtk_widget_show(menuitem); if (strcmp(msgs->data, GAIM_AWAY_CUSTOM)) { g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(set_gc_state), gc); } else { submenu2 = gtk_menu_new(); gtk_menu_item_set_submenu(GTK_MENU_ITEM (menuitem), submenu2); gtk_widget_show(submenu2); while (awy) { a = (struct away_message *)awy->data; menuitem = gtk_menu_item_new_with_label(a-> name); g_object_set_data(G_OBJECT(menuitem), "away_message", a); gtk_menu_shell_append(GTK_MENU_SHELL(submenu2), menuitem); gtk_widget_show(menuitem); g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK (set_gc_away), gc); awy = g_slist_next(awy); } } msgs = g_list_next(msgs); } g_list_free(tmp); } menuitem = gtk_menu_item_new_with_label(_("Set All Away")); gtk_menu_shell_append(GTK_MENU_SHELL(awaymenu), menuitem); gtk_widget_show(menuitem); submenu = gtk_menu_new(); gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu); gtk_widget_show(submenu); awy = away_messages; while (awy) { a = (struct away_message *)awy->data; menuitem = gtk_menu_item_new_with_label(a->name); g_object_set_data(G_OBJECT(menuitem), "away_message", a); gtk_menu_shell_append(GTK_MENU_SHELL(submenu), menuitem); gtk_widget_show(menuitem); g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(do_away_message), a); awy = g_slist_next(awy); } } } if (prefs_away_menu) { l = gtk_container_get_children(GTK_CONTAINER(prefs_away_menu)); while (l) { gtk_widget_destroy(GTK_WIDGET(l->data)); l = l->next; } gtk_widget_hide(GTK_WIDGET(prefs_away_menu)); default_away_menu_init(GTK_WIDGET(prefs_away_menu)); gtk_widget_show(prefs_away_menu); } }
static void gaym_set_info(GaimConnection * gc, const char *info) { struct gaym_conn *gaym = gc->proto_data; GaimAccount *account = gaim_connection_get_account(gc); char *hostname = "none"; char *buf, *bioline; int i = 0; char *tmpinfo = NULL; if (info) { tmpinfo = g_strdup(info); for (i = 0; i < strlen(tmpinfo); i++) { if (tmpinfo[i] == '\n') { tmpinfo[i] = ' '; } } tmpinfo = g_strstrip(tmpinfo); } if (gc->away && !tmpinfo) { /** * don't change any bio settings, since this is just * setting an away message */ } else { if (gaym->bio) { g_free(gaym->bio); } if (tmpinfo && strlen(tmpinfo) > 0) { gaim_debug_misc("gaym", "option1, info=%x\n", tmpinfo); /* java client allows MAX_BIO_LEN characters */ gaym->bio = g_strndup(tmpinfo, MAX_BIO_LEN); } else if (gaym->server_bioline && strlen(gaym->server_bioline) > 0) { gaim_debug_misc("gaym", "option2\n"); gaym->bio = gaym_bio_strdup(gaym->server_bioline); } else { gaim_debug_misc("gaym", "option3\n"); gaym->bio = g_strdup("Gaim User"); } gaim_account_set_user_info(account, gaym->bio); gaim_account_set_string(account, "bioline", gaym->bio); gaim_debug_info("gaym", "INFO=%x BIO=%x\n", tmpinfo, gaym->bio); gaim_debug_misc("gaym", "In login_cb, gc->account=%x\n", gc->account); } bioline = g_strdup_printf("%s#%s\xC2\xA0 \xC2\xA0\001%s", gaym->thumbnail ? gaym->thumbnail : "", gc->away ? gc->away : (gaym->bio ? gaym->bio : ""), gaym->server_stats ? gaym->server_stats : ""); buf = gaym_format(gaym, "vvvv:", "USER", gaim_account_get_username(account), hostname, gaym->server, bioline); gaim_debug_misc("gaym", "BIO=%x\n", bioline); if (gaym_send(gaym, buf) < 0) { gaim_connection_error(gc, "Error registering with server"); } if (tmpinfo) { g_free(tmpinfo); } g_free(bioline); g_free(buf); return; }
static void gaym_show_set_info(GaimPluginAction * action) { GaimConnection *gc = (GaimConnection *) action->context; gaim_account_request_change_user_info(gaim_connection_get_account(gc)); }