aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--protocols/jabber/jabber.c24
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;
}