diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2011-12-22 12:23:18 +0100 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2011-12-22 12:23:18 +0100 |
commit | ad46e4d3ed1997e6b3f718a7a8be9a37eb63388d (patch) | |
tree | d42f7ec8c32775ed2344dc50fb816b5618830268 /protocols/jabber/jabber.c | |
parent | f1c870a20c1c8a1173fe6244952518f015fc1346 (diff) |
Use initgroups() as well when dropping privileges. Closes bug #852.
Diffstat (limited to 'protocols/jabber/jabber.c')
-rw-r--r-- | protocols/jabber/jabber.c | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/protocols/jabber/jabber.c b/protocols/jabber/jabber.c index 7d9547ab..fae55ffe 100644 --- a/protocols/jabber/jabber.c +++ b/protocols/jabber/jabber.c @@ -335,6 +335,25 @@ static int jabber_buddy_msg( struct im_connection *ic, char *who, char *message, if( g_strcasecmp( who, JABBER_XMLCONSOLE_HANDLE ) == 0 ) return jabber_write( ic, message, strlen( message ) ); + + if( g_strcasecmp( who, JABBER_MOCK_HANDLE ) == 0 ) + { + /* Parse. */ + if( xt_feed( jd->xt, message, strlen( message ) ) < 0 ) + { + imcb_error( ic, "XML stream error" ); + imc_logout( ic, TRUE ); + return FALSE; + } + + /* Execute all handlers. */ + if( !xt_handle( jd->xt, NULL, 1 ) ) + { + /* Don't do anything, the handlers should have + aborted the connection already. */ + return FALSE; + } + } if( ( s = strchr( who, '=' ) ) && jabber_chat_by_jid( ic, s + 1 ) ) bud = jabber_buddy_by_ext_jid( ic, who, 0 ); @@ -425,7 +444,13 @@ static void jabber_add_buddy( struct im_connection *ic, char *who, char *group ) if( g_strcasecmp( who, JABBER_XMLCONSOLE_HANDLE ) == 0 ) { jd->flags |= JFLAG_XMLCONSOLE; - imcb_add_buddy( ic, JABBER_XMLCONSOLE_HANDLE, NULL ); + imcb_add_buddy( ic, who, NULL ); + return; + } + else if( g_strcasecmp( who, JABBER_MOCK_HANDLE ) == 0 ) + { + jd->flags |= JFLAG_MOCK; + imcb_add_buddy( ic, who, NULL ); return; } @@ -447,6 +472,11 @@ static void jabber_remove_buddy( struct im_connection *ic, char *who, char *grou */ return; } + else if( g_strcasecmp( who, JABBER_MOCK_HANDLE ) == 0 ) + { + jd->flags &= ~JFLAG_MOCK; + return; + } /* We should always do this part. Clean up our administration a little bit. */ jabber_buddy_remove_bare( ic, who ); |