Ignore:
Timestamp:
2006-09-24T10:25:41Z (18 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
42127dc
Parents:
5e202b0
Message:

Updated <presence> stuff to handle changing the priority setting.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/jabber/jabber_util.c

    r5e202b0 r172a73f1  
    2929{
    3030        account_t *acc = set->data;
     31        char *ret;
    3132       
    32         /* Only run this stuff if the account is online ATM. */
    33         if( acc->gc )
     33        if( strcmp( set->key, "priority" ) == 0 )
     34                ret = set_eval_int( set, value );
     35        else
     36                ret = value;
     37       
     38        /* Only run this stuff if the account is online ATM,
     39           and if the setting seems to be acceptable. */
     40        if( acc->gc && ret )
    3441        {
    35                 /* ... */
     42                if( strcmp( set->key, "priority" ) == 0 )
     43                {
     44                        /* Although set_eval functions usually are very nice
     45                           and convenient, they have one disadvantage: If I
     46                           would just call p_s_u() now to send the new prio
     47                           setting, it would send the old setting because the
     48                           set->value gets changed when the eval returns a
     49                           non-NULL value.
     50                           
     51                           So now I can choose between implementing post-set
     52                           functions next to evals, or just do this little
     53                           hack: */
     54                        g_free( set->value );
     55                        set->value = g_strdup( ret );
     56                       
     57                        /* (Yes, sorry, I prefer the hack. :-P) */
     58                       
     59                        presence_send_update( acc->gc );
     60                }
     61                else
     62                {
     63                }
    3664        }
    3765       
    38         if( g_strcasecmp( set->key, "priority" ) == 0 )
    39                 return set_eval_int( set, value );
    40         else
    41                 return value;
     66        return ret;
    4267}
    4368
Note: See TracChangeset for help on using the changeset viewer.