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