Changes in protocols/jabber/jabber.c [df1fb67:9da0bbf]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/jabber/jabber.c
rdf1fb67 r9da0bbf 197 197 jabber_end_stream( ic ); 198 198 199 while( ic->groupchats ) 200 jabber_chat_free( ic->groupchats ); 201 199 202 if( jd->r_inpa >= 0 ) 200 203 b_event_remove( jd->r_inpa ); … … 224 227 struct jabber_buddy *bud; 225 228 struct xt_node *node; 229 char *s; 226 230 int st; 227 231 228 bud = jabber_buddy_by_jid( ic, who, 0 ); 232 if( g_strcasecmp( who, JABBER_XMLCONSOLE_HANDLE ) == 0 ) 233 return jabber_write( ic, message, strlen( message ) ); 234 235 if( ( s = strchr( who, '=' ) ) && jabber_chat_by_name( ic, s + 1 ) ) 236 bud = jabber_buddy_by_ext_jid( ic, who, 0 ); 237 else 238 bud = jabber_buddy_by_jid( ic, who, 0 ); 229 239 230 240 node = xt_new_node( "body", message, NULL ); … … 311 321 static void jabber_add_buddy( struct im_connection *ic, char *who, char *group ) 312 322 { 323 struct jabber_data *jd = ic->proto_data; 324 325 if( g_strcasecmp( who, JABBER_XMLCONSOLE_HANDLE ) == 0 ) 326 { 327 jd->flags |= JFLAG_XMLCONSOLE; 328 imcb_add_buddy( ic, JABBER_XMLCONSOLE_HANDLE, NULL ); 329 return; 330 } 331 313 332 if( jabber_add_to_roster( ic, who, NULL ) ) 314 333 presence_send_request( ic, who, "subscribe" ); … … 317 336 static void jabber_remove_buddy( struct im_connection *ic, char *who, char *group ) 318 337 { 338 struct jabber_data *jd = ic->proto_data; 339 340 if( g_strcasecmp( who, JABBER_XMLCONSOLE_HANDLE ) == 0 ) 341 { 342 jd->flags &= ~JFLAG_XMLCONSOLE; 343 /* Not necessary for now. And for now the code isn't too 344 happy if the buddy is completely gone right after calling 345 this function already. 346 imcb_remove_buddy( ic, JABBER_XMLCONSOLE_HANDLE, NULL ); 347 */ 348 return; 349 } 350 319 351 /* We should always do this part. Clean up our administration a little bit. */ 320 352 jabber_buddy_remove_bare( ic, who ); … … 322 354 if( jabber_remove_from_roster( ic, who ) ) 323 355 presence_send_request( ic, who, "unsubscribe" ); 356 } 357 358 static struct groupchat *jabber_chat_join_( struct im_connection *ic, char *room, char *nick, char *password ) 359 { 360 if( strchr( room, '@' ) == NULL ) 361 imcb_error( ic, "Invalid room name: %s", room ); 362 else if( jabber_chat_by_name( ic, room ) ) 363 imcb_error( ic, "Already present in chat `%s'", room ); 364 else 365 return jabber_chat_join( ic, room, nick, password ); 366 367 return NULL; 368 } 369 370 static void jabber_chat_msg_( struct groupchat *c, char *message, int flags ) 371 { 372 if( c && message ) 373 jabber_chat_msg( c, message, flags ); 374 } 375 376 static void jabber_chat_leave_( struct groupchat *c ) 377 { 378 if( c ) 379 jabber_chat_leave( c, NULL ); 324 380 } 325 381 … … 388 444 ret->buddy_msg = jabber_buddy_msg; 389 445 ret->away_states = jabber_away_states; 390 // ret->get_status_string = jabber_get_status_string;391 446 ret->set_away = jabber_set_away; 392 447 // ret->set_info = jabber_set_info; … … 394 449 ret->add_buddy = jabber_add_buddy; 395 450 ret->remove_buddy = jabber_remove_buddy; 396 // ret->chat_msg = jabber_chat_msg;451 ret->chat_msg = jabber_chat_msg_; 397 452 // ret->chat_invite = jabber_chat_invite; 398 // ret->chat_leave = jabber_chat_leave;399 // ret->chat_open = jabber_chat_open;453 ret->chat_leave = jabber_chat_leave_; 454 ret->chat_join = jabber_chat_join_; 400 455 ret->keepalive = jabber_keepalive; 401 456 ret->send_typing = jabber_send_typing;
Note: See TracChangeset
for help on using the changeset viewer.