Changeset be609ff for protocols/jabber
- Timestamp:
- 2010-03-12T19:10:16Z (15 years ago)
- Branches:
- master
- Children:
- dde9d571
- Parents:
- 08e5bb2 (diff), 8b6b740 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- protocols/jabber
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/jabber/jabber.c
r08e5bb2 rbe609ff 82 82 s = set_add( &acc->set, "xmlconsole", "false", set_eval_bool, acc ); 83 83 s->flags |= ACC_SET_OFFLINE_ONLY; 84 85 acc->flags |= ACC_FLAG_AWAY_MESSAGE | ACC_FLAG_STATUS_MESSAGE; 84 86 } 85 87 … … 358 360 while( bud ) 359 361 { 360 imcb_log( ic, "Buddy %s (%d) information:\nAway state: %s\nAway message: %s", 361 bud->full_jid, bud->priority, 362 bud->away_state ? bud->away_state->full_name : "(none)", 363 bud->away_message ? : "(none)" ); 362 imcb_log( ic, "Buddy %s (%d) information:", bud->full_jid, bud->priority ); 363 if( bud->away_state ) 364 imcb_log( ic, "Away state: %s", bud->away_state->full_name ); 365 imcb_log( ic, "Status message: %s", bud->away_message ? : "(none)" ); 366 364 367 bud = bud->next; 365 368 } … … 371 374 { 372 375 struct jabber_data *jd = ic->proto_data; 373 struct jabber_away_state *state; 374 375 /* Save all this info. We need it, for example, when changing the priority setting. */ 376 state = (void *) jabber_away_state_by_name( state_txt ); 377 jd->away_state = state ? state : (void *) jabber_away_state_list; /* Fall back to "Away" if necessary. */ 376 377 /* state_txt == NULL -> Not away. 378 Unknown state -> fall back to the first defined away state. */ 379 jd->away_state = state_txt ? jabber_away_state_by_name( state_txt ) 380 ? : jabber_away_state_list : NULL; 381 378 382 g_free( jd->away_message ); 379 383 jd->away_message = ( message && *message ) ? g_strdup( message ) : NULL; -
protocols/jabber/jabber.h
r08e5bb2 rbe609ff 84 84 /* After changing one of these two (or the priority setting), call 85 85 presence_send_update() to inform the server about the changes. */ 86 struct jabber_away_state *away_state;86 const struct jabber_away_state *away_state; 87 87 char *away_message; 88 88 -
protocols/jabber/jabber_util.c
r08e5bb2 rbe609ff 228 228 { 229 229 { "away", "Away" }, 230 { "chat", "Free for Chat" }, 230 { "chat", "Free for Chat" }, /* WTF actually uses this? */ 231 231 { "dnd", "Do not Disturb" }, 232 232 { "xa", "Extended Away" }, 233 { "", "Online" },234 233 { "", NULL } 235 234 }; … … 238 237 { 239 238 int i; 239 240 if( code == NULL ) 241 return NULL; 240 242 241 243 for( i = 0; jabber_away_state_list[i].full_name; i ++ ) … … 249 251 { 250 252 int i; 253 254 if( name == NULL ) 255 return NULL; 251 256 252 257 for( i = 0; jabber_away_state_list[i].full_name; i ++ ) -
protocols/jabber/presence.c
r08e5bb2 rbe609ff 187 187 int is_away = 0; 188 188 189 if( send_presence->away_state && !( *send_presence->away_state->code == 0 ||190 strcmp( send_presence->away_state->code, "chat" ) == 0 ))189 if( send_presence->away_state && 190 strcmp( send_presence->away_state->code, "chat" ) != 0 ) 191 191 is_away = OPT_AWAY; 192 192 193 193 imcb_buddy_status( ic, send_presence->bare_jid, OPT_LOGGED_IN | is_away, 194 ( is_away && send_presence->away_state ) ? 195 send_presence->away_state->full_name : NULL, 194 is_away ? send_presence->away_state->full_name : NULL, 196 195 send_presence->away_message ); 197 196 } … … 206 205 struct jabber_data *jd = ic->proto_data; 207 206 struct xt_node *node, *cap; 208 char *show = jd->away_state->code;209 char *status = jd->away_message;210 207 struct groupchat *c; 211 208 int st; … … 213 210 node = jabber_make_packet( "presence", NULL, NULL, NULL ); 214 211 xt_add_child( node, xt_new_node( "priority", set_getstr( &ic->acc->set, "priority" ), NULL ) ); 215 if( show && *show)216 xt_add_child( node, xt_new_node( "show", show, NULL ) );217 if( status)218 xt_add_child( node, xt_new_node( "status", status, NULL ) );212 if( jd->away_state ) 213 xt_add_child( node, xt_new_node( "show", jd->away_state->code, NULL ) ); 214 if( jd->away_message ) 215 xt_add_child( node, xt_new_node( "status", jd->away_message, NULL ) ); 219 216 220 217 /* This makes the packet slightly bigger, but clients interested in
Note: See TracChangeset
for help on using the changeset viewer.