/* this is basicly the opposite of chat_online */ void yahoo_process_chat_logout(PurpleConnection *gc, struct yahoo_packet *pkt) { YahooData *yd = (YahooData *) gc->proto_data; GSList *l; for (l = pkt->hash; l; l = l->next) { struct yahoo_pair *pair = l->data; if (pair->key == 1) if (g_ascii_strcasecmp(pair->value, purple_connection_get_display_name(gc))) return; } if (pkt->status == 1) { yd->chat_online = FALSE; g_free(yd->pending_chat_room); yd->pending_chat_room = NULL; g_free(yd->pending_chat_id); yd->pending_chat_id = NULL; g_free(yd->pending_chat_topic); yd->pending_chat_topic = NULL; g_free(yd->pending_chat_goto); yd->pending_chat_goto = NULL; if (yd->in_chat) yahoo_c_leave(gc, YAHOO_CHAT_ID); } }
/* this is basicly the opposite of chat_online */ void yahoo_process_chat_logout(GaimConnection *gc, struct yahoo_packet *pkt) { struct yahoo_data *yd = (struct yahoo_data *) gc->proto_data; GSList *l; for (l = pkt->hash; l; l = l->next) { struct yahoo_pair *pair = l->data; if (pair->key == 1) if (g_ascii_strcasecmp(pair->value, gaim_connection_get_display_name(gc))) return; } if (pkt->status == 1) { yd->chat_online = 0; if (yd->in_chat) yahoo_c_leave(gc, YAHOO_CHAT_ID); } }
void yahoo_c_join(GaimConnection *gc, GHashTable *data) { struct yahoo_data *yd; char *room, *topic, *members, *type; int id; GaimConversation *c; yd = (struct yahoo_data *) gc->proto_data; if (!yd) return; room = g_hash_table_lookup(data, "room"); if (!room) return; topic = g_hash_table_lookup(data, "topic"); if (!topic) topic = ""; members = g_hash_table_lookup(data, "members"); if ((type = g_hash_table_lookup(data, "type")) && !strcmp(type, "Conference")) { id = yd->conf_id++; c = serv_got_joined_chat(gc, id, room); yd->confs = g_slist_prepend(yd->confs, c); gaim_chat_set_topic(GAIM_CHAT(c), gaim_connection_get_display_name(gc), topic); yahoo_conf_join(yd, c, gaim_connection_get_display_name(gc), room, topic, members); return; } else { if (yd->in_chat) yahoo_c_leave(gc, YAHOO_CHAT_ID); if (!yd->chat_online) yahoo_chat_online(gc); yahoo_chat_join(yd, gaim_connection_get_display_name(gc), room, topic); return; } }
void yahoo_process_chat_join(GaimConnection *gc, struct yahoo_packet *pkt) { struct yahoo_data *yd = (struct yahoo_data *) gc->proto_data; GaimConversation *c = NULL; GSList *l; GList *members = NULL; char *room = NULL; char *topic = NULL; char *someid, *someotherid, *somebase64orhashosomething, *somenegativenumber; if (pkt->status == -1) { gaim_notify_error(gc, NULL, _("Failed to join chat"), _("Maybe the room is full?")); return; } for (l = pkt->hash; l; l = l->next) { struct yahoo_pair *pair = l->data; switch (pair->key) { case 104: room = pair->value; break; case 105: topic = pair->value; 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 similiar 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) return; if (yd->chat_name && gaim_utf8_strcasecmp(room, yd->chat_name)) yahoo_c_leave(gc, YAHOO_CHAT_ID); c = gaim_find_chat(gc, YAHOO_CHAT_ID); if (!c) { c = serv_got_joined_chat(gc, YAHOO_CHAT_ID, room); if (topic) gaim_chat_set_topic(GAIM_CHAT(c), NULL, topic); yd->in_chat = 1; yd->chat_name = g_strdup(room); gaim_chat_add_users(GAIM_CHAT(c), members); } else { yahoo_chat_add_users(GAIM_CHAT(c), members); } g_list_free(members); }