Changes in protocols/jabber/jabber.c [df1fb67:ef5c185]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/jabber/jabber.c
rdf1fb67 ref5c185 54 54 55 55 s = set_add( &acc->set, "tls", "try", set_eval_tls, acc ); 56 s->flags |= ACC_SET_OFFLINE_ONLY; 57 58 s = set_add( &acc->set, "xmlconsole", "false", set_eval_bool, acc ); 56 59 s->flags |= ACC_SET_OFFLINE_ONLY; 57 60 } … … 189 192 imc_logout( ic, TRUE ); 190 193 } 194 195 if( set_getbool( &acc->set, "xmlconsole" ) ) 196 { 197 jd->flags |= JFLAG_XMLCONSOLE; 198 /* Shouldn't really do this at this stage already, maybe. But 199 I think this shouldn't break anything. */ 200 imcb_add_buddy( ic, JABBER_XMLCONSOLE_HANDLE, NULL ); 201 } 191 202 } 192 203 … … 196 207 197 208 jabber_end_stream( ic ); 209 210 while( ic->groupchats ) 211 jabber_chat_free( ic->groupchats ); 198 212 199 213 if( jd->r_inpa >= 0 ) … … 224 238 struct jabber_buddy *bud; 225 239 struct xt_node *node; 240 char *s; 226 241 int st; 227 242 228 bud = jabber_buddy_by_jid( ic, who, 0 ); 243 if( g_strcasecmp( who, JABBER_XMLCONSOLE_HANDLE ) == 0 ) 244 return jabber_write( ic, message, strlen( message ) ); 245 246 if( ( s = strchr( who, '=' ) ) && jabber_chat_by_name( ic, s + 1 ) ) 247 bud = jabber_buddy_by_ext_jid( ic, who, 0 ); 248 else 249 bud = jabber_buddy_by_jid( ic, who, 0 ); 229 250 230 251 node = xt_new_node( "body", message, NULL ); … … 311 332 static void jabber_add_buddy( struct im_connection *ic, char *who, char *group ) 312 333 { 334 struct jabber_data *jd = ic->proto_data; 335 336 if( g_strcasecmp( who, JABBER_XMLCONSOLE_HANDLE ) == 0 ) 337 { 338 jd->flags |= JFLAG_XMLCONSOLE; 339 imcb_add_buddy( ic, JABBER_XMLCONSOLE_HANDLE, NULL ); 340 return; 341 } 342 313 343 if( jabber_add_to_roster( ic, who, NULL ) ) 314 344 presence_send_request( ic, who, "subscribe" ); … … 317 347 static void jabber_remove_buddy( struct im_connection *ic, char *who, char *group ) 318 348 { 349 struct jabber_data *jd = ic->proto_data; 350 351 if( g_strcasecmp( who, JABBER_XMLCONSOLE_HANDLE ) == 0 ) 352 { 353 jd->flags &= ~JFLAG_XMLCONSOLE; 354 /* Not necessary for now. And for now the code isn't too 355 happy if the buddy is completely gone right after calling 356 this function already. 357 imcb_remove_buddy( ic, JABBER_XMLCONSOLE_HANDLE, NULL ); 358 */ 359 return; 360 } 361 319 362 /* We should always do this part. Clean up our administration a little bit. */ 320 363 jabber_buddy_remove_bare( ic, who ); … … 322 365 if( jabber_remove_from_roster( ic, who ) ) 323 366 presence_send_request( ic, who, "unsubscribe" ); 367 } 368 369 static struct groupchat *jabber_chat_join_( struct im_connection *ic, char *room, char *nick, char *password ) 370 { 371 if( strchr( room, '@' ) == NULL ) 372 imcb_error( ic, "Invalid room name: %s", room ); 373 else if( jabber_chat_by_name( ic, room ) ) 374 imcb_error( ic, "Already present in chat `%s'", room ); 375 else 376 return jabber_chat_join( ic, room, nick, password ); 377 378 return NULL; 379 } 380 381 static void jabber_chat_msg_( struct groupchat *c, char *message, int flags ) 382 { 383 if( c && message ) 384 jabber_chat_msg( c, message, flags ); 385 } 386 387 static void jabber_chat_topic_( struct groupchat *c, char *topic ) 388 { 389 if( c && topic ) 390 jabber_chat_topic( c, topic ); 391 } 392 393 static void jabber_chat_leave_( struct groupchat *c ) 394 { 395 if( c ) 396 jabber_chat_leave( c, NULL ); 324 397 } 325 398 … … 388 461 ret->buddy_msg = jabber_buddy_msg; 389 462 ret->away_states = jabber_away_states; 390 // ret->get_status_string = jabber_get_status_string;391 463 ret->set_away = jabber_set_away; 392 464 // ret->set_info = jabber_set_info; … … 394 466 ret->add_buddy = jabber_add_buddy; 395 467 ret->remove_buddy = jabber_remove_buddy; 396 // ret->chat_msg = jabber_chat_msg; 468 ret->chat_msg = jabber_chat_msg_; 469 ret->chat_topic = jabber_chat_topic_; 397 470 // ret->chat_invite = jabber_chat_invite; 398 // ret->chat_leave = jabber_chat_leave;399 // ret->chat_open = jabber_chat_open;471 ret->chat_leave = jabber_chat_leave_; 472 ret->chat_join = jabber_chat_join_; 400 473 ret->keepalive = jabber_keepalive; 401 474 ret->send_typing = jabber_send_typing;
Note: See TracChangeset
for help on using the changeset viewer.