diff options
author | dequis <dx@dxzone.com.ar> | 2015-10-21 08:40:58 -0300 |
---|---|---|
committer | dequis <dx@dxzone.com.ar> | 2015-10-21 08:40:58 -0300 |
commit | 3314ced0efff64ce4f92caf24b9272f5249c3a17 (patch) | |
tree | 1234f8b50fa14cdf069b5f92edb143270da1caa4 | |
parent | 09f7ec143eef969bbebd10b7eb48504b0372c443 (diff) |
jabber: set BEE_USER_NOOTR flag to _xmlconsole
Fixes trac ticket 1111, https://bugs.bitlbee.org/bitlbee/ticket/1111
One of the most annoying issues. You're trying to debug stuff and it
just crashes even harder than without the debug enabled.
-rw-r--r-- | protocols/jabber/jabber.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/protocols/jabber/jabber.c b/protocols/jabber/jabber.c index c1e55a78..74c870e7 100644 --- a/protocols/jabber/jabber.c +++ b/protocols/jabber/jabber.c @@ -199,6 +199,20 @@ static void jabber_login(account_t *acc) } } +static void jabber_xmlconsole_enable(struct im_connection *ic) +{ + struct jabber_data *jd = ic->proto_data; + const char *handle = JABBER_XMLCONSOLE_HANDLE; + bee_user_t *bu; + + jd->flags |= JFLAG_XMLCONSOLE; + + if (!(bu = bee_user_by_handle(ic->bee, ic, handle))) { + bu = bee_user_new(ic->bee, ic, handle, 0); + bu->flags |= BEE_USER_NOOTR; + } +} + /* Separate this from jabber_login() so we can do OAuth first if necessary. Putting this in io.c would probably be more correct. */ void jabber_connect(struct im_connection *ic) @@ -265,10 +279,7 @@ void jabber_connect(struct im_connection *ic) } if (set_getbool(&acc->set, "xmlconsole")) { - jd->flags |= JFLAG_XMLCONSOLE; - /* Shouldn't really do this at this stage already, maybe. But - I think this shouldn't break anything. */ - imcb_add_buddy(ic, JABBER_XMLCONSOLE_HANDLE, NULL); + jabber_xmlconsole_enable(ic); } if (set_getbool(&acc->set, "mail_notifications")) { @@ -473,11 +484,8 @@ static void jabber_set_away(struct im_connection *ic, char *state_txt, char *mes static void jabber_add_buddy(struct im_connection *ic, char *who, char *group) { - struct jabber_data *jd = ic->proto_data; - if (g_strcasecmp(who, JABBER_XMLCONSOLE_HANDLE) == 0) { - jd->flags |= JFLAG_XMLCONSOLE; - imcb_add_buddy(ic, JABBER_XMLCONSOLE_HANDLE, NULL); + jabber_xmlconsole_enable(ic); return; } |