diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2007-04-25 21:41:34 -0700 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2007-04-25 21:41:34 -0700 |
commit | 6286f80d6dc1dc4cb8106b4e209a8578d7cebe56 (patch) | |
tree | 0db5a8b93910ffdf18d4d3588a3022ad727f7e40 /protocols/jabber/conference.c | |
parent | 2d317bbe8def887fb796b2daaa958c59d8f4c070 (diff) |
Prepared the Jabber module for anonymous rooms, but the BitlBee core
doesn't deal with it very well, and I don't really know yet how I'll
solve this... :-(
Diffstat (limited to 'protocols/jabber/conference.c')
-rw-r--r-- | protocols/jabber/conference.c | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/protocols/jabber/conference.c b/protocols/jabber/conference.c index f0d8f050..dde2b8b5 100644 --- a/protocols/jabber/conference.c +++ b/protocols/jabber/conference.c @@ -136,28 +136,31 @@ void jabber_chat_pkt_presence( struct im_connection *ic, struct jabber_buddy *bu if( ( s = xt_find_attr( c, "jid" ) ) ) { /* Yay, found what we need. :-) */ - bud->orig_jid = g_strdup( s ); + bud->ext_jid = g_strdup( s ); break; } } - /* Won't handle this for now. */ - if( bud->orig_jid == NULL ) - return; + /* Make up some other handle, if necessary. */ + if( bud->ext_jid == NULL ) + { + /* Don't want the nick to be at the end, so let's + think of some slightly different notation to use + for anonymous groupchat participants in BitlBee. */ + bud->ext_jid = g_strdup_printf( "%s=%s", bud->resource, bud->bare_jid ); + bud->flags |= JBFLAG_IS_ANONYMOUS; + } - s = strchr( bud->orig_jid, '/' ); + s = strchr( bud->ext_jid, '/' ); if( s ) *s = 0; /* Should NEVER be NULL, but who knows... */ - imcb_chat_add_buddy( chat, bud->orig_jid ); + imcb_chat_add_buddy( chat, bud->ext_jid ); if( s ) *s = '/'; } else if( type ) /* This only gets called if type is NULL or "unavailable" */ { - /* Won't handle this for now. */ - if( bud->orig_jid == NULL ) - return; - s = strchr( bud->orig_jid, '/' ); - if( s ) *s = 0; /* Should NEVER be NULL, but who knows... */ - imcb_chat_remove_buddy( chat, bud->orig_jid, NULL ); + s = strchr( bud->ext_jid, '/' ); + if( s ) *s = 0; + imcb_chat_remove_buddy( chat, bud->ext_jid, NULL ); if( s ) *s = '/'; if( bud == jc->me ) @@ -198,9 +201,9 @@ void jabber_chat_pkt_message( struct im_connection *ic, struct jabber_buddy *bud if( body && body->text_len > 0 ) { - s = strchr( bud->orig_jid, '/' ); + s = strchr( bud->ext_jid, '/' ); if( s ) *s = 0; - imcb_chat_msg( chat, bud->orig_jid, body->text, 0, jabber_get_timestamp( node ) ); + imcb_chat_msg( chat, bud->ext_jid, body->text, 0, jabber_get_timestamp( node ) ); if( s ) *s = '/'; } } |