From: <the...@us...> - 2006-06-22 06:26:42
|
Revision: 16306 Author: thekingant Date: 2006-06-21 23:26:38 -0700 (Wed, 21 Jun 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16306&view=rev Log Message: ----------- Keep track of the Yahoo! IMVironment specified by the people we're IMing with. When we reply to their IMs, we now send the same IMVironment instead of always sending an empty IMVironment because sending an empty IMVironment would reset their IMVironment back to nothing. This shouldn't negatively affect the Doodle stuff... but it didn't work for me when I tested it, so it's hard to tell. This is a change I made while at Meebo Modified Paths: -------------- trunk/src/protocols/yahoo/yahoo.c trunk/src/protocols/yahoo/yahoo.h trunk/src/protocols/yahoo/yahoo_filexfer.c Modified: trunk/src/protocols/yahoo/yahoo.c =================================================================== --- trunk/src/protocols/yahoo/yahoo.c 2006-06-22 06:00:25 UTC (rev 16305) +++ trunk/src/protocols/yahoo/yahoo.c 2006-06-22 06:26:38 UTC (rev 16306) @@ -670,6 +670,7 @@ static void yahoo_process_message(GaimConnection *gc, struct yahoo_packet *pkt) { + struct yahoo_data *yd = gc->proto_data; GSList *l = pkt->hash; GSList *list = NULL; struct _yahoo_im *im = NULL; @@ -712,24 +713,29 @@ /** TODO: It seems that this check should be per IM, not global */ /* Check for the Doodle IMV */ - if(im != NULL && imv != NULL && !strcmp(imv, "doodle;11")) + if (im != NULL && imv!= NULL && im->from != NULL) { - GaimWhiteboard *wb; + g_hash_table_replace(yd->imvironments, g_strdup(im->from), g_strdup(imv)); - if (!yahoo_privacy_check(gc, im->from)) { - gaim_debug_info("yahoo", "Doodle request from %s dropped.\n", im->from); - return; - } + if (strcmp(imv, "doodle;11") == 0) + { + GaimWhiteboard *wb; - wb = gaim_whiteboard_get_session(gc->account, im->from); + if (!yahoo_privacy_check(gc, im->from)) { + gaim_debug_info("yahoo", "Doodle request from %s dropped.\n", im->from); + return; + } - /* If a Doodle session doesn't exist between this user */ - if(wb == NULL) - { - wb = gaim_whiteboard_create(gc->account, im->from, DOODLE_STATE_REQUESTED); + wb = gaim_whiteboard_get_session(gc->account, im->from); - yahoo_doodle_command_send_request(gc, im->from); - yahoo_doodle_command_send_ready(gc, im->from); + /* If a Doodle session doesn't exist between this user */ + if(wb == NULL) + { + wb = gaim_whiteboard_create(gc->account, im->from, DOODLE_STATE_REQUESTED); + + yahoo_doodle_command_send_request(gc, im->from); + yahoo_doodle_command_send_ready(gc, im->from); + } } } @@ -2576,6 +2582,7 @@ /* TODO: Is there a good grow size for the buffer? */ yd->txbuf = gaim_circ_buffer_new(0); yd->friends = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, yahoo_friend_free); + yd->imvironments = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); yd->confs = NULL; yd->conf_id = 2; @@ -2628,6 +2635,7 @@ yahoo_c_leave(gc, 1); /* 1 = YAHOO_CHAT_ID */ g_hash_table_destroy(yd->friends); + g_hash_table_destroy(yd->imvironments); g_free(yd->chat_name); g_free(yd->cookie_y); @@ -3101,14 +3109,30 @@ yahoo_packet_hash_str(pkt, 97, "1"); yahoo_packet_hash_str(pkt, 14, msg2); - /* If this message is to a user who is also Doodling with the local user, + /* + * IMVironment. + * + * If this message is to a user who is also Doodling with the local user, * format the chat packet with the correct IMV information (thanks Yahoo!) - */ - wb = gaim_whiteboard_get_session(gc->account, (char*)who); + * + * Otherwise attempt to use the same IMVironment as the remote user, + * just so that we don't inadvertantly reset their IMVironment back + * to nothing. + * + * If they have no set an IMVironment, then use the default. + */ + wb = gaim_whiteboard_get_session(gc->account, who); if (wb) - yahoo_packet_hash_str(pkt, 63, "doodle;11"); + yahoo_packet_hash_str(pkt, 63, "doodle;11"); else - yahoo_packet_hash_str(pkt, 63, ";0"); /* IMvironment */ + { + const char *imv; + imv = g_hash_table_lookup(yd->imvironments, who); + if (imv != NULL) + yahoo_packet_hash_str(pkt, 63, imv); + else + yahoo_packet_hash_str(pkt, 63, ";0"); + } yahoo_packet_hash_str(pkt, 64, "0"); /* no idea */ yahoo_packet_hash_str(pkt, 1002, "1"); /* no idea, Yahoo 6 or later only it seems */ Modified: trunk/src/protocols/yahoo/yahoo.h =================================================================== --- trunk/src/protocols/yahoo/yahoo.h 2006-06-22 06:00:25 UTC (rev 16305) +++ trunk/src/protocols/yahoo/yahoo.h 2006-06-22 06:26:38 UTC (rev 16306) @@ -105,6 +105,16 @@ GaimCircBuffer *txbuf; guint txhandler; GHashTable *friends; + + /** + * This is used to keep track of the IMVironment chosen + * by people you talk to. We don't do very much with + * this right now... but at least now if the remote user + * selects an IMVironment we won't reset it back to the + * default of nothing. + */ + GHashTable *imvironments; + int current_status; gboolean logged_in; GString *tmp_serv_blist, *tmp_serv_ilist, *tmp_serv_plist; Modified: trunk/src/protocols/yahoo/yahoo_filexfer.c =================================================================== --- trunk/src/protocols/yahoo/yahoo_filexfer.c 2006-06-22 06:00:25 UTC (rev 16305) +++ trunk/src/protocols/yahoo/yahoo_filexfer.c 2006-06-22 06:26:38 UTC (rev 16306) @@ -481,14 +481,18 @@ char *to = NULL; char *msg = NULL; char *url = NULL; + char *imv = NULL; long expires = 0; GaimXfer *xfer; + struct yahoo_data *yd; struct yahoo_xfer_data *xfer_data; char *service = NULL; char *filename = NULL; unsigned long filesize = 0L; GSList *l; + yd = gc->proto_data; + for (l = pkt->hash; l; l = l->next) { struct yahoo_pair *pair = l->data; @@ -508,8 +512,19 @@ filesize = atol(pair->value); if (pair->key == 49) service = pair->value; + if (pair->key == 63) + imv = pair->value; } + /* + * The remote user has changed their IMVironment. We + * record it for later use. + */ + if (from && imv && service && (strcmp("IMVIRONMENT", service) == 0)) { + g_hash_table_replace(yd->imvironments, g_strdup(from), g_strdup(imv)); + return; + } + if (pkt->service == YAHOO_SERVICE_P2PFILEXFER) { if (service && (strcmp("FILEXFER", service) != 0)) { gaim_debug_misc("yahoo", "unhandled service 0x%02x\n", pkt->service); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |