Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/jabber/jabber_util.c

    r17a6ee9 r2e3a857  
    9999}
    100100
    101 struct xt_node *jabber_make_error_packet( struct xt_node *orig, char *err_cond, char *err_type, char *err_code )
     101struct xt_node *jabber_make_error_packet( struct xt_node *orig, char *err_cond, char *err_type )
    102102{
    103103        struct xt_node *node, *c;
     
    111111        c = xt_new_node( "error", NULL, c );
    112112        xt_add_attr( c, "type", err_type );
    113        
    114         /* Add the error code, if present */
    115         if (err_code)
    116                 xt_add_attr( c, "code", err_code );
    117113       
    118114        /* To make the actual error packet, we copy the original packet and
     
    279275        presence_send_request( bla->ic, bla->handle, "subscribed" );
    280276       
    281         imcb_ask_add( bla->ic, bla->handle, NULL );
     277        if( imcb_find_buddy( bla->ic, bla->handle ) == NULL )
     278                imcb_ask_add( bla->ic, bla->handle, NULL );
    282279       
    283280        g_free( bla->handle );
     
    461458               
    462459                if( bud == NULL && ( flags & GET_BUDDY_CREAT ) &&
    463                     ( bare_exists || bee_user_by_handle( ic->bee, ic, jid ) ) )
     460                    ( bare_exists || imcb_find_buddy( ic, jid ) ) )
    464461                {
    465462                        *s = '/';
     
    482479                if( bud == NULL )
    483480                        /* No match. Create it now? */
    484                         return ( ( flags & GET_BUDDY_CREAT ) &&
    485                                  bee_user_by_handle( ic->bee, ic, jid_ ) ) ?
     481                        return ( ( flags & GET_BUDDY_CREAT ) && imcb_find_buddy( ic, jid_ ) ) ?
    486482                                   jabber_buddy_add( ic, jid_ ) : NULL;
    487483                else if( bud->resource && ( flags & GET_BUDDY_EXACT ) )
     
    671667time_t jabber_get_timestamp( struct xt_node *xt )
    672668{
    673         struct tm tp, utc;
    674669        struct xt_node *c;
    675         time_t res, tres;
    676670        char *s = NULL;
     671        struct tm tp;
    677672       
    678673        for( c = xt->children; ( c = xt_find_node( c, "x" ) ); c = c->next )
     
    692687        tp.tm_year -= 1900;
    693688        tp.tm_mon --;
    694         tp.tm_isdst = -1; /* GRRRRRRRRRRR */
    695        
    696         res = mktime( &tp );
    697         /* Problem is, mktime() just gave us the GMT timestamp for the
    698            given local time... While the given time WAS NOT local. So
    699            we should fix this now.
    700        
    701            Now I could choose between messing with environment variables
    702            (kludgy) or using timegm() (not portable)... Or doing the
    703            following, which I actually prefer... */
    704         gmtime_r( &res, &utc );
    705         utc.tm_isdst = -1; /* Once more: GRRRRRRRRRRRRRRRRRR!!! */
    706         if( utc.tm_hour == tp.tm_hour && utc.tm_min == tp.tm_min )
    707                 /* Sweet! We're in UTC right now... */
    708                 return res;
    709        
    710         tres = mktime( &utc );
    711         res += res - tres;
    712        
    713         /* Yes, this is a hack. And it will go wrong around DST changes.
    714            BUT this is more likely to be threadsafe than messing with
    715            environment variables, and possibly more portable... */
    716        
    717         return res;
     689       
     690        return mktime_utc( &tp );
    718691}
    719692
Note: See TracChangeset for help on using the changeset viewer.