Mercurial > pidgin.yaz
comparison libpurple/protocols/yahoo/libymsg.c @ 28797:335062a2d305
Implement IMvironment check per IM, not global
author | Sulabh Mahajan <sulabh@soc.pidgin.im> |
---|---|
date | Sat, 24 Oct 2009 07:55:19 +0000 |
parents | c46819108809 |
children | d7c49598cef2 380c77dad7b4 |
comparison
equal
deleted
inserted
replaced
28796:c46819108809 | 28797:335062a2d305 |
---|---|
949 PurpleAccount *account; | 949 PurpleAccount *account; |
950 YahooData *yd = gc->proto_data; | 950 YahooData *yd = gc->proto_data; |
951 GSList *l = pkt->hash; | 951 GSList *l = pkt->hash; |
952 GSList *list = NULL; | 952 GSList *list = NULL; |
953 struct _yahoo_im *im = NULL; | 953 struct _yahoo_im *im = NULL; |
954 const char *imv = NULL; | |
955 | 954 |
956 account = purple_connection_get_account(gc); | 955 account = purple_connection_get_account(gc); |
957 | 956 |
958 if (pkt->status <= 1 || pkt->status == 5 || pkt->status == YAHOO_STATUS_OFFLINE) { | 957 if (pkt->status <= 1 || pkt->status == 5 || pkt->status == YAHOO_STATUS_OFFLINE) { |
959 /* messages are received with status YAHOO_STATUS_OFFLINE in case of p2p */ | 958 /* messages are received with status YAHOO_STATUS_OFFLINE in case of p2p */ |
1017 g_free(im); | 1016 g_free(im); |
1018 return; /* Not sure whether we should process remaining IMs in this packet */ | 1017 return; /* Not sure whether we should process remaining IMs in this packet */ |
1019 } | 1018 } |
1020 } | 1019 } |
1021 /* IMV key */ | 1020 /* IMV key */ |
1022 if (pair->key == 63) | 1021 if (im && pair->key == 63) |
1023 { | 1022 { |
1024 imv = pair->value; | 1023 /* Check for the Doodle IMV, no IMvironment for federated buddies */ |
1024 if (im->from != NULL && im->fed == YAHOO_FEDERATION_NONE) | |
1025 { | |
1026 g_hash_table_replace(yd->imvironments, g_strdup(im->from), g_strdup(pair->value)); | |
1027 | |
1028 if (strstr(pair->value, "doodle;") != NULL) | |
1029 { | |
1030 PurpleWhiteboard *wb; | |
1031 | |
1032 if (!purple_privacy_check(account, im->from)) { | |
1033 purple_debug_info("yahoo", "Doodle request from %s dropped.\n", | |
1034 im->from); | |
1035 g_free(im->fed_from); | |
1036 g_free(im); | |
1037 return; | |
1038 } | |
1039 /* I'm not sure the following ever happens -DAA */ | |
1040 wb = purple_whiteboard_get_session(account, im->from); | |
1041 | |
1042 /* If a Doodle session doesn't exist between this user */ | |
1043 if(wb == NULL) | |
1044 { | |
1045 doodle_session *ds; | |
1046 wb = purple_whiteboard_create(account, im->from, | |
1047 DOODLE_STATE_REQUESTED); | |
1048 ds = wb->proto_data; | |
1049 ds->imv_key = g_strdup(pair->value); | |
1050 | |
1051 yahoo_doodle_command_send_request(gc, im->from, pair->value); | |
1052 yahoo_doodle_command_send_ready(gc, im->from, pair->value); | |
1053 } | |
1054 } | |
1055 } | |
1025 } | 1056 } |
1026 if (pair->key == 429) | 1057 if (pair->key == 429) |
1027 if (im) | 1058 if (im) |
1028 im->id = pair->value; | 1059 im->id = pair->value; |
1029 l = l->next; | 1060 l = l->next; |
1030 } | 1061 } |
1031 } else if (pkt->status == 2) { | 1062 } else if (pkt->status == 2) { |
1032 purple_notify_error(gc, NULL, | 1063 purple_notify_error(gc, NULL, |
1033 _("Your Yahoo! message did not get sent."), NULL); | 1064 _("Your Yahoo! message did not get sent."), NULL); |
1034 } | |
1035 | |
1036 /* TODO: It seems that this check should be per IM, not global */ | |
1037 /* Check for the Doodle IMV */ | |
1038 /* no doodle with federated buddies */ | |
1039 if (im != NULL && imv!= NULL && im->from != NULL) | |
1040 { | |
1041 g_hash_table_replace(yd->imvironments, g_strdup(im->from), g_strdup(imv)); | |
1042 | |
1043 if (strstr(imv, "doodle;") != NULL) | |
1044 { | |
1045 PurpleWhiteboard *wb; | |
1046 | |
1047 if (!purple_privacy_check(account, im->from)) { | |
1048 purple_debug_info("yahoo", "Doodle request from %s dropped.\n", im->from); | |
1049 return; | |
1050 } | |
1051 | |
1052 /* I'm not sure the following ever happens -DAA */ | |
1053 | |
1054 wb = purple_whiteboard_get_session(account, im->from); | |
1055 | |
1056 /* If a Doodle session doesn't exist between this user */ | |
1057 if(wb == NULL) | |
1058 { | |
1059 doodle_session *ds; | |
1060 wb = purple_whiteboard_create(account, im->from, DOODLE_STATE_REQUESTED); | |
1061 ds = wb->proto_data; | |
1062 ds->imv_key = g_strdup(imv); | |
1063 | |
1064 yahoo_doodle_command_send_request(gc, im->from, imv); | |
1065 yahoo_doodle_command_send_ready(gc, im->from, imv); | |
1066 } | |
1067 } | |
1068 } | 1065 } |
1069 | 1066 |
1070 for (l = list; l; l = l->next) { | 1067 for (l = list; l; l = l->next) { |
1071 YahooFriend *f; | 1068 YahooFriend *f; |
1072 char *m, *m2; | 1069 char *m, *m2; |