comparison libpurple/protocols/yahoo/yahoo_friend.c @ 28364:61856d0a2714

Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts. Fixes #9814, #9983 committer: John Bailey <rekkanoryo@rekkanoryo.org>
author kryojenik23-pidgin@steltek.com
date Mon, 12 Oct 2009 05:01:17 +0000
parents 908be3822215
children d1cecbc467c6
comparison
equal deleted inserted replaced
28359:53aab96e61a9 28364:61856d0a2714
149 GSList *l = pkt->hash; 149 GSList *l = pkt->hash;
150 YahooFriend *f; 150 YahooFriend *f;
151 char *temp = NULL; 151 char *temp = NULL;
152 char *who = NULL; 152 char *who = NULL;
153 int value = 0; 153 int value = 0;
154 int protocol = 0; 154 YahooFederation fed = YAHOO_FEDERATION_NONE;
155 gboolean msn = FALSE; 155
156
157 while (l) { 156 while (l) {
158 struct yahoo_pair *pair = l->data; 157 struct yahoo_pair *pair = l->data;
159 158
160 switch (pair->key) { 159 switch (pair->key) {
161 case 7: 160 case 7:
163 break; 162 break;
164 case 31: 163 case 31:
165 value = strtol(pair->value, NULL, 10); 164 value = strtol(pair->value, NULL, 10);
166 break; 165 break;
167 case 241: 166 case 241:
168 protocol = strtol(pair->value, NULL, 10); 167 fed = strtol(pair->value, NULL, 10);
169 msn = TRUE;
170 break; 168 break;
171 } 169 }
172 170
173 l = l->next; 171 l = l->next;
174 } 172 }
175 173
176 if (value != 1 && value != 2) { 174 if (value != 1 && value != 2) {
177 purple_debug_error("yahoo", "Received unknown value for presence key: %d\n", value); 175 purple_debug_error("yahoo", "Received unknown value for presence key: %d\n", value);
178 return; 176 return;
179 } 177 }
180 178
181 if(msn) 179 switch (fed) {
182 who = g_strconcat("msn/", temp, NULL); 180 case YAHOO_FEDERATION_MSN:
183 else 181 who = g_strconcat("msn/", temp, NULL);
184 who = g_strdup(temp); 182 break;
185 183 case YAHOO_FEDERATION_OCS:
184 who = g_strconcat("ocs/", temp, NULL);
185 break;
186 case YAHOO_FEDERATION_IBM:
187 who = g_strconcat("ibm/", temp, NULL);
188 break;
189 case YAHOO_FEDERATION_NONE:
190 who = g_strdup(temp);
191 break;
192 }
186 g_return_if_fail(who != NULL); 193 g_return_if_fail(who != NULL);
187 194
188 f = yahoo_friend_find(gc, who); 195 f = yahoo_friend_find(gc, who);
189 if (!f) { 196 if (!f) {
190 g_free(who); 197 g_free(who);
226 return; 233 return;
227 234
228 f = yahoo_friend_find(gc, name); 235 f = yahoo_friend_find(gc, name);
229 if (!f) 236 if (!f)
230 return; 237 return;
231 238
232 if(f->protocol == 2) 239 if(f->fed != YAHOO_FEDERATION_NONE)
233 temp = name+4; 240 temp = name+4;
234 else 241 else
235 temp = name; 242 temp = name;
236 243
237 /* No need to change the value if it is already correct */ 244 /* No need to change the value if it is already correct */
238 if (f->presence == presence) { 245 if (f->presence == presence) {
239 purple_debug_info("yahoo", "Not setting presence because there are no changes.\n"); 246 purple_debug_info("yahoo", "Not setting presence because there are no changes.\n");
240 return; 247 return;
241 } 248 }
256 } 263 }
257 } else if (presence == YAHOO_PRESENCE_ONLINE) { 264 } else if (presence == YAHOO_PRESENCE_ONLINE) {
258 if (f->presence == YAHOO_PRESENCE_PERM_OFFLINE) { 265 if (f->presence == YAHOO_PRESENCE_PERM_OFFLINE) {
259 pkt = yahoo_packet_new(YAHOO_SERVICE_PRESENCE_PERM, 266 pkt = yahoo_packet_new(YAHOO_SERVICE_PRESENCE_PERM,
260 YAHOO_STATUS_AVAILABLE, yd->session_id); 267 YAHOO_STATUS_AVAILABLE, yd->session_id);
261 if(f->protocol) 268 if(f->fed)
262 yahoo_packet_hash(pkt, "ssssssiss", 269 yahoo_packet_hash(pkt, "ssssssiss",
263 1, purple_connection_get_display_name(gc), 270 1, purple_connection_get_display_name(gc),
264 31, "2", 13, "2", 271 31, "2", 13, "2",
265 302, "319", 300, "319", 272 302, "319", 300, "319",
266 7, temp, 241, f->protocol, 273 7, temp, 241, f->fed,
267 301, "319", 303, "319"); 274 301, "319", 303, "319");
268 else 275 else
269 yahoo_packet_hash(pkt, "ssssssss", 276 yahoo_packet_hash(pkt, "ssssssss",
270 1, purple_connection_get_display_name(gc), 277 1, purple_connection_get_display_name(gc),
271 31, "2", 13, "2", 278 31, "2", 13, "2",
283 290
284 if (service > 0) { 291 if (service > 0) {
285 pkt = yahoo_packet_new(service, 292 pkt = yahoo_packet_new(service,
286 YAHOO_STATUS_AVAILABLE, yd->session_id); 293 YAHOO_STATUS_AVAILABLE, yd->session_id);
287 294
288 if(f->protocol) 295 if(f->fed)
289 yahoo_packet_hash(pkt, "ssssssiss", 296 yahoo_packet_hash(pkt, "ssssssiss",
290 1, purple_connection_get_display_name(gc), 297 1, purple_connection_get_display_name(gc),
291 31, thirtyone, 13, thirteen, 298 31, thirtyone, 13, thirteen,
292 302, "319", 300, "319", 299 302, "319", 300, "319",
293 7, temp, 241, f->protocol, 300 7, temp, 241, f->fed,
294 301, "319", 303, "319"); 301 301, "319", 303, "319");
295 else 302 else
296 yahoo_packet_hash(pkt, "ssssssss", 303 yahoo_packet_hash(pkt, "ssssssss",
297 1, purple_connection_get_display_name(gc), 304 1, purple_connection_get_display_name(gc),
298 31, thirtyone, 13, thirteen, 305 31, thirtyone, 13, thirteen,