Changes in protocols/msn/msn.c [e3413cc:a830512]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/msn/msn.c
re3413cc ra830512 27 27 #include "msn.h" 28 28 29 int msn_chat_id; 30 GSList *msn_connections; 31 GSList *msn_switchboards; 32 33 static char *set_eval_display_name( set_t *set, char *value ); 29 static char *msn_set_display_name( set_t *set, char *value ); 34 30 35 31 static void msn_init( account_t *acc ) 36 32 { 37 set_add( &acc->set, "display_name", NULL, set_eval_display_name, acc ); 38 set_add( &acc->set, "local_display_name", "false", set_eval_bool, acc ); 39 set_add( &acc->set, "mail_notifications", "false", set_eval_bool, acc ); 33 set_t *s; 34 35 s = set_add( &acc->set, "display_name", NULL, msn_set_display_name, acc ); 36 s->flags |= ACC_SET_NOSAVE | ACC_SET_ONLINE_ONLY; 37 38 s = set_add( &acc->set, "mail_notifications", "false", set_eval_bool, acc ); 40 39 } 41 40 … … 140 139 141 140 if( l == NULL ) 142 for( i = 0; *msn_away_state_list[i].code; i ++ ) 143 if( *msn_away_state_list[i].name ) 144 l = g_list_append( l, (void*) msn_away_state_list[i].name ); 141 for( i = 0; msn_away_state_list[i].number > -1; i ++ ) 142 l = g_list_append( l, (void*) msn_away_state_list[i].name ); 145 143 146 144 return l; … … 151 149 char buf[1024]; 152 150 struct msn_data *md = ic->proto_data; 153 154 if( state )155 md->away_state = msn_away_state_by_name( state ) ? :156 msn_away_state_list + 1;151 const struct msn_away_state *st; 152 153 if( strcmp( state, GAIM_AWAY_CUSTOM ) == 0 ) 154 st = msn_away_state_by_name( "Away" ); 157 155 else 158 md->away_state = msn_away_state_list; 159 160 g_snprintf( buf, sizeof( buf ), "CHG %d %s\r\n", ++md->trId, md->away_state->code ); 156 st = msn_away_state_by_name( state ); 157 158 if( !st ) st = msn_away_state_list; 159 md->away_state = st; 160 161 g_snprintf( buf, sizeof( buf ), "CHG %d %s\r\n", ++md->trId, st->code ); 161 162 msn_write( ic, buf, strlen( buf ) ); 162 163 } … … 164 165 static void msn_set_my_name( struct im_connection *ic, char *info ) 165 166 { 166 msn_set_display_name( ic, info );167 msn_set_display_name( set_find( &ic->acc->set, "display_name" ), info ); 167 168 } 168 169 … … 280 281 } 281 282 282 static char * set_eval_display_name( set_t *set, char *value )283 static char *msn_set_display_name( set_t *set, char *value ) 283 284 { 284 285 account_t *acc = set->data; 285 286 struct im_connection *ic = acc->ic; 286 287 /* Allow any name if we're offline. */ 287 struct msn_data *md; 288 char buf[1024], *fn; 289 290 /* Double-check. */ 288 291 if( ic == NULL ) 289 return value; 292 return NULL; 293 294 md = ic->proto_data; 290 295 291 296 if( strlen( value ) > 129 ) … … 294 299 return NULL; 295 300 } 301 302 fn = msn_http_encode( value ); 303 304 g_snprintf( buf, sizeof( buf ), "REA %d %s %s\r\n", ++md->trId, ic->acc->user, fn ); 305 msn_write( ic, buf, strlen( buf ) ); 306 g_free( fn ); 296 307 297 308 /* Returning NULL would be better, because the server still has to 298 309 confirm the name change. However, it looks a bit confusing to the 299 310 user. */ 300 return msn_set_display_name( ic, value ) ? value : NULL;311 return value; 301 312 } 302 313
Note: See TracChangeset
for help on using the changeset viewer.