source: protocols/jabber/jabber.c @ dd43c62

Last change on this file since dd43c62 was dd43c62, checked in by dequis <dx@…>, at 2015-05-28T05:26:24Z

Gmail notifications support through new imcb_notify_email() API

  • Property mode set to 100644
File size: 19.7 KB
Line 
1/***************************************************************************\
2*                                                                           *
3*  BitlBee - An IRC to IM gateway                                           *
4*  Jabber module - Main file                                                *
5*                                                                           *
6*  Copyright 2006-2013 Wilmer van der Gaast <wilmer@gaast.net>              *
7*                                                                           *
8*  This program is free software; you can redistribute it and/or modify     *
9*  it under the terms of the GNU General Public License as published by     *
10*  the Free Software Foundation; either version 2 of the License, or        *
11*  (at your option) any later version.                                      *
12*                                                                           *
13*  This program is distributed in the hope that it will be useful,          *
14*  but WITHOUT ANY WARRANTY; without even the implied warranty of           *
15*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            *
16*  GNU General Public License for more details.                             *
17*                                                                           *
18*  You should have received a copy of the GNU General Public License along  *
19*  with this program; if not, write to the Free Software Foundation, Inc.,  *
20*  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.              *
21*                                                                           *
22\***************************************************************************/
23
24#include <glib.h>
25#include <string.h>
26#include <unistd.h>
27#include <ctype.h>
28#include <stdio.h>
29
30#include "ssl_client.h"
31#include "xmltree.h"
32#include "bitlbee.h"
33#include "jabber.h"
34#include "oauth.h"
35#include "md5.h"
36
37GSList *jabber_connections;
38
39/* First enty is the default */
40static const int jabber_port_list[] = {
41        5222,
42        5223,
43        5220,
44        5221,
45        5224,
46        5225,
47        5226,
48        5227,
49        5228,
50        5229,
51        80,
52        443,
53        0
54};
55
56static void jabber_init(account_t *acc)
57{
58        set_t *s;
59        char str[16];
60
61        s = set_add(&acc->set, "activity_timeout", "600", set_eval_int, acc);
62
63        s = set_add(&acc->set, "display_name", NULL, NULL, acc);
64
65        g_snprintf(str, sizeof(str), "%d", jabber_port_list[0]);
66        s = set_add(&acc->set, "port", str, set_eval_int, acc);
67        s->flags |= ACC_SET_OFFLINE_ONLY;
68
69        s = set_add(&acc->set, "priority", "0", set_eval_priority, acc);
70
71        s = set_add(&acc->set, "proxy", "<local>;<auto>", NULL, acc);
72
73        s = set_add(&acc->set, "resource", "BitlBee", NULL, acc);
74        s->flags |= ACC_SET_OFFLINE_ONLY;
75
76        s = set_add(&acc->set, "resource_select", "activity", NULL, acc);
77
78        s = set_add(&acc->set, "sasl", "true", set_eval_bool, acc);
79        s->flags |= ACC_SET_OFFLINE_ONLY | SET_HIDDEN_DEFAULT;
80
81        s = set_add(&acc->set, "server", NULL, set_eval_account, acc);
82        s->flags |= SET_NOSAVE | ACC_SET_OFFLINE_ONLY | SET_NULL_OK;
83
84        if (strcmp(acc->prpl->name, "hipchat") == 0) {
85                set_setstr(&acc->set, "server", "chat.hipchat.com");
86        } else {
87                s = set_add(&acc->set, "oauth", "false", set_eval_oauth, acc);
88        }
89
90        s = set_add(&acc->set, "ssl", "false", set_eval_bool, acc);
91        s->flags |= ACC_SET_OFFLINE_ONLY;
92
93        s = set_add(&acc->set, "tls", "true", set_eval_tls, acc);
94        s->flags |= ACC_SET_OFFLINE_ONLY;
95
96        s = set_add(&acc->set, "tls_verify", "true", set_eval_bool, acc);
97        s->flags |= ACC_SET_OFFLINE_ONLY;
98
99        s = set_add(&acc->set, "user_agent", "BitlBee", NULL, acc);
100
101        s = set_add(&acc->set, "xmlconsole", "false", set_eval_bool, acc);
102
103        s = set_add(&acc->set, "gmail_notifications", "false", set_eval_bool, acc);
104        s->flags |= ACC_SET_OFFLINE_ONLY;
105
106        s = set_add(&acc->set, "notify_handle", NULL, NULL, acc);
107        s->flags |= ACC_SET_OFFLINE_ONLY | SET_NULL_OK;
108
109        acc->flags |= ACC_FLAG_AWAY_MESSAGE | ACC_FLAG_STATUS_MESSAGE |
110                      ACC_FLAG_HANDLE_DOMAINS;
111}
112
113static void jabber_generate_id_hash(struct jabber_data *jd);
114
115static void jabber_login(account_t *acc)
116{
117        struct im_connection *ic = imcb_new(acc);
118        struct jabber_data *jd = g_new0(struct jabber_data, 1);
119        char *s;
120
121        /* For now this is needed in the _connected() handlers if using
122           GLib event handling, to make sure we're not handling events
123           on dead connections. */
124        jabber_connections = g_slist_prepend(jabber_connections, ic);
125
126        jd->ic = ic;
127        ic->proto_data = jd;
128
129        jabber_set_me(ic, acc->user);
130
131        jd->fd = jd->r_inpa = jd->w_inpa = -1;
132
133        if (strcmp(acc->prpl->name, "hipchat") == 0) {
134                jd->flags |= JFLAG_HIPCHAT;
135        }
136
137        if (jd->server == NULL) {
138                imcb_error(ic, "Incomplete account name (format it like <username@jabberserver.name>)");
139                imc_logout(ic, FALSE);
140                return;
141        }
142
143        if ((s = strchr(jd->server, '/'))) {
144                *s = 0;
145                set_setstr(&acc->set, "resource", s + 1);
146
147                /* Also remove the /resource from the original variable so we
148                   won't have to do this again every time. */
149                s = strchr(acc->user, '/');
150                *s = 0;
151        }
152
153        jd->node_cache = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, jabber_cache_entry_free);
154        jd->buddies = g_hash_table_new(g_str_hash, g_str_equal);
155
156        if (set_getbool(&acc->set, "oauth")) {
157                GSList *p_in = NULL;
158                const char *tok;
159
160                jd->fd = jd->r_inpa = jd->w_inpa = -1;
161
162                if (strstr(jd->server, ".facebook.com")) {
163                        jd->oauth2_service = &oauth2_service_facebook;
164                } else {
165                        jd->oauth2_service = &oauth2_service_google;
166                }
167
168                oauth_params_parse(&p_in, ic->acc->pass);
169
170                /* First see if we have a refresh token, in which case any
171                   access token we *might* have has probably expired already
172                   anyway. */
173                if ((tok = oauth_params_get(&p_in, "refresh_token"))) {
174                        sasl_oauth2_refresh(ic, tok);
175                }
176                /* If we don't have a refresh token, let's hope the access
177                   token is still usable. */
178                else if ((tok = oauth_params_get(&p_in, "access_token"))) {
179                        jd->oauth2_access_token = g_strdup(tok);
180                        jabber_connect(ic);
181                }
182                /* If we don't have any, start the OAuth process now. Don't
183                   even open an XMPP connection yet. */
184                else {
185                        sasl_oauth2_init(ic);
186                        ic->flags |= OPT_SLOW_LOGIN;
187                }
188
189                oauth_params_free(&p_in);
190        } else {
191                jabber_connect(ic);
192        }
193}
194
195/* Separate this from jabber_login() so we can do OAuth first if necessary.
196   Putting this in io.c would probably be more correct. */
197void jabber_connect(struct im_connection *ic)
198{
199        account_t *acc = ic->acc;
200        struct jabber_data *jd = ic->proto_data;
201        int i;
202        char *connect_to;
203        struct ns_srv_reply **srvl = NULL, *srv = NULL;
204
205        /* Figure out the hostname to connect to. */
206        if (acc->server && *acc->server) {
207                connect_to = acc->server;
208        } else if ((srvl = srv_lookup("xmpp-client", "tcp", jd->server)) ||
209                   (srvl = srv_lookup("jabber-client", "tcp", jd->server))) {
210                /* Find the lowest-priority one. These usually come
211                   back in random/shuffled order. Not looking at
212                   weights etc for now. */
213                srv = *srvl;
214                for (i = 1; srvl[i]; i++) {
215                        if (srvl[i]->prio < srv->prio) {
216                                srv = srvl[i];
217                        }
218                }
219
220                connect_to = srv->name;
221        } else {
222                connect_to = jd->server;
223        }
224
225        imcb_log(ic, "Connecting");
226
227        for (i = 0; jabber_port_list[i] > 0; i++) {
228                if (set_getint(&acc->set, "port") == jabber_port_list[i]) {
229                        break;
230                }
231        }
232
233        if (jabber_port_list[i] == 0) {
234                imcb_log(ic, "Illegal port number");
235                imc_logout(ic, FALSE);
236                return;
237        }
238
239        /* For non-SSL connections we can try to use the port # from the SRV
240           reply, but let's not do that when using SSL, SSL usually runs on
241           non-standard ports... */
242        if (set_getbool(&acc->set, "ssl")) {
243                jd->ssl = ssl_connect(connect_to, set_getint(&acc->set, "port"), set_getbool(&acc->set,
244                                                                                             "tls_verify"), jabber_connected_ssl,
245                                      ic);
246                jd->fd = jd->ssl ? ssl_getfd(jd->ssl) : -1;
247        } else {
248                jd->fd = proxy_connect(connect_to, srv ? srv->port : set_getint(&acc->set,
249                                                                                "port"), jabber_connected_plain, ic);
250        }
251        srv_free(srvl);
252
253        if (jd->fd == -1) {
254                imcb_error(ic, "Could not connect to server");
255                imc_logout(ic, TRUE);
256
257                return;
258        }
259
260        if (set_getbool(&acc->set, "xmlconsole")) {
261                jd->flags |= JFLAG_XMLCONSOLE;
262                /* Shouldn't really do this at this stage already, maybe. But
263                   I think this shouldn't break anything. */
264                imcb_add_buddy(ic, JABBER_XMLCONSOLE_HANDLE, NULL);
265        }
266        if (set_getbool(&acc->set, "gmail_notifications")) {
267                jd->flags |= JFLAG_GMAILNOTIFY;
268                if (set_getstr(&acc->set, "notify_handle")) {
269                        imcb_add_buddy(ic, set_getstr(&acc->set, "notify_handle"), NULL);
270                }
271        }
272
273        jabber_generate_id_hash(jd);
274}
275
276/* This generates an unfinished md5_state_t variable. Every time we generate
277   an ID, we finish the state by adding a sequence number and take the hash. */
278static void jabber_generate_id_hash(struct jabber_data *jd)
279{
280        md5_byte_t binbuf[4];
281        char *s;
282
283        md5_init(&jd->cached_id_prefix);
284        md5_append(&jd->cached_id_prefix, (unsigned char *) jd->username, strlen(jd->username));
285        md5_append(&jd->cached_id_prefix, (unsigned char *) jd->server, strlen(jd->server));
286        s = set_getstr(&jd->ic->acc->set, "resource");
287        md5_append(&jd->cached_id_prefix, (unsigned char *) s, strlen(s));
288        random_bytes(binbuf, 4);
289        md5_append(&jd->cached_id_prefix, binbuf, 4);
290}
291
292static void jabber_logout(struct im_connection *ic)
293{
294        struct jabber_data *jd = ic->proto_data;
295
296        while (jd->filetransfers) {
297                imcb_file_canceled(ic, (( struct jabber_transfer *) jd->filetransfers->data)->ft, "Logging out");
298        }
299
300        while (jd->streamhosts) {
301                jabber_streamhost_t *sh = jd->streamhosts->data;
302                jd->streamhosts = g_slist_remove(jd->streamhosts, sh);
303                g_free(sh->jid);
304                g_free(sh->host);
305                g_free(sh);
306        }
307
308        if (jd->fd >= 0) {
309                jabber_end_stream(ic);
310        }
311
312        while (ic->groupchats) {
313                jabber_chat_free(ic->groupchats->data);
314        }
315
316        if (jd->r_inpa >= 0) {
317                b_event_remove(jd->r_inpa);
318        }
319        if (jd->w_inpa >= 0) {
320                b_event_remove(jd->w_inpa);
321        }
322
323        if (jd->ssl) {
324                ssl_disconnect(jd->ssl);
325        }
326        if (jd->fd >= 0) {
327                closesocket(jd->fd);
328        }
329
330        if (jd->tx_len) {
331                g_free(jd->txq);
332        }
333
334        if (jd->node_cache) {
335                g_hash_table_destroy(jd->node_cache);
336        }
337
338        jabber_buddy_remove_all(ic);
339
340        xt_free(jd->xt);
341
342        md5_free(&jd->cached_id_prefix);
343
344        g_free(jd->oauth2_access_token);
345        g_free(jd->away_message);
346        g_free(jd->internal_jid);
347        g_free(jd->gmail_tid);
348        g_free(jd->username);
349        g_free(jd->me);
350        g_free(jd);
351
352        jabber_connections = g_slist_remove(jabber_connections, ic);
353}
354
355static int jabber_buddy_msg(struct im_connection *ic, char *who, char *message, int flags)
356{
357        struct jabber_data *jd = ic->proto_data;
358        struct jabber_buddy *bud;
359        struct xt_node *node;
360        char *s;
361        int st;
362
363        if (g_strcasecmp(who, JABBER_XMLCONSOLE_HANDLE) == 0) {
364                return jabber_write(ic, message, strlen(message));
365        }
366
367        if (g_strcasecmp(who, JABBER_OAUTH_HANDLE) == 0 &&
368            !(jd->flags & OPT_LOGGED_IN) && jd->fd == -1) {
369                if (sasl_oauth2_get_refresh_token(ic, message)) {
370                        return 1;
371                } else {
372                        imcb_error(ic, "OAuth failure");
373                        imc_logout(ic, TRUE);
374                        return 0;
375                }
376        }
377
378        if ((s = strchr(who, '=')) && jabber_chat_by_jid(ic, s + 1)) {
379                bud = jabber_buddy_by_ext_jid(ic, who, 0);
380        } else {
381                bud = jabber_buddy_by_jid(ic, who, GET_BUDDY_BARE_OK);
382        }
383
384        node = xt_new_node("body", message, NULL);
385        node = jabber_make_packet("message", "chat", bud ? bud->full_jid : who, node);
386
387        if (bud && (jd->flags & JFLAG_WANT_TYPING) &&
388            ((bud->flags & JBFLAG_DOES_XEP85) ||
389             !(bud->flags & JBFLAG_PROBED_XEP85))) {
390                struct xt_node *act;
391
392                /* If the user likes typing notification and if we don't know
393                   (and didn't probe before) if this resource supports XEP85,
394                   include a probe in this packet now. Also, if we know this
395                   buddy does support XEP85, we have to send this <active/>
396                   tag to tell that the user stopped typing (well, that's what
397                   we guess when s/he pressed Enter...). */
398                act = xt_new_node("active", NULL, NULL);
399                xt_add_attr(act, "xmlns", XMLNS_CHATSTATES);
400                xt_add_child(node, act);
401
402                /* Just make sure we do this only once. */
403                bud->flags |= JBFLAG_PROBED_XEP85;
404        }
405
406        st = jabber_write_packet(ic, node);
407        xt_free_node(node);
408
409        return st;
410}
411
412static GList *jabber_away_states(struct im_connection *ic)
413{
414        static GList *l = NULL;
415        int i;
416
417        if (l == NULL) {
418                for (i = 0; jabber_away_state_list[i].full_name; i++) {
419                        l = g_list_append(l, (void *) jabber_away_state_list[i].full_name);
420                }
421        }
422
423        return l;
424}
425
426static void jabber_get_info(struct im_connection *ic, char *who)
427{
428        struct jabber_buddy *bud;
429
430        bud = jabber_buddy_by_jid(ic, who, GET_BUDDY_FIRST);
431
432        while (bud) {
433                imcb_log(ic, "Buddy %s (%d) information:", bud->full_jid, bud->priority);
434                if (bud->away_state) {
435                        imcb_log(ic, "Away state: %s", bud->away_state->full_name);
436                }
437                imcb_log(ic, "Status message: %s", bud->away_message ? bud->away_message : "(none)");
438
439                bud = bud->next;
440        }
441
442        jabber_get_vcard(ic, who);
443}
444
445static void jabber_set_away(struct im_connection *ic, char *state_txt, char *message)
446{
447        struct jabber_data *jd = ic->proto_data;
448
449        /* state_txt == NULL -> Not away.
450           Unknown state -> fall back to the first defined away state. */
451        if (state_txt == NULL) {
452                jd->away_state = NULL;
453        } else if ((jd->away_state = jabber_away_state_by_name(state_txt)) == NULL) {
454                jd->away_state = jabber_away_state_list;
455        }
456
457        g_free(jd->away_message);
458        jd->away_message = (message && *message) ? g_strdup(message) : NULL;
459
460        presence_send_update(ic);
461}
462
463static void jabber_add_buddy(struct im_connection *ic, char *who, char *group)
464{
465        struct jabber_data *jd = ic->proto_data;
466
467        if (g_strcasecmp(who, JABBER_XMLCONSOLE_HANDLE) == 0) {
468                jd->flags |= JFLAG_XMLCONSOLE;
469                imcb_add_buddy(ic, JABBER_XMLCONSOLE_HANDLE, NULL);
470                return;
471        }
472
473        if (jabber_add_to_roster(ic, who, NULL, group)) {
474                presence_send_request(ic, who, "subscribe");
475        }
476}
477
478static void jabber_remove_buddy(struct im_connection *ic, char *who, char *group)
479{
480        struct jabber_data *jd = ic->proto_data;
481
482        if (g_strcasecmp(who, JABBER_XMLCONSOLE_HANDLE) == 0) {
483                jd->flags &= ~JFLAG_XMLCONSOLE;
484                /* Not necessary for now. And for now the code isn't too
485                   happy if the buddy is completely gone right after calling
486                   this function already.
487                imcb_remove_buddy( ic, JABBER_XMLCONSOLE_HANDLE, NULL );
488                */
489                return;
490        }
491
492        /* We should always do this part. Clean up our administration a little bit. */
493        jabber_buddy_remove_bare(ic, who);
494
495        if (jabber_remove_from_roster(ic, who)) {
496                presence_send_request(ic, who, "unsubscribe");
497        }
498}
499
500static struct groupchat *jabber_chat_join_(struct im_connection *ic, const char *room, const char *nick,
501                                           const char *password, set_t **sets)
502{
503        struct jabber_data *jd = ic->proto_data;
504        char *final_nick;
505
506        /* Ignore the passed nick parameter if we have our own default */
507        if (!(final_nick = set_getstr(sets, "nick")) &&
508            !(final_nick = set_getstr(&ic->acc->set, "display_name"))) {
509                /* Well, whatever, actually use the provided default, then */
510                final_nick = (char *) nick;
511        }
512
513        if (strchr(room, '@') == NULL) {
514                imcb_error(ic, "%s is not a valid Jabber room name. Maybe you mean %s@conference.%s?",
515                           room, room, jd->server);
516        } else if (jabber_chat_by_jid(ic, room)) {
517                imcb_error(ic, "Already present in chat `%s'", room);
518        } else {
519                return jabber_chat_join(ic, room, final_nick, set_getstr(sets, "password"));
520        }
521
522        return NULL;
523}
524
525static struct groupchat *jabber_chat_with_(struct im_connection *ic, char *who)
526{
527        return jabber_chat_with(ic, who);
528}
529
530static void jabber_chat_msg_(struct groupchat *c, char *message, int flags)
531{
532        if (c && message) {
533                jabber_chat_msg(c, message, flags);
534        }
535}
536
537static void jabber_chat_topic_(struct groupchat *c, char *topic)
538{
539        if (c && topic) {
540                jabber_chat_topic(c, topic);
541        }
542}
543
544static void jabber_chat_leave_(struct groupchat *c)
545{
546        if (c) {
547                jabber_chat_leave(c, NULL);
548        }
549}
550
551static void jabber_chat_invite_(struct groupchat *c, char *who, char *msg)
552{
553        struct jabber_data *jd = c->ic->proto_data;
554        struct jabber_chat *jc = c->data;
555        gchar *msg_alt = NULL;
556
557        if (msg == NULL) {
558                msg_alt = g_strdup_printf("%s invited you to %s", jd->me, jc->name);
559        }
560
561        if (c && who) {
562                jabber_chat_invite(c, who, msg ? msg : msg_alt);
563        }
564
565        g_free(msg_alt);
566}
567
568static void jabber_keepalive(struct im_connection *ic)
569{
570        /* Just any whitespace character is enough as a keepalive for XMPP sessions. */
571        if (!jabber_write(ic, "\n", 1)) {
572                return;
573        }
574
575        /* This runs the garbage collection every minute, which means every packet
576           is in the cache for about a minute (which should be enough AFAIK). */
577        jabber_cache_clean(ic);
578}
579
580static int jabber_send_typing(struct im_connection *ic, char *who, int typing)
581{
582        struct jabber_data *jd = ic->proto_data;
583        struct jabber_buddy *bud;
584
585        /* Enable typing notification related code from now. */
586        jd->flags |= JFLAG_WANT_TYPING;
587
588        if ((bud = jabber_buddy_by_jid(ic, who, 0)) == NULL) {
589                /* Sending typing notifications to unknown buddies is
590                   unsupported for now. Shouldn't be a problem, I think. */
591                return 0;
592        }
593
594        if (bud->flags & JBFLAG_DOES_XEP85) {
595                /* We're only allowed to send this stuff if we know the other
596                   side supports it. */
597
598                struct xt_node *node;
599                char *type;
600                int st;
601
602                if (typing & OPT_TYPING) {
603                        type = "composing";
604                } else if (typing & OPT_THINKING) {
605                        type = "paused";
606                } else {
607                        type = "active";
608                }
609
610                node = xt_new_node(type, NULL, NULL);
611                xt_add_attr(node, "xmlns", XMLNS_CHATSTATES);
612                node = jabber_make_packet("message", "chat", bud->full_jid, node);
613
614                st = jabber_write_packet(ic, node);
615                xt_free_node(node);
616
617                return st;
618        }
619
620        return 1;
621}
622
623void jabber_chat_add_settings(account_t *acc, set_t **head)
624{
625        /* Meh. Stupid room passwords. Not trying to obfuscate/hide
626           them from the user for now. */
627        set_add(head, "password", NULL, NULL, NULL);
628}
629
630void jabber_chat_free_settings(account_t *acc, set_t **head)
631{
632        set_del(head, "password");
633}
634
635GList *jabber_buddy_action_list(bee_user_t *bu)
636{
637        static GList *ret = NULL;
638
639        if (ret == NULL) {
640                static const struct buddy_action ba[2] = {
641                        { "VERSION", "Get client (version) information" },
642                };
643
644                ret = g_list_prepend(ret, (void *) ba + 0);
645        }
646
647        return ret;
648}
649
650void *jabber_buddy_action(struct bee_user *bu, const char *action, char * const args[], void *data)
651{
652        if (g_strcasecmp(action, "VERSION") == 0) {
653                struct jabber_buddy *bud;
654
655                if ((bud = jabber_buddy_by_ext_jid(bu->ic, bu->handle, 0)) == NULL) {
656                        bud = jabber_buddy_by_jid(bu->ic, bu->handle, GET_BUDDY_FIRST);
657                }
658                for (; bud; bud = bud->next) {
659                        jabber_iq_version_send(bu->ic, bud, data);
660                }
661        }
662
663        return NULL;
664}
665
666gboolean jabber_handle_is_self(struct im_connection *ic, const char *who)
667{
668        struct jabber_data *jd = ic->proto_data;
669
670        return ((g_strcasecmp(who, ic->acc->user) == 0) ||
671                (jd->internal_jid &&
672                 g_strcasecmp(who, jd->internal_jid) == 0));
673}
674
675void jabber_initmodule()
676{
677        struct prpl *ret = g_new0(struct prpl, 1);
678        struct prpl *hipchat = NULL;
679
680        ret->name = "jabber";
681        ret->mms = 0;                        /* no limit */
682        ret->login = jabber_login;
683        ret->init = jabber_init;
684        ret->logout = jabber_logout;
685        ret->buddy_msg = jabber_buddy_msg;
686        ret->away_states = jabber_away_states;
687        ret->set_away = jabber_set_away;
688//      ret->set_info = jabber_set_info;
689        ret->get_info = jabber_get_info;
690        ret->add_buddy = jabber_add_buddy;
691        ret->remove_buddy = jabber_remove_buddy;
692        ret->chat_msg = jabber_chat_msg_;
693        ret->chat_topic = jabber_chat_topic_;
694        ret->chat_invite = jabber_chat_invite_;
695        ret->chat_leave = jabber_chat_leave_;
696        ret->chat_join = jabber_chat_join_;
697        ret->chat_with = jabber_chat_with_;
698        ret->chat_add_settings = jabber_chat_add_settings;
699        ret->chat_free_settings = jabber_chat_free_settings;
700        ret->keepalive = jabber_keepalive;
701        ret->send_typing = jabber_send_typing;
702        ret->handle_cmp = g_strcasecmp;
703        ret->handle_is_self = jabber_handle_is_self;
704        ret->transfer_request = jabber_si_transfer_request;
705        ret->buddy_action_list = jabber_buddy_action_list;
706        ret->buddy_action = jabber_buddy_action;
707
708        register_protocol(ret);
709
710        /* Another one for hipchat, which has completely different logins */
711        hipchat = g_memdup(ret, sizeof(struct prpl));
712        hipchat->name = "hipchat";
713        register_protocol(hipchat);
714}
Note: See TracBrowser for help on using the repository browser.