Changeset b9f8b87
- Timestamp:
- 2007-07-01T16:29:21Z (17 years ago)
- Branches:
- master
- Children:
- 9c9b37c
- Parents:
- 2758cfe
- Location:
- protocols/jabber
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/jabber/conference.c
r2758cfe rb9f8b87 128 128 Slightly hackish way of finding out eh? ;-) */ 129 129 130 /* This is pretty messy... */ 130 /* This is pretty messy... Here it sets ext_jid to the real 131 JID of the participant. Works for non-anonymized channels. 132 Might break if someone joins a chat twice, though. */ 131 133 for( c = node->children; ( c = xt_find_node( c, "x" ) ); c = c->next ) 132 134 if( ( s = xt_find_attr( c, "xmlns" ) ) && … … 137 139 { 138 140 /* Yay, found what we need. :-) */ 139 bud->ext_jid = g_strdup( s );141 bud->ext_jid = jabber_normalize( s ); 140 142 break; 141 143 } … … 146 148 { 147 149 if( bud == jc->me ) 148 bud->ext_jid = g_strdup( ic->acc->user );150 bud->ext_jid = jabber_normalize( ic->acc->user ); 149 151 else 150 152 /* Don't want the nick to be at the end, so let's -
protocols/jabber/jabber.c
r2758cfe rb9f8b87 224 224 struct jabber_buddy *bud; 225 225 struct xt_node *node; 226 char *s; 226 227 int st; 227 228 … … 229 230 return jabber_write( ic, message, strlen( message ) ); 230 231 231 bud = jabber_buddy_by_jid( ic, who, 0 ); 232 if( ( s = strchr( who, '=' ) ) && jabber_chat_by_name( ic, s + 1 ) ) 233 bud = jabber_buddy_by_ext_jid( ic, who, 0 ); 234 else 235 bud = jabber_buddy_by_jid( ic, who, 0 ); 232 236 233 237 node = xt_new_node( "body", message, NULL ); -
protocols/jabber/jabber.h
r2758cfe rb9f8b87 195 195 struct jabber_buddy *jabber_buddy_add( struct im_connection *ic, char *full_jid ); 196 196 struct jabber_buddy *jabber_buddy_by_jid( struct im_connection *ic, char *jid, get_buddy_flags_t flags ); 197 struct jabber_buddy *jabber_buddy_by_ext_jid( struct im_connection *ic, char *jid, get_buddy_flags_t flags ); 197 198 int jabber_buddy_remove( struct im_connection *ic, char *full_jid ); 198 199 int jabber_buddy_remove_bare( struct im_connection *ic, char *bare_jid ); -
protocols/jabber/jabber_util.c
r2758cfe rb9f8b87 320 320 else 321 321 { 322 /* Keep in mind that full_jid currently isn't really 323 a full JID... */ 322 324 new->bare_jid = g_strdup( full_jid ); 323 325 g_hash_table_insert( jd->buddies, new->bare_jid, new ); … … 333 335 { 334 336 /* Let's waste some more bytes of RAM instead of to make 335 memory management a total disaster here.. */ 337 memory management a total disaster here. And it saves 338 me one g_free() call in this function. :-P */ 336 339 new->full_jid = full_jid; 337 340 } … … 426 429 return best_prio; 427 430 } 431 } 432 433 /* I'm keeping a separate ext_jid attribute to save a JID that makes sense 434 to export to BitlBee. This is mainly for groupchats right now. It's 435 a bit of a hack, but I just think having the user nickname in the hostname 436 part of the hostmask doesn't look nice on IRC. Normally you can convert 437 a normal JID to ext_jid by swapping the part before and after the / and 438 replacing the / with a =. But there should be some stripping (@s are 439 allowed in Jabber nicks...). */ 440 struct jabber_buddy *jabber_buddy_by_ext_jid( struct im_connection *ic, char *jid_, get_buddy_flags_t flags ) 441 { 442 struct jabber_buddy *bud; 443 char *s, *jid; 444 445 jid = jabber_normalize( jid_ ); 446 447 if( ( s = strchr( jid, '=' ) ) == NULL ) 448 return NULL; 449 450 for( bud = jabber_buddy_by_jid( ic, s + 1, GET_BUDDY_FIRST ); bud; bud = bud->next ) 451 { 452 /* Hmmm, could happen if not all people in the chat are anonymized? */ 453 if( bud->ext_jid == NULL ) 454 continue; 455 456 if( strcmp( bud->ext_jid, jid ) == 0 ) 457 break; 458 } 459 460 g_free( jid ); 461 462 return bud; 428 463 } 429 464 -
protocols/jabber/message.c
r2758cfe rb9f8b87 53 53 { 54 54 if( bud ) 55 { 55 56 bud->last_act = time( NULL ); 57 from = bud->ext_jid ? : bud->bare_jid; 58 } 56 59 else 57 60 *s = 0; /* We need to generate a bare JID now. */ … … 81 84 82 85 if( fullmsg->len > 0 ) 83 imcb_buddy_msg( ic, bud ? bud->bare_jid :from, fullmsg->str,86 imcb_buddy_msg( ic, from, fullmsg->str, 84 87 0, jabber_get_timestamp( node ) ); 85 88 … … 90 93 { 91 94 bud->flags |= JBFLAG_DOES_XEP85; 92 imcb_buddy_typing( ic, bud ? bud->bare_jid :from, OPT_TYPING );95 imcb_buddy_typing( ic, from, OPT_TYPING ); 93 96 } 94 97 /* No need to send a "stopped typing" signal when there's a message. */ … … 96 99 { 97 100 bud->flags |= JBFLAG_DOES_XEP85; 98 imcb_buddy_typing( ic, bud ? bud->bare_jid :from, 0 );101 imcb_buddy_typing( ic, from, 0 ); 99 102 } 100 103 else if( xt_find_node( node->children, "paused" ) ) 101 104 { 102 105 bud->flags |= JBFLAG_DOES_XEP85; 103 imcb_buddy_typing( ic, bud ? bud->bare_jid :from, OPT_THINKING );106 imcb_buddy_typing( ic, from, OPT_THINKING ); 104 107 } 105 108
Note: See TracChangeset
for help on using the changeset viewer.