Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/jabber/jabber_util.c

    r7b40f17 r72721cd  
    726726        char *s = NULL;
    727727        struct tm tp;
    728         gboolean is_old = TRUE;
    729         const char *format;
    730 
    731         /* XEP-0091 has <x> */
    732         c = xt_find_node_by_attr( xt->children, "x", "xmlns", XMLNS_DELAY_OLD );
    733 
    734         if( !c || !( s = xt_find_attr( c, "stamp" ) ) ) {
    735                 is_old = FALSE;
    736 
    737                 /* XEP-0203 has <delay> */
    738                 c = xt_find_node_by_attr( xt->children, "delay", "xmlns", XMLNS_DELAY );
    739                 if( !c || !( s = xt_find_attr( c, "stamp" ) ) ) {
    740                         return 0;
    741                 }
    742         }
     728       
     729        for( c = xt->children; ( c = xt_find_node( c, "x" ) ); c = c->next )
     730        {
     731                if( ( s = xt_find_attr( c, "xmlns" ) ) && strcmp( s, XMLNS_DELAY ) == 0 )
     732                        break;
     733        }
     734       
     735        if( !c || !( s = xt_find_attr( c, "stamp" ) ) )
     736                return 0;
    743737       
    744738        memset( &tp, 0, sizeof( tp ) );
    745 
    746         /* The other main difference between XEPs is the timestamp format */
    747         format = (is_old) ? "%4d%2d%2dT%2d:%2d:%2d" : "%4d-%2d-%2dT%2d:%2d:%2dZ";
    748 
    749         if( sscanf( s, format, &tp.tm_year, &tp.tm_mon, &tp.tm_mday,
    750                                &tp.tm_hour, &tp.tm_min, &tp.tm_sec ) != 6 )
     739        if( sscanf( s, "%4d%2d%2dT%2d:%2d:%2d", &tp.tm_year, &tp.tm_mon, &tp.tm_mday,
     740                                                &tp.tm_hour, &tp.tm_min, &tp.tm_sec ) != 6 )
    751741                return 0;
    752742       
Note: See TracChangeset for help on using the changeset viewer.