source: protocols/jabber/jabber.c @ faeb521

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

Simplify display of gmail notifications

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