Changeset c1a3c27 for protocols/jabber
- Timestamp:
- 2010-03-17T23:41:07Z (15 years ago)
- Branches:
- master
- Children:
- 42fc5b6
- Parents:
- 60e4df3
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/jabber/iq.c
r60e4df3 rc1a3c27 658 658 struct xt_node *c; 659 659 struct jabber_buddy *bud; 660 char *feature ;660 char *feature, *xmlns, *from; 661 661 662 662 if( !( c = xt_find_node( node->children, "query" ) ) || 663 !( strcmp( xt_find_attr( c, "xmlns" ), XMLNS_DISCO_INFO ) == 0 ) ) 663 !( from = xt_find_attr( c, "from" ) ) || 664 !( xmlns = xt_find_attr( c, "xmlns" ) ) || 665 !( strcmp( xmlns, XMLNS_DISCO_INFO ) == 0 ) ) 664 666 { 665 667 imcb_log( ic, "WARNING: Received incomplete IQ-result packet for discover" ); 666 668 return XT_HANDLED; 667 669 } 668 if( ( bud = jabber_buddy_by_jid( ic, xt_find_attr( node, "from"), 0 ) ) == NULL )670 if( ( bud = jabber_buddy_by_jid( ic, from, 0 ) ) == NULL ) 669 671 { 670 672 /* Who cares about the unknown... */ 671 imcb_log( ic, "Couldn't find buddy: %s", xt_find_attr( node, "from"));673 imcb_log( ic, "Couldn't find buddy: %s", from ); 672 674 return 0; 673 675 } … … 677 679 { 678 680 feature = xt_find_attr( c, "var" ); 679 bud->features = g_slist_append( bud->features, g_strdup( feature ) ); 681 if( feature ) 682 bud->features = g_slist_append( bud->features, g_strdup( feature ) ); 680 683 c = c->next; 681 684 } … … 713 716 struct xt_node *c; 714 717 struct jabber_data *jd = ic->proto_data; 718 char *xmlns, *from; 715 719 716 720 if( !( c = xt_find_node( node->children, "query" ) ) || 717 !xt_find_attr( node, "from" ) ) 721 !( from = xt_find_attr( node, "from" ) ) || 722 !( xmlns = xt_find_attr( c, "xmlns" ) ) ) 718 723 { 719 724 imcb_log( ic, "WARNING: Received incomplete IQ-result packet for discover" ); … … 723 728 jd->have_streamhosts++; 724 729 725 if( strcmp( x t_find_attr( c, "xmlns" ), XMLNS_DISCO_ITEMS ) == 0 )726 { 727 char *item , *itemjid;730 if( strcmp( xmlns, XMLNS_DISCO_ITEMS ) == 0 ) 731 { 732 char *itemjid; 728 733 729 734 /* answer from server */ … … 732 737 while( ( c = xt_find_node( c, "item" ) ) ) 733 738 { 734 item = xt_find_attr( c, "name" );735 739 itemjid = xt_find_attr( c, "jid" ); 736 737 jabber_iq_query_server( ic, itemjid, XMLNS_DISCO_INFO ); 740 741 if( itemjid ) 742 jabber_iq_query_server( ic, itemjid, XMLNS_DISCO_INFO ); 738 743 739 744 c = c->next; 740 745 } 741 746 } 742 else if( strcmp( xt_find_attr( c, "xmlns" ), XMLNS_DISCO_INFO ) == 0 )747 else if( xmlns, XMLNS_DISCO_INFO ) == 0 ) 743 748 { 744 749 char *category, *type; … … 754 759 if( type && ( strcmp( type, "bytestreams" ) == 0 ) && 755 760 category && ( strcmp( category, "proxy" ) == 0 ) ) 756 jabber_iq_query_server( ic, xt_find_attr( node, "from" ), XMLNS_BYTESTREAMS );761 jabber_iq_query_server( ic, from, XMLNS_BYTESTREAMS ); 757 762 758 763 c = c->next; 759 764 } 760 765 } 761 else if( strcmp( xt_find_attr( c, "xmlns" ), XMLNS_BYTESTREAMS ) == 0 )762 { 763 char *host, *jid ;766 else if( xmlns, XMLNS_BYTESTREAMS ) == 0 ) 767 { 768 char *host, *jid, *port_s; 764 769 int port; 765 770 … … 768 773 if( ( c = xt_find_node( c->children, "streamhost" ) ) && 769 774 ( host = xt_find_attr( c, "host" ) ) && 770 ( port = atoi( xt_find_attr( c, "port" ) ) ) && 775 ( port_s = xt_find_attr( c, "port" ) ) && 776 ( sscanf( port_s, "%d", &port ) == 1 ) && 771 777 ( jid = xt_find_attr( c, "jid" ) ) ) 772 778 { 773 779 jabber_streamhost_t *sh = g_new0( jabber_streamhost_t, 1 ); 780 774 781 sh->jid = g_strdup( jid ); 775 782 sh->host = g_strdup( host ); 776 sprintf( sh->port, "%u", port );783 g_snprintf( sh->port, sizeof( sh->port ), "%u", port ); 777 784 778 785 imcb_log( ic, "Proxy found: jid %s host %s port %u", jid, host, port );
Note: See TracChangeset
for help on using the changeset viewer.