diff options
author | dequis <dx@dxzone.com.ar> | 2015-04-05 17:47:16 -0300 |
---|---|---|
committer | dequis <dx@dxzone.com.ar> | 2015-04-21 00:47:57 -0300 |
commit | 71074ac7e43cfaf9b479e14de70b7d2bb48af806 (patch) | |
tree | 89ce6cef5cbb716c81ea95f679c512bc47debe0f | |
parent | 2fe82975fa5905c252c960e8a44d2eeed40273ea (diff) |
jabber: Register "hipchat" protocol (only minimal support for now)
Another take on the subprotocols idea that, IMO, was a failure.
Unlike the other implementation, this one doesn't touch gtalk/facebook
accounts, it just adds another copy of the "jabber" prpl called "hipchat".
And, based on the protocol name:
- sets JFLAG_HIPCHAT to jabber_data
- sets the default value of the "server" setting
- only includes the oauth setting for jabber-type accounts
This is slightly more "hardcoded" but honestly facebook and gtalk are
just as hardcoded as this.
Copying the prpl is needed because the meaning of the usernames is
completely different (there's no srv lookup stuff either)
-rw-r--r-- | protocols/jabber/jabber.c | 18 | ||||
-rw-r--r-- | protocols/jabber/jabber.h | 1 |
2 files changed, 17 insertions, 2 deletions
diff --git a/protocols/jabber/jabber.c b/protocols/jabber/jabber.c index 1ad5ecb6..2db026cd 100644 --- a/protocols/jabber/jabber.c +++ b/protocols/jabber/jabber.c @@ -60,8 +60,6 @@ static void jabber_init(account_t *acc) s = set_add(&acc->set, "activity_timeout", "600", set_eval_int, acc); - s = set_add(&acc->set, "oauth", "false", set_eval_oauth, acc); - s = set_add(&acc->set, "display_name", NULL, NULL, acc); g_snprintf(str, sizeof(str), "%d", jabber_port_list[0]); @@ -83,6 +81,12 @@ static void jabber_init(account_t *acc) s = set_add(&acc->set, "server", NULL, set_eval_account, acc); s->flags |= SET_NOSAVE | ACC_SET_OFFLINE_ONLY | SET_NULL_OK; + if (strcmp(acc->prpl->name, "hipchat") == 0) { + set_setstr(&acc->set, "server", "chat.hipchat.com"); + } else { + s = set_add(&acc->set, "oauth", "false", set_eval_oauth, acc); + } + s = set_add(&acc->set, "ssl", "false", set_eval_bool, acc); s->flags |= ACC_SET_OFFLINE_ONLY; @@ -121,6 +125,10 @@ static void jabber_login(account_t *acc) jd->fd = jd->r_inpa = jd->w_inpa = -1; + if (strcmp(acc->prpl->name, "hipchat") == 0) { + jd->flags |= JFLAG_HIPCHAT; + } + if (jd->server == NULL) { imcb_error(ic, "Incomplete account name (format it like <username@jabberserver.name>)"); imc_logout(ic, FALSE); @@ -655,6 +663,7 @@ gboolean jabber_handle_is_self(struct im_connection *ic, const char *who) void jabber_initmodule() { struct prpl *ret = g_new0(struct prpl, 1); + struct prpl *hipchat = NULL; ret->name = "jabber"; ret->mms = 0; /* no limit */ @@ -685,4 +694,9 @@ void jabber_initmodule() ret->buddy_action = jabber_buddy_action; register_protocol(ret); + + /* Another one for hipchat, which has completely different logins */ + hipchat = g_memdup(ret, sizeof(struct prpl)); + hipchat->name = "hipchat"; + register_protocol(hipchat); } diff --git a/protocols/jabber/jabber.h b/protocols/jabber/jabber.h index f991465e..6a329a06 100644 --- a/protocols/jabber/jabber.h +++ b/protocols/jabber/jabber.h @@ -47,6 +47,7 @@ typedef enum { JFLAG_STARTTLS_DONE = 128, /* If a plaintext session was converted to TLS. */ JFLAG_GTALK = 0x100000, /* Is Google Talk, as confirmed by iq discovery */ + JFLAG_HIPCHAT = 0x200000, /* Is hipchat, because prpl->name says so */ JFLAG_SASL_FB = 0x10000, /* Trying Facebook authentication. */ } jabber_flags_t; |