| 346 (vcard = xmlnode_get_child_with_namespace(packet, "query", "vcard-temp"))) { |
347 (vcard = xmlnode_get_child_with_namespace(packet, "query", "vcard-temp"))) { |
| 347 if((photo = xmlnode_get_child(vcard, "PHOTO")) && |
348 if((photo = xmlnode_get_child(vcard, "PHOTO")) && |
| 348 (( (binval = xmlnode_get_child(photo, "BINVAL")) && |
349 (( (binval = xmlnode_get_child(photo, "BINVAL")) && |
| 349 (text = xmlnode_get_data(binval))) || |
350 (text = xmlnode_get_data(binval))) || |
| 350 (text = xmlnode_get_data(photo)))) { |
351 (text = xmlnode_get_data(photo)))) { |
| 351 char *hash; |
352 unsigned char hashval[20]; |
| |
353 char hash[41], *p; |
| |
354 int i; |
| 352 |
355 |
| 353 data = purple_base64_decode(text, &size); |
356 data = purple_base64_decode(text, &size); |
| 354 hash = jabber_calculate_data_sha1sum(data, size); |
357 |
| |
358 purple_cipher_digest_region("sha1", data, size, |
| |
359 sizeof(hashval), hashval, NULL); |
| |
360 p = hash; |
| |
361 for(i=0; i<20; i++, p+=2) |
| |
362 snprintf(p, 3, "%02x", hashval[i]); |
| |
363 |
| 355 purple_buddy_icons_set_for_user(js->gc->account, from, data, size, hash); |
364 purple_buddy_icons_set_for_user(js->gc->account, from, data, size, hash); |
| 356 g_free(hash); |
|
| 357 g_free(text); |
365 g_free(text); |
| 358 } |
366 } |
| 359 } |
367 } |
| 360 } |
368 } |
| 361 |
369 |
| 500 char *p = xmlnode_get_data(y); |
508 char *p = xmlnode_get_data(y); |
| 501 if(p) { |
509 if(p) { |
| 502 priority = atoi(p); |
510 priority = atoi(p); |
| 503 g_free(p); |
511 g_free(p); |
| 504 } |
512 } |
| 505 } else if(xmlns == NULL) { |
|
| 506 /* The rest of the cases used to check xmlns individually. */ |
|
| 507 continue; |
|
| 508 } else if(!strcmp(y->name, "delay") && !strcmp(xmlns, "urn:xmpp:delay")) { |
513 } else if(!strcmp(y->name, "delay") && !strcmp(xmlns, "urn:xmpp:delay")) { |
| 509 /* XXX: compare the time. jabber:x:delay can happen on presence packets that aren't really and truly delayed */ |
514 /* XXX: compare the time. jabber:x:delay can happen on presence packets that aren't really and truly delayed */ |
| 510 delayed = TRUE; |
515 delayed = TRUE; |
| 511 } else if(!strcmp(y->name, "c") && !strcmp(xmlns, "http://jabber.org/protocol/caps")) { |
516 } else if(xmlns && !strcmp(y->name, "c") && !strcmp(xmlns, "http://jabber.org/protocol/caps")) { |
| 512 caps = y; /* store for later, when creating buddy resource */ |
517 caps = y; /* store for later, when creating buddy resource */ |
| 513 } else if(!strcmp(y->name, "x")) { |
518 } else if(!strcmp(y->name, "x")) { |
| 514 if(!strcmp(xmlns, "jabber:x:delay")) { |
519 const char *xmlns = xmlnode_get_namespace(y); |
| |
520 if(xmlns && !strcmp(xmlns, "jabber:x:delay")) { |
| 515 /* XXX: compare the time. jabber:x:delay can happen on presence packets that aren't really and truly delayed */ |
521 /* XXX: compare the time. jabber:x:delay can happen on presence packets that aren't really and truly delayed */ |
| 516 delayed = TRUE; |
522 delayed = TRUE; |
| 517 } else if(!strcmp(xmlns, "http://jabber.org/protocol/muc#user")) { |
523 } else if(xmlns && !strcmp(xmlns, "http://jabber.org/protocol/muc#user")) { |
| 518 xmlnode *z; |
524 xmlnode *z; |
| 519 |
525 |
| 520 muc = TRUE; |
526 muc = TRUE; |
| 521 if((z = xmlnode_get_child(y, "status"))) { |
527 if((z = xmlnode_get_child(y, "status"))) { |
| 522 const char *code = xmlnode_get_attrib(z, "code"); |
528 const char *code = xmlnode_get_attrib(z, "code"); |
| 555 flags |= PURPLE_CBFLAGS_OP; |
561 flags |= PURPLE_CBFLAGS_OP; |
| 556 else if (!strcmp(role, "participant")) |
562 else if (!strcmp(role, "participant")) |
| 557 flags |= PURPLE_CBFLAGS_VOICE; |
563 flags |= PURPLE_CBFLAGS_VOICE; |
| 558 } |
564 } |
| 559 } |
565 } |
| 560 } else if(!strcmp(xmlns, "vcard-temp:x:update")) { |
566 } else if(xmlns && !strcmp(xmlns, "vcard-temp:x:update")) { |
| 561 xmlnode *photo = xmlnode_get_child(y, "photo"); |
567 xmlnode *photo = xmlnode_get_child(y, "photo"); |
| 562 if(photo) { |
568 if(photo) { |
| 563 g_free(avatar_hash); |
569 g_free(avatar_hash); |
| 564 avatar_hash = xmlnode_get_data(photo); |
570 avatar_hash = xmlnode_get_data(photo); |
| 565 } |
571 } |