Mon, 22 Aug 2022 21:40:04 -0500
Inline pidgin_make_scrollable
We need to change it for GTK4, and there are few enough that it can be inlined. Eventually, that code might be a `.ui` anyway.
Testing Done:
Compile only.
Reviewed at https://reviews.imfreedom.org/r/1615/
| 14520 | 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ |
| 2086 | 2 | /* |
| 15884 | 3 | * purple |
| 2086 | 4 | * |
| 5 | * Copyright (C) 1998-2001, Mark Spencer <markster@marko.net> | |
| 6 | * Some code borrowed from GtkZephyr, by | |
|
7084
da83f7ead5c6
[gaim-migrate @ 7649]
Christian Hammond <chipx86@chipx86.com>
parents:
7070
diff
changeset
|
7 | * Jag/Sean Dilda <agrajag@linuxpower.org>/<smdilda@unity.ncsu.edu> |
|
da83f7ead5c6
[gaim-migrate @ 7649]
Christian Hammond <chipx86@chipx86.com>
parents:
7070
diff
changeset
|
8 | * http://gtkzephyr.linuxpower.org/ |
| 2086 | 9 | * |
| 9896 | 10 | * Some code borrowed from kzephyr, by |
| 11 | * Chris Colohan <colohan+@cs.cmu.edu> | |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30138
diff
changeset
|
12 | * |
| 2086 | 13 | * This program is free software; you can redistribute it and/or modify |
| 14 | * it under the terms of the GNU General Public License as published by | |
| 15 | * the Free Software Foundation; either version 2 of the License, or | |
| 16 | * (at your option) any later version. | |
| 17 | * | |
| 18 | * This program is distributed in the hope that it will be useful, | |
| 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 9896 | 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 2086 | 21 | * GNU General Public License for more details. |
| 22 | * | |
| 23 | * You should have received a copy of the GNU General Public License | |
| 24 | * along with this program; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19832
diff
changeset
|
25 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 2086 | 26 | * |
| 9896 | 27 | |
| 28 | */ | |
|
40439
e9838d634d5e
Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents:
40358
diff
changeset
|
29 | |
|
40441
f23c7e772667
Make sure we're not including the gettext macros in header files and deal with the repercussions of that.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
30 | #include <glib/gi18n-lib.h> |
|
f23c7e772667
Make sure we're not including the gettext macros in header files and deal with the repercussions of that.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
31 | |
|
40439
e9838d634d5e
Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents:
40358
diff
changeset
|
32 | #include <glib.h> |
|
e9838d634d5e
Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents:
40358
diff
changeset
|
33 | #include <glib/gstdio.h> |
| 2086 | 34 | |
|
40945
bbeb2e98ea5b
Use GPLUGIN_NATIVE_PLUGIN_DECLARE for all libpurple plugins and remove PURPLE_PLUGIN_INIT
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
35 | #include <gplugin.h> |
|
bbeb2e98ea5b
Use GPLUGIN_NATIVE_PLUGIN_DECLARE for all libpurple plugins and remove PURPLE_PLUGIN_INIT
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
36 | #include <gplugin-native.h> |
|
bbeb2e98ea5b
Use GPLUGIN_NATIVE_PLUGIN_DECLARE for all libpurple plugins and remove PURPLE_PLUGIN_INIT
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
37 | |
|
40358
e6fe6fc1f516
move all protocols, purple plugins, and purple tests to use purple.h instead of including files individually
Gary Kramlich <grim@reaperworld.com>
parents:
40161
diff
changeset
|
38 | #include <purple.h> |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
39 | |
| 9478 | 40 | #include "internal.h" |
|
36600
c7d2eee19333
Refactored zephyr to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
41 | #include "zephyr.h" |
|
40750
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
42 | #include "zephyr_account.h" |
|
40681
675b8605dca2
Move zephyr<->html conversion to own module
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40672
diff
changeset
|
43 | #include "zephyr_html.h" |
|
40750
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
44 | #include "zephyr_tzc.h" |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
45 | #include "zephyr_zeph02.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
46 | |
| 8560 | 47 | #define ZEPHYR_FALLBACK_CHARSET "ISO-8859-1" |
| 48 | ||
|
40439
e9838d634d5e
Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents:
40358
diff
changeset
|
49 | #define BUF_LEN (2048) |
|
e9838d634d5e
Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents:
40358
diff
changeset
|
50 | |
| 9478 | 51 | /* these are deliberately high, since most people don't send multiple "PING"s */ |
| 52 | #define ZEPHYR_TYPING_SEND_TIMEOUT 15 | |
| 53 | #define ZEPHYR_TYPING_RECV_TIMEOUT 10 | |
| 54 | ||
|
36600
c7d2eee19333
Refactored zephyr to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
55 | static PurpleProtocol *my_protocol = NULL; |
|
36663
c61b6dbc1f03
Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents:
36653
diff
changeset
|
56 | static GSList *cmds = NULL; |
|
36600
c7d2eee19333
Refactored zephyr to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
57 | |
|
40633
d884c4b6e202
Fix build with external libzephyr.
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40622
diff
changeset
|
58 | #ifdef LIBZEPHYR_EXT |
|
d884c4b6e202
Fix build with external libzephyr.
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40622
diff
changeset
|
59 | extern char __Zephyr_realm[]; |
|
d884c4b6e202
Fix build with external libzephyr.
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40622
diff
changeset
|
60 | #endif |
|
d884c4b6e202
Fix build with external libzephyr.
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40622
diff
changeset
|
61 | |
| 2086 | 62 | typedef struct _zephyr_triple zephyr_triple; |
| 63 | ||
|
40698
d06e6660b39c
zephyr_login refactoring
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40697
diff
changeset
|
64 | typedef gboolean (*ZephyrLoginFunc)(zephyr_account *zephyr); |
| 9896 | 65 | |
|
40865
82e45cd837fa
Migrate gg, novel, null, sametime, silc, and zephyr to using G_DECLARE_FINAL_TYPE for their protocol objects
Gary Kramlich <grim@reaperworld.com>
parents:
40813
diff
changeset
|
66 | struct _ZephyrProtocol { |
|
82e45cd837fa
Migrate gg, novel, null, sametime, silc, and zephyr to using G_DECLARE_FINAL_TYPE for their protocol objects
Gary Kramlich <grim@reaperworld.com>
parents:
40813
diff
changeset
|
67 | PurpleProtocol parent; |
|
82e45cd837fa
Migrate gg, novel, null, sametime, silc, and zephyr to using G_DECLARE_FINAL_TYPE for their protocol objects
Gary Kramlich <grim@reaperworld.com>
parents:
40813
diff
changeset
|
68 | }; |
|
82e45cd837fa
Migrate gg, novel, null, sametime, silc, and zephyr to using G_DECLARE_FINAL_TYPE for their protocol objects
Gary Kramlich <grim@reaperworld.com>
parents:
40813
diff
changeset
|
69 | |
| 2086 | 70 | struct _zephyr_triple { |
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
71 | ZSubscription_t sub; |
| 2086 | 72 | char *name; |
| 73 | gboolean open; | |
| 74 | int id; | |
| 75 | }; | |
| 76 | ||
| 10867 | 77 | #ifdef WIN32 |
| 78 | extern const char *username; | |
| 79 | #endif | |
| 9896 | 80 | |
|
40715
206563c8b5c6
zephyr_tzc_escape_msg and zephyr_tzc_deescape_str refactoring
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40708
diff
changeset
|
81 | static void zephyr_chat_set_topic(PurpleConnection *gc, int id, const char *topic); |
|
40702
d036174d9e22
zephyr_subscribe_to refactoring
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40701
diff
changeset
|
82 | |
|
40662
80764d18e588
zephyr_login cleanups
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40661
diff
changeset
|
83 | static char * |
|
80764d18e588
zephyr_login cleanups
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40661
diff
changeset
|
84 | zephyr_strip_local_realm(const zephyr_account *zephyr, const char *user) |
|
80764d18e588
zephyr_login cleanups
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40661
diff
changeset
|
85 | { |
| 9896 | 86 | /* |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30138
diff
changeset
|
87 | Takes in a username of the form username or username@realm |
| 9896 | 88 | and returns: |
| 89 | username, if there is no realm, or the realm is the local realm | |
| 90 | or: | |
| 91 | username@realm if there is a realm and it is foreign | |
| 92 | */ | |
|
40635
1f8b5b68a806
Some zephyr cleanups
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40634
diff
changeset
|
93 | char *at = strchr(user, '@'); |
| 9896 | 94 | if (at && !g_ascii_strcasecmp(at+1,zephyr->realm)) { |
| 9328 | 95 | /* We're passed in a username of the form user@users-realm */ |
|
40635
1f8b5b68a806
Some zephyr cleanups
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40634
diff
changeset
|
96 | return g_strndup(user, at - user); |
| 9328 | 97 | } |
| 98 | else { | |
| 99 | /* We're passed in a username of the form user or user@foreign-realm */ | |
|
40635
1f8b5b68a806
Some zephyr cleanups
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40634
diff
changeset
|
100 | return g_strdup(user); |
| 9328 | 101 | } |
| 102 | } | |
| 2086 | 103 | |
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
104 | static zephyr_triple * |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
105 | zephyr_triple_new(zephyr_account *zephyr, const ZSubscription_t *sub) |
| 2086 | 106 | { |
| 107 | zephyr_triple *zt; | |
|
8644
ba37f1cc0006
[gaim-migrate @ 9396]
Mark Doliner <markdoliner@pidgin.im>
parents:
8641
diff
changeset
|
108 | |
| 2086 | 109 | zt = g_new0(zephyr_triple, 1); |
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
110 | zt->sub.zsub_class = g_strdup(sub->zsub_class); |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
111 | zt->sub.zsub_classinst = g_strdup(sub->zsub_classinst); |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
112 | zt->sub.zsub_recipient = g_strdup(sub->zsub_recipient); |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
113 | zt->name = g_strdup_printf("%s,%s,%s", sub->zsub_class, |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
114 | sub->zsub_classinst ? sub->zsub_classinst : "", |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
115 | sub->zsub_recipient ? sub->zsub_recipient : ""); |
| 9610 | 116 | zt->id = ++(zephyr->last_id); |
| 2086 | 117 | zt->open = FALSE; |
| 118 | return zt; | |
| 119 | } | |
| 120 | ||
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
121 | static void |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
122 | zephyr_triple_free(zephyr_triple *zt) |
| 2086 | 123 | { |
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
124 | g_free(zt->sub.zsub_class); |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
125 | g_free(zt->sub.zsub_classinst); |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
126 | g_free(zt->sub.zsub_recipient); |
| 2086 | 127 | g_free(zt->name); |
| 128 | g_free(zt); | |
| 129 | } | |
| 130 | ||
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
131 | /* returns 0 if sub is a subset of zt.sub. This function is used to |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
132 | determine whether a zephyr sent to sub should be placed in the chat |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
133 | with triple zt.sub |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
134 | |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
135 | sub is a subset of zt.sub |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30138
diff
changeset
|
136 | iff. the classnames are identical ignoring case |
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
137 | AND. the instance names are identical (ignoring case), or zt.sub->instance is *. |
| 9328 | 138 | AND. the recipient names are identical |
| 139 | */ | |
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
140 | static gint |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
141 | zephyr_triple_subset(const zephyr_triple *zt, const ZSubscription_t *sub) |
| 2086 | 142 | { |
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
143 | if (!sub->zsub_class) { |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
144 | purple_debug_error("zephyr", "sub1c doesn't exist\n"); |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
145 | return 1; |
|
13454
10592212bb27
[gaim-migrate @ 15828]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
13297
diff
changeset
|
146 | } |
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
147 | if (!sub->zsub_classinst) { |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
148 | purple_debug_error("zephyr", "sub1i doesn't exist\n"); |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
149 | return 1; |
|
13454
10592212bb27
[gaim-migrate @ 15828]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
13297
diff
changeset
|
150 | } |
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
151 | if (!sub->zsub_recipient) { |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
152 | purple_debug_error("zephyr", "sub1r doesn't exist\n"); |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
153 | return 1; |
|
13454
10592212bb27
[gaim-migrate @ 15828]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
13297
diff
changeset
|
154 | } |
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
155 | if (!zt->sub.zsub_class) { |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
156 | purple_debug_error("zephyr", "sub2c doesn't exist\n"); |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
157 | return 1; |
|
13454
10592212bb27
[gaim-migrate @ 15828]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
13297
diff
changeset
|
158 | } |
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
159 | if (!zt->sub.zsub_classinst) { |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
160 | purple_debug_error("zephyr", "sub2i doesn't exist\n"); |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
161 | return 1; |
| 2086 | 162 | } |
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
163 | if (!zt->sub.zsub_recipient) { |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
164 | purple_debug_error("zephyr", "sub2r doesn't exist\n"); |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
165 | return 1; |
| 2086 | 166 | } |
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
167 | |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
168 | if (g_ascii_strcasecmp(zt->sub.zsub_class, sub->zsub_class)) { |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
169 | return 1; |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
170 | } |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
171 | if (g_ascii_strcasecmp(zt->sub.zsub_classinst, sub->zsub_classinst) && g_ascii_strcasecmp(zt->sub.zsub_classinst, "*")) { |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
172 | return 1; |
| 2086 | 173 | } |
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
174 | if (g_ascii_strcasecmp(zt->sub.zsub_recipient, sub->zsub_recipient)) { |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
175 | return 1; |
| 2086 | 176 | } |
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
177 | purple_debug_info("zephyr", "<%s,%s,%s> is in <%s,%s,%s>\n", |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
178 | sub->zsub_class, sub->zsub_classinst, sub->zsub_recipient, |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
179 | zt->sub.zsub_class, zt->sub.zsub_classinst, zt->sub.zsub_recipient); |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
180 | return 0; |
| 2086 | 181 | } |
| 182 | ||
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30138
diff
changeset
|
183 | /* |
| 9434 | 184 | Converts strings to utf-8 if necessary using user specified encoding |
| 9328 | 185 | */ |
| 186 | ||
|
40750
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
187 | static gchar * |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
188 | convert_to_utf8(const gchar *string, const gchar *from_encoding) |
| 8560 | 189 | { |
| 190 | gchar *utf8; | |
| 191 | GError *err = NULL; | |
|
40750
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
192 | |
| 24808 | 193 | if (g_utf8_validate(string, -1, NULL)) { |
|
8568
66907b37ce85
[gaim-migrate @ 9316]
Mark Doliner <markdoliner@pidgin.im>
parents:
8562
diff
changeset
|
194 | return g_strdup(string); |
|
40750
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
195 | } |
|
8568
66907b37ce85
[gaim-migrate @ 9316]
Mark Doliner <markdoliner@pidgin.im>
parents:
8562
diff
changeset
|
196 | |
|
40750
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
197 | utf8 = g_convert(string, -1, "UTF-8", from_encoding, NULL, NULL, &err); |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
198 | if (err) { |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
199 | purple_debug_error("zephyr", "recv conversion error: %s\n", err->message); |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
200 | utf8 = g_strdup(_("(There was an error converting this message. Check the 'Encoding' option in the Account Editor)")); |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
201 | g_error_free(err); |
|
8568
66907b37ce85
[gaim-migrate @ 9316]
Mark Doliner <markdoliner@pidgin.im>
parents:
8562
diff
changeset
|
202 | } |
|
40750
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
203 | |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
204 | return utf8; |
| 8560 | 205 | } |
| 206 | ||
|
40778
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
207 | static gboolean |
|
40750
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
208 | pending_zloc(zephyr_account *zephyr, const char *who) |
| 2086 | 209 | { |
| 210 | GList *curr; | |
|
40750
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
211 | char* normalized_who = zephyr_normalize_local_realm(zephyr, who); |
|
40043
90446617d967
Use GList functions instead of manual iterations
qarkai <qarkai@gmail.com>
parents:
39970
diff
changeset
|
212 | |
|
90446617d967
Use GList functions instead of manual iterations
qarkai <qarkai@gmail.com>
parents:
39970
diff
changeset
|
213 | curr = g_list_find_custom(zephyr->pending_zloc_names, normalized_who, (GCompareFunc)g_ascii_strcasecmp); |
| 40045 | 214 | g_free(normalized_who); |
|
40043
90446617d967
Use GList functions instead of manual iterations
qarkai <qarkai@gmail.com>
parents:
39970
diff
changeset
|
215 | if (curr == NULL) |
|
90446617d967
Use GList functions instead of manual iterations
qarkai <qarkai@gmail.com>
parents:
39970
diff
changeset
|
216 | return FALSE; |
|
90446617d967
Use GList functions instead of manual iterations
qarkai <qarkai@gmail.com>
parents:
39970
diff
changeset
|
217 | |
|
90446617d967
Use GList functions instead of manual iterations
qarkai <qarkai@gmail.com>
parents:
39970
diff
changeset
|
218 | g_free((char *)curr->data); |
|
90446617d967
Use GList functions instead of manual iterations
qarkai <qarkai@gmail.com>
parents:
39970
diff
changeset
|
219 | zephyr->pending_zloc_names = g_list_delete_link(zephyr->pending_zloc_names, curr); |
|
90446617d967
Use GList functions instead of manual iterations
qarkai <qarkai@gmail.com>
parents:
39970
diff
changeset
|
220 | return TRUE; |
| 2086 | 221 | } |
| 222 | ||
|
40778
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
223 | static PurpleBuddy * |
|
40672
9375289dfc32
Reduce some code duplication
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40662
diff
changeset
|
224 | find_buddy(const zephyr_account *zephyr, const char *user) |
|
9375289dfc32
Reduce some code duplication
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40662
diff
changeset
|
225 | { |
|
9375289dfc32
Reduce some code duplication
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40662
diff
changeset
|
226 | PurpleBuddy *buddy = purple_blist_find_buddy(zephyr->account, user); |
|
9375289dfc32
Reduce some code duplication
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40662
diff
changeset
|
227 | |
|
9375289dfc32
Reduce some code duplication
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40662
diff
changeset
|
228 | if (buddy == NULL) { |
|
9375289dfc32
Reduce some code duplication
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40662
diff
changeset
|
229 | char *stripped_user = zephyr_strip_local_realm(zephyr, user); |
|
9375289dfc32
Reduce some code duplication
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40662
diff
changeset
|
230 | buddy = purple_blist_find_buddy(zephyr->account, stripped_user); |
|
9375289dfc32
Reduce some code duplication
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40662
diff
changeset
|
231 | g_free(stripped_user); |
|
9375289dfc32
Reduce some code duplication
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40662
diff
changeset
|
232 | } |
|
9375289dfc32
Reduce some code duplication
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40662
diff
changeset
|
233 | |
|
9375289dfc32
Reduce some code duplication
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40662
diff
changeset
|
234 | return buddy; |
|
9375289dfc32
Reduce some code duplication
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40662
diff
changeset
|
235 | } |
|
9375289dfc32
Reduce some code duplication
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40662
diff
changeset
|
236 | |
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
237 | static void |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
238 | zephyr_triple_open(zephyr_triple *zt, PurpleConnection *gc, const char *instance) |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
239 | { |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
240 | zt->open = TRUE; |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
241 | purple_serv_got_joined_chat(gc, zt->id, zt->name); |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
242 | zephyr_chat_set_topic(gc, zt->id, instance); |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
243 | } |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
244 | |
|
40750
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
245 | void |
|
40778
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
246 | handle_message(PurpleConnection *gc, ZNotice_t *notice) |
| 2086 | 247 | { |
|
32265
8007f413c665
Convert zephyr prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
248 | zephyr_account* zephyr = purple_connection_get_protocol_data(gc); |
| 9896 | 249 | |
|
40778
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
250 | if (!g_ascii_strcasecmp(notice->z_class, LOGIN_CLASS)) { |
| 3277 | 251 | /* well, we'll be updating in 20 seconds anyway, might as well ignore this. */ |
|
40778
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
252 | } else if (!g_ascii_strcasecmp(notice->z_class, LOCATE_CLASS)) { |
|
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
253 | if (!g_ascii_strcasecmp(notice->z_opcode, LOCATE_LOCATE)) { |
| 2086 | 254 | int nlocs; |
| 255 | char *user; | |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23352
diff
changeset
|
256 | |
| 9478 | 257 | /* XXX add real error reporting */ |
|
40778
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
258 | if (ZParseLocations(notice, NULL, &nlocs, &user) != ZERR_NONE) |
| 2086 | 259 | return; |
| 8435 | 260 | |
|
40778
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
261 | handle_locations(gc, user, nlocs, NULL); |
| 9434 | 262 | g_free(user); |
| 2086 | 263 | } |
| 264 | } else { | |
|
40750
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
265 | char *buf; |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30138
diff
changeset
|
266 | int len; |
|
24807
699a4dc72c49
A Warmenhoved patch from rwbarton to avoid showing the default instance
Richard Laager <rlaager@pidgin.im>
parents:
24806
diff
changeset
|
267 | char *stripped_sender; |
|
40778
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
268 | int signature_length = strlen(notice->z_message); |
| 8560 | 269 | |
| 9478 | 270 | /* Need to deal with 0 length messages to handle typing notification (OPCODE) ping messages */ |
| 15884 | 271 | /* One field zephyrs would have caused purple to crash */ |
|
40778
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
272 | if ((notice->z_message_len == 0) || (notice->z_message_len <= (signature_length + 1))) { |
| 9478 | 273 | len = 0; |
|
40750
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
274 | buf = g_strdup(""); |
| 9478 | 275 | } else { |
|
40750
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
276 | char *tmpbuf; |
|
40778
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
277 | char *ptr = (char *) notice->z_message + (signature_length + 1); |
|
40750
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
278 | gchar *tmpescape; |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
279 | |
|
40778
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
280 | len = notice->z_message_len - (signature_length + 1); |
|
40750
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
281 | tmpbuf = g_malloc(len + 1); |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
282 | g_snprintf(tmpbuf, len + 1, "%s", ptr); |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
283 | g_strchomp(tmpbuf); |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
284 | tmpescape = g_markup_escape_text(tmpbuf, -1); |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
285 | g_free(tmpbuf); |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
286 | tmpbuf = zephyr_to_html(tmpescape); |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
287 | buf = convert_to_utf8(tmpbuf, zephyr->encoding); |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
288 | g_free(tmpbuf); |
|
8644
ba37f1cc0006
[gaim-migrate @ 9396]
Mark Doliner <markdoliner@pidgin.im>
parents:
8641
diff
changeset
|
289 | g_free(tmpescape); |
| 9478 | 290 | } |
|
40778
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
291 | purple_debug_info("zephyr", "message_size %d %d %d", len, notice->z_message_len, signature_length); |
|
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
292 | |
|
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
293 | stripped_sender = zephyr_strip_local_realm(zephyr, notice->z_sender); |
|
8644
ba37f1cc0006
[gaim-migrate @ 9396]
Mark Doliner <markdoliner@pidgin.im>
parents:
8641
diff
changeset
|
294 | |
|
40778
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
295 | if (!g_ascii_strcasecmp(notice->z_class, "MESSAGE") && |
|
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
296 | !g_ascii_strcasecmp(notice->z_class_inst, "PERSONAL") && |
|
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
297 | !g_ascii_strcasecmp(notice->z_recipient, zephyr->username)) { |
|
40750
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
298 | PurpleMessageFlags flags = 0; |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
299 | |
|
40778
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
300 | if (!g_ascii_strcasecmp(notice->z_message, "Automated reply:")) |
| 15884 | 301 | flags |= PURPLE_MESSAGE_AUTO_RESP; |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30138
diff
changeset
|
302 | |
|
40778
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
303 | if (!g_ascii_strcasecmp(notice->z_opcode, "PING")) |
|
35499
c4c5e0a670b1
Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents:
35005
diff
changeset
|
304 | purple_serv_got_typing(gc,stripped_sender,ZEPHYR_TYPING_RECV_TIMEOUT, PURPLE_IM_TYPING); |
|
22391
823ac1e9cfbb
Get rid of some privacy checking code from zephyr that is done in
Mark Doliner <markdoliner@pidgin.im>
parents:
22389
diff
changeset
|
305 | else |
|
40750
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
306 | purple_serv_got_im(gc, stripped_sender, buf, flags, time(NULL)); |
| 9896 | 307 | |
| 308 | } else { | |
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
309 | ZSubscription_t sub = { |
|
40778
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
310 | .zsub_class = notice->z_class, |
|
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
311 | .zsub_classinst = (gchar *)notice->z_class_inst, |
|
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
312 | .zsub_recipient = (gchar *)notice->z_recipient |
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
313 | }; |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
314 | zephyr_triple *zt; |
| 9896 | 315 | gchar *send_inst_utf8; |
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
316 | GSList *l = g_slist_find_custom(zephyr->subscrips, &sub, (GCompareFunc)zephyr_triple_subset); |
|
40885
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40865
diff
changeset
|
317 | PurpleConversation *gcc; |
|
40997
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40985
diff
changeset
|
318 | PurpleConversationManager *manager; |
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
319 | |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
320 | if (!l) { |
| 9896 | 321 | /* This is a server supplied subscription */ |
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
322 | zt = zephyr_triple_new(zephyr, &sub); |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
323 | zephyr->subscrips = g_slist_append(zephyr->subscrips, zt); |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
324 | } else { |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
325 | zt = l->data; |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30138
diff
changeset
|
326 | } |
|
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30138
diff
changeset
|
327 | |
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
328 | if (!zt->open) { |
|
40778
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
329 | zephyr_triple_open(zt, gc, notice->z_class_inst); |
| 9896 | 330 | } |
|
24807
699a4dc72c49
A Warmenhoved patch from rwbarton to avoid showing the default instance
Richard Laager <rlaager@pidgin.im>
parents:
24806
diff
changeset
|
331 | |
|
40778
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
332 | if (!g_ascii_strcasecmp(notice->z_class_inst, "PERSONAL")) |
|
24807
699a4dc72c49
A Warmenhoved patch from rwbarton to avoid showing the default instance
Richard Laager <rlaager@pidgin.im>
parents:
24806
diff
changeset
|
333 | send_inst_utf8 = g_strdup(stripped_sender); |
|
699a4dc72c49
A Warmenhoved patch from rwbarton to avoid showing the default instance
Richard Laager <rlaager@pidgin.im>
parents:
24806
diff
changeset
|
334 | else { |
|
40778
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
335 | char *send_inst = g_strdup_printf("[%s] %s", notice->z_class_inst, stripped_sender); |
|
40750
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
336 | send_inst_utf8 = convert_to_utf8(send_inst, zephyr->encoding); |
|
24807
699a4dc72c49
A Warmenhoved patch from rwbarton to avoid showing the default instance
Richard Laager <rlaager@pidgin.im>
parents:
24806
diff
changeset
|
337 | g_free(send_inst); |
|
699a4dc72c49
A Warmenhoved patch from rwbarton to avoid showing the default instance
Richard Laager <rlaager@pidgin.im>
parents:
24806
diff
changeset
|
338 | if (!send_inst_utf8) { |
|
699a4dc72c49
A Warmenhoved patch from rwbarton to avoid showing the default instance
Richard Laager <rlaager@pidgin.im>
parents:
24806
diff
changeset
|
339 | purple_debug_error("zephyr","Failed to convert instance for sender %s.\n", stripped_sender); |
|
699a4dc72c49
A Warmenhoved patch from rwbarton to avoid showing the default instance
Richard Laager <rlaager@pidgin.im>
parents:
24806
diff
changeset
|
340 | send_inst_utf8 = g_strdup(stripped_sender); |
|
699a4dc72c49
A Warmenhoved patch from rwbarton to avoid showing the default instance
Richard Laager <rlaager@pidgin.im>
parents:
24806
diff
changeset
|
341 | } |
| 2086 | 342 | } |
| 9912 | 343 | |
|
40997
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40985
diff
changeset
|
344 | manager = purple_conversation_manager_get_default(); |
|
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40985
diff
changeset
|
345 | gcc = purple_conversation_manager_find_chat(manager, |
|
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40985
diff
changeset
|
346 | purple_connection_get_account(gc), |
|
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40985
diff
changeset
|
347 | zt->name); |
|
40885
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40865
diff
changeset
|
348 | if (!purple_chat_conversation_has_user(PURPLE_CHAT_CONVERSATION(gcc), stripped_sender)) { |
|
40643
1c9bdf8d3e85
Convert zephyr to gio
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40635
diff
changeset
|
349 | GInetAddress *inet_addr = NULL; |
|
1c9bdf8d3e85
Convert zephyr to gio
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40635
diff
changeset
|
350 | gchar *ipaddr = NULL; |
|
1c9bdf8d3e85
Convert zephyr to gio
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40635
diff
changeset
|
351 | |
|
1c9bdf8d3e85
Convert zephyr to gio
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40635
diff
changeset
|
352 | inet_addr = g_inet_address_new_from_bytes( |
|
40778
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
353 | (const guint8 *)¬ice->z_sender_addr, |
|
40643
1c9bdf8d3e85
Convert zephyr to gio
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40635
diff
changeset
|
354 | G_SOCKET_FAMILY_IPV4); |
|
1c9bdf8d3e85
Convert zephyr to gio
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40635
diff
changeset
|
355 | ipaddr = g_inet_address_to_string(inet_addr); |
|
40885
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40865
diff
changeset
|
356 | purple_chat_conversation_add_user(PURPLE_CHAT_CONVERSATION(gcc), |
|
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40865
diff
changeset
|
357 | stripped_sender, ipaddr, |
|
40643
1c9bdf8d3e85
Convert zephyr to gio
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40635
diff
changeset
|
358 | PURPLE_CHAT_USER_NONE, TRUE); |
|
1c9bdf8d3e85
Convert zephyr to gio
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40635
diff
changeset
|
359 | g_free(ipaddr); |
|
1c9bdf8d3e85
Convert zephyr to gio
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40635
diff
changeset
|
360 | g_object_unref(inet_addr); |
| 9896 | 361 | } |
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
362 | purple_serv_got_chat_in(gc, zt->id, send_inst_utf8, |
|
40750
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
363 | PURPLE_MESSAGE_RECV, buf, time(NULL)); |
| 9896 | 364 | g_free(send_inst_utf8); |
| 365 | } | |
|
24807
699a4dc72c49
A Warmenhoved patch from rwbarton to avoid showing the default instance
Richard Laager <rlaager@pidgin.im>
parents:
24806
diff
changeset
|
366 | g_free(stripped_sender); |
|
40750
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
367 | g_free(buf); |
| 9896 | 368 | } |
| 369 | } | |
| 370 | ||
|
40778
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
371 | void |
|
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
372 | handle_locations(PurpleConnection *gc, const gchar *user, int nlocs, const ZLocations_t *zloc) |
|
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
373 | { |
|
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
374 | zephyr_account *zephyr = purple_connection_get_protocol_data(gc); |
|
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
375 | PurpleBuddy *b; |
|
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
376 | const char *bname; |
|
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
377 | const gchar *name; |
|
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
378 | |
|
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
379 | b = find_buddy(zephyr, user); |
|
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
380 | bname = b ? purple_buddy_get_name(b) : NULL; |
|
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
381 | name = b ? bname : user; |
|
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
382 | if ((b && pending_zloc(zephyr, bname)) || pending_zloc(zephyr, user)) { |
|
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
383 | PurpleNotifyUserInfo *user_info = purple_notify_user_info_new(); |
|
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
384 | const char *balias; |
|
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
385 | |
|
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
386 | /* TODO: Check whether it's correct to call add_pair_html, |
|
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
387 | or if we should be using add_pair_plaintext */ |
|
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
388 | purple_notify_user_info_add_pair_html(user_info, _("User"), name); |
|
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
389 | |
|
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
390 | balias = b ? purple_buddy_get_local_alias(b) : NULL; |
|
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
391 | if (balias) |
|
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
392 | purple_notify_user_info_add_pair_plaintext(user_info, _("Alias"), balias); |
|
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
393 | |
|
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
394 | if (!nlocs) { |
|
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
395 | purple_notify_user_info_add_pair_plaintext(user_info, NULL, _("Hidden or not logged-in")); |
|
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
396 | } |
|
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
397 | for (; nlocs > 0; nlocs--) { |
|
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
398 | ZLocations_t locs; |
|
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
399 | char *tmp; |
|
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
400 | |
|
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
401 | if (!zloc) { |
|
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
402 | /* XXX add real error reporting */ |
|
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
403 | int one = 1; |
|
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
404 | |
|
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
405 | ZGetLocations(&locs, &one); |
|
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
406 | } else { |
|
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
407 | locs = *zloc; |
|
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
408 | } |
|
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
409 | |
|
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
410 | /* TODO: Need to escape locs.host and locs.time? */ |
|
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
411 | tmp = g_strdup_printf(_("<br>At %s since %s"), locs.host, locs.time); |
|
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
412 | purple_notify_user_info_add_pair_html(user_info, _("Location"), tmp); |
|
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
413 | g_free(tmp); |
|
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
414 | } |
|
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
415 | purple_notify_userinfo(gc, name, user_info, NULL, NULL); |
|
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
416 | purple_notify_user_info_destroy(user_info); |
|
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
417 | } else { |
|
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
418 | purple_protocol_got_user_status(zephyr->account, name, (nlocs > 0) ? "available" : "offline", NULL); |
|
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
419 | } |
|
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
420 | } |
|
507a61f2194a
zephyr: handle_message cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40753
diff
changeset
|
421 | |
|
40750
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
422 | static void |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
423 | check_loc_buddy(PurpleBuddy *buddy, zephyr_account *zephyr) |
|
40686
fa1a8ad13da4
Use GNode instead of parse_tree
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40681
diff
changeset
|
424 | { |
|
40750
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
425 | const char *bname = purple_buddy_get_name(buddy); |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
426 | char *chk = zephyr_normalize_local_realm(zephyr, bname); |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
427 | #ifdef WIN32 |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
428 | int numlocs; |
| 9896 | 429 | |
|
40750
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
430 | ZLocateUser(chk, &numlocs, ZAUTH); |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
431 | for (int i = 0; i < numlocs; i++) { |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
432 | ZLocations_t locations; |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
433 | int one = 1; |
| 9896 | 434 | |
|
40750
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
435 | ZGetLocations(&locations, &one); |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
436 | serv_got_update(zgc, bname, 1, 0, 0, 0, 0); |
|
40646
a8d60f091a56
Use read_from_tzc in zephyr_login
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40643
diff
changeset
|
437 | } |
|
40750
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
438 | #else |
|
24950
143f594f0cd0
Alias foo. I think blist.h structs are now completely hidden.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24945
diff
changeset
|
439 | |
|
40750
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
440 | purple_debug_info("zephyr", "chk: %s, bname: %s", chk, bname); |
| 9478 | 441 | /* XXX add real error reporting */ |
|
40750
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
442 | /* doesn't matter if this fails or not; we'll just move on to the next one */ |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
443 | zephyr->request_locations(zephyr, chk); |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
444 | #endif /* WIN32 */ |
| 2086 | 445 | |
|
40750
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
446 | g_free(chk); |
| 2086 | 447 | } |
| 448 | ||
|
40635
1f8b5b68a806
Some zephyr cleanups
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40634
diff
changeset
|
449 | static gboolean |
|
40750
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
450 | check_loc(gpointer data) |
|
40739
f391d9d9352d
Split zephyr_request_locations
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40737
diff
changeset
|
451 | { |
|
40750
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
452 | zephyr_account *zephyr = (zephyr_account *)data; |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
453 | GSList *buddies = purple_blist_find_buddies(zephyr->account, NULL); |
| 10867 | 454 | |
|
40750
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
455 | g_slist_foreach(buddies, (GFunc)check_loc_buddy, zephyr); |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
456 | g_slist_free(buddies); |
| 10867 | 457 | |
|
40750
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
458 | return G_SOURCE_CONTINUE; |
| 2086 | 459 | } |
| 460 | ||
|
39831
c7e0d1617aae
zephyr: Fix const-ness of variable loading.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
461 | static const gchar * |
|
c7e0d1617aae
zephyr: Fix const-ness of variable loading.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
462 | get_exposure_level(void) |
| 2086 | 463 | { |
| 9478 | 464 | /* XXX add real error reporting */ |
|
39831
c7e0d1617aae
zephyr: Fix const-ness of variable loading.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
465 | const gchar *exposure = ZGetVariable("exposure"); |
| 2086 | 466 | |
|
40635
1f8b5b68a806
Some zephyr cleanups
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40634
diff
changeset
|
467 | if (exposure) { |
|
1f8b5b68a806
Some zephyr cleanups
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40634
diff
changeset
|
468 | if (!g_ascii_strcasecmp(exposure, EXPOSE_NONE)) { |
|
1f8b5b68a806
Some zephyr cleanups
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40634
diff
changeset
|
469 | return EXPOSE_NONE; |
|
1f8b5b68a806
Some zephyr cleanups
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40634
diff
changeset
|
470 | } |
|
1f8b5b68a806
Some zephyr cleanups
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40634
diff
changeset
|
471 | if (!g_ascii_strcasecmp(exposure, EXPOSE_OPSTAFF)) { |
|
1f8b5b68a806
Some zephyr cleanups
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40634
diff
changeset
|
472 | return EXPOSE_OPSTAFF; |
|
1f8b5b68a806
Some zephyr cleanups
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40634
diff
changeset
|
473 | } |
|
1f8b5b68a806
Some zephyr cleanups
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40634
diff
changeset
|
474 | if (!g_ascii_strcasecmp(exposure, EXPOSE_REALMANN)) { |
|
1f8b5b68a806
Some zephyr cleanups
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40634
diff
changeset
|
475 | return EXPOSE_REALMANN; |
|
1f8b5b68a806
Some zephyr cleanups
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40634
diff
changeset
|
476 | } |
|
1f8b5b68a806
Some zephyr cleanups
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40634
diff
changeset
|
477 | if (!g_ascii_strcasecmp(exposure, EXPOSE_NETVIS)) { |
|
1f8b5b68a806
Some zephyr cleanups
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40634
diff
changeset
|
478 | return EXPOSE_NETVIS; |
|
1f8b5b68a806
Some zephyr cleanups
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40634
diff
changeset
|
479 | } |
|
1f8b5b68a806
Some zephyr cleanups
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40634
diff
changeset
|
480 | if (!g_ascii_strcasecmp(exposure, EXPOSE_NETANN)) { |
|
1f8b5b68a806
Some zephyr cleanups
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40634
diff
changeset
|
481 | return EXPOSE_NETANN; |
|
1f8b5b68a806
Some zephyr cleanups
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40634
diff
changeset
|
482 | } |
|
1f8b5b68a806
Some zephyr cleanups
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40634
diff
changeset
|
483 | } |
| 2086 | 484 | return EXPOSE_REALMVIS; |
| 485 | } | |
| 486 | ||
| 487 | static void strip_comments(char *str) | |
| 488 | { | |
| 489 | char *tmp = strchr(str, '#'); | |
|
8644
ba37f1cc0006
[gaim-migrate @ 9396]
Mark Doliner <markdoliner@pidgin.im>
parents:
8641
diff
changeset
|
490 | |
| 2086 | 491 | if (tmp) |
| 492 | *tmp = '\0'; | |
| 493 | g_strchug(str); | |
| 494 | g_strchomp(str); | |
| 495 | } | |
| 496 | ||
| 9896 | 497 | static void zephyr_inithosts(zephyr_account *zephyr) |
| 9478 | 498 | { |
| 499 | /* XXX This code may not be Win32 clean */ | |
| 500 | struct hostent *hent; | |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30138
diff
changeset
|
501 | |
|
40809
691bd780ab06
Replace gethostname by g_get_host_name
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40800
diff
changeset
|
502 | zephyr->ourhost = g_strdup(g_get_host_name()); |
|
691bd780ab06
Replace gethostname by g_get_host_name
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40800
diff
changeset
|
503 | if (!(hent = gethostbyname(zephyr->ourhost))) { |
|
691bd780ab06
Replace gethostname by g_get_host_name
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40800
diff
changeset
|
504 | purple_debug_error("zephyr", |
|
691bd780ab06
Replace gethostname by g_get_host_name
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40800
diff
changeset
|
505 | "unable to resolve hostname, %%canon%% will be " |
|
691bd780ab06
Replace gethostname by g_get_host_name
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40800
diff
changeset
|
506 | "wrong in subscriptions and has been set to the " |
|
691bd780ab06
Replace gethostname by g_get_host_name
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40800
diff
changeset
|
507 | "value of %%host%%, %s", |
|
691bd780ab06
Replace gethostname by g_get_host_name
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40800
diff
changeset
|
508 | zephyr->ourhost); |
|
691bd780ab06
Replace gethostname by g_get_host_name
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40800
diff
changeset
|
509 | zephyr->ourhostcanon = g_strdup(zephyr->ourhost); |
| 9478 | 510 | return; |
| 511 | } | |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30138
diff
changeset
|
512 | |
|
40809
691bd780ab06
Replace gethostname by g_get_host_name
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40800
diff
changeset
|
513 | zephyr->ourhostcanon = g_strdup(hent->h_name); |
| 9478 | 514 | } |
| 515 | ||
| 9610 | 516 | static void process_zsubs(zephyr_account *zephyr) |
| 2086 | 517 | { |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30138
diff
changeset
|
518 | /* Loads zephyr chats "(subscriptions) from ~/.zephyr.subs, and |
|
9802
5de715c25c22
[gaim-migrate @ 10670]
Mark Doliner <markdoliner@pidgin.im>
parents:
9797
diff
changeset
|
519 | registers (subscribes to) them on the server */ |
| 9434 | 520 | |
|
9802
5de715c25c22
[gaim-migrate @ 10670]
Mark Doliner <markdoliner@pidgin.im>
parents:
9797
diff
changeset
|
521 | /* XXX deal with unsubscriptions */ |
|
5de715c25c22
[gaim-migrate @ 10670]
Mark Doliner <markdoliner@pidgin.im>
parents:
9797
diff
changeset
|
522 | /* XXX deal with punts */ |
| 9434 | 523 | |
| 2086 | 524 | FILE *f; |
| 525 | gchar *fname; | |
| 526 | gchar buff[BUFSIZ]; | |
|
8644
ba37f1cc0006
[gaim-migrate @ 9396]
Mark Doliner <markdoliner@pidgin.im>
parents:
8641
diff
changeset
|
527 | |
| 15884 | 528 | fname = g_strdup_printf("%s/.zephyr.subs", purple_home_dir()); |
|
10589
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10401
diff
changeset
|
529 | f = g_fopen(fname, "r"); |
| 2086 | 530 | if (f) { |
| 531 | char **triple; | |
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
532 | ZSubscription_t sub; |
|
8644
ba37f1cc0006
[gaim-migrate @ 9396]
Mark Doliner <markdoliner@pidgin.im>
parents:
8641
diff
changeset
|
533 | |
| 2086 | 534 | while (fgets(buff, BUFSIZ, f)) { |
| 535 | strip_comments(buff); | |
| 536 | if (buff[0]) { | |
| 537 | triple = g_strsplit(buff, ",", 3); | |
|
8644
ba37f1cc0006
[gaim-migrate @ 9396]
Mark Doliner <markdoliner@pidgin.im>
parents:
8641
diff
changeset
|
538 | if (triple[0] && triple[1]) { |
|
40700
4c3ee00e6107
Replace g_strdup_printf("%s", string) with g_strdup(string)
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40698
diff
changeset
|
539 | char *tmp = g_strdup(zephyr->username); |
| 2804 | 540 | char *atptr; |
|
8644
ba37f1cc0006
[gaim-migrate @ 9396]
Mark Doliner <markdoliner@pidgin.im>
parents:
8641
diff
changeset
|
541 | |
|
ba37f1cc0006
[gaim-migrate @ 9396]
Mark Doliner <markdoliner@pidgin.im>
parents:
8641
diff
changeset
|
542 | if (triple[2] == NULL) { |
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
543 | sub.zsub_recipient = g_malloc0(1); |
| 4793 | 544 | } else if (!g_ascii_strcasecmp(triple[2], "%me%")) { |
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
545 | sub.zsub_recipient = g_strdup(zephyr->username); |
| 4793 | 546 | } else if (!g_ascii_strcasecmp(triple[2], "*")) { |
| 2804 | 547 | /* wildcard |
| 548 | * form of class,instance,* */ | |
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
549 | sub.zsub_recipient = g_malloc0(1); |
| 4793 | 550 | } else if (!g_ascii_strcasecmp(triple[2], tmp)) { |
| 2804 | 551 | /* form of class,instance,aatharuv@ATHENA.MIT.EDU */ |
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
552 | sub.zsub_recipient = g_strdup(triple[2]); |
| 2804 | 553 | } else if ((atptr = strchr(triple[2], '@')) != NULL) { |
| 554 | /* form of class,instance,*@ANDREW.CMU.EDU | |
| 555 | * class,instance,@ANDREW.CMU.EDU | |
| 556 | * If realm is local realm, blank recipient, else | |
| 557 | * @REALM-NAME | |
| 558 | */ | |
| 9896 | 559 | char *realmat = g_strdup_printf("@%s",zephyr->realm); |
|
8644
ba37f1cc0006
[gaim-migrate @ 9396]
Mark Doliner <markdoliner@pidgin.im>
parents:
8641
diff
changeset
|
560 | |
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
561 | if (!g_ascii_strcasecmp(atptr, realmat)) { |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
562 | sub.zsub_recipient = g_malloc0(1); |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
563 | } else { |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
564 | sub.zsub_recipient = g_strdup(atptr); |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
565 | } |
| 2804 | 566 | g_free(realmat); |
| 2086 | 567 | } else { |
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
568 | sub.zsub_recipient = g_strdup(triple[2]); |
| 2086 | 569 | } |
| 2804 | 570 | g_free(tmp); |
| 9478 | 571 | |
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
572 | if (!g_ascii_strcasecmp(triple[0], "%host%")) { |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
573 | sub.zsub_class = g_strdup(zephyr->ourhost); |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
574 | } else if (!g_ascii_strcasecmp(triple[0], "%canon%")) { |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
575 | sub.zsub_class = g_strdup(zephyr->ourhostcanon); |
| 9478 | 576 | } else { |
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
577 | sub.zsub_class = g_strdup(triple[0]); |
| 9478 | 578 | } |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30138
diff
changeset
|
579 | |
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
580 | if (!g_ascii_strcasecmp(triple[1], "%host%")) { |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
581 | sub.zsub_classinst = g_strdup(zephyr->ourhost); |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
582 | } else if (!g_ascii_strcasecmp(triple[1], "%canon%")) { |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
583 | sub.zsub_classinst = g_strdup(zephyr->ourhostcanon); |
| 9478 | 584 | } else { |
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
585 | sub.zsub_classinst = g_strdup(triple[1]); |
| 9478 | 586 | } |
| 587 | ||
| 588 | /* There should be some sort of error report listing classes that couldn't be subbed to. | |
| 589 | Not important right now though */ | |
| 590 | ||
|
40750
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
591 | if (!zephyr->subscribe_to(zephyr, &sub)) { |
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
592 | purple_debug_error("zephyr", "Couldn't subscribe to %s, %s, %s\n", |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
593 | sub.zsub_class, sub.zsub_classinst, sub.zsub_recipient); |
| 2086 | 594 | } |
| 9478 | 595 | |
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
596 | zephyr->subscrips = g_slist_append(zephyr->subscrips, zephyr_triple_new(zephyr, &sub)); |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
597 | g_free(sub.zsub_class); |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
598 | g_free(sub.zsub_classinst); |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
599 | g_free(sub.zsub_recipient); |
| 2086 | 600 | } |
| 601 | g_strfreev(triple); | |
| 602 | } | |
| 603 | } | |
|
13454
10592212bb27
[gaim-migrate @ 15828]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
13297
diff
changeset
|
604 | fclose(f); |
| 2086 | 605 | } |
|
33694
dabb189b6ac9
zephyr.c: Fix multiple leaks
Niels Thykier <niels@thykier.net>
parents:
32698
diff
changeset
|
606 | g_free(fname); |
| 2086 | 607 | } |
| 608 | ||
|
40662
80764d18e588
zephyr_login cleanups
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40661
diff
changeset
|
609 | static void |
|
80764d18e588
zephyr_login cleanups
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40661
diff
changeset
|
610 | process_anyone(const zephyr_account *zephyr) |
| 2086 | 611 | { |
| 612 | FILE *fd; | |
| 613 | gchar buff[BUFSIZ], *filename; | |
| 15884 | 614 | PurpleGroup *g; |
| 615 | PurpleBuddy *b; | |
|
4775
239cb803fb1d
[gaim-migrate @ 5095]
Mark Doliner <markdoliner@pidgin.im>
parents:
4770
diff
changeset
|
616 | |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34717
diff
changeset
|
617 | if (!(g = purple_blist_find_group(_("Anyone")))) { |
| 15884 | 618 | g = purple_group_new(_("Anyone")); |
| 619 | purple_blist_add_group(g, NULL); | |
|
4775
239cb803fb1d
[gaim-migrate @ 5095]
Mark Doliner <markdoliner@pidgin.im>
parents:
4770
diff
changeset
|
620 | } |
| 6695 | 621 | |
| 15884 | 622 | filename = g_strconcat(purple_home_dir(), "/.anyone", NULL); |
|
10589
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10401
diff
changeset
|
623 | if ((fd = g_fopen(filename, "r")) != NULL) { |
| 2086 | 624 | while (fgets(buff, BUFSIZ, fd)) { |
| 625 | strip_comments(buff); | |
|
40672
9375289dfc32
Reduce some code duplication
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40662
diff
changeset
|
626 | if (*buff && !find_buddy(zephyr, buff)) { |
|
9375289dfc32
Reduce some code duplication
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40662
diff
changeset
|
627 | char *stripped_user = zephyr_strip_local_realm(zephyr, buff); |
|
9375289dfc32
Reduce some code duplication
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40662
diff
changeset
|
628 | purple_debug_info("zephyr", "stripped_user %s\n", stripped_user); |
|
9375289dfc32
Reduce some code duplication
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40662
diff
changeset
|
629 | b = purple_buddy_new(zephyr->account, stripped_user, NULL); |
|
9375289dfc32
Reduce some code duplication
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40662
diff
changeset
|
630 | purple_blist_add_buddy(b, NULL, g, NULL); |
|
9375289dfc32
Reduce some code duplication
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40662
diff
changeset
|
631 | g_free(stripped_user); |
|
8644
ba37f1cc0006
[gaim-migrate @ 9396]
Mark Doliner <markdoliner@pidgin.im>
parents:
8641
diff
changeset
|
632 | } |
| 2086 | 633 | } |
| 634 | fclose(fd); | |
| 635 | } | |
| 636 | g_free(filename); | |
| 637 | } | |
| 638 | ||
|
39831
c7e0d1617aae
zephyr: Fix const-ness of variable loading.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
639 | static gchar * |
|
40662
80764d18e588
zephyr_login cleanups
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40661
diff
changeset
|
640 | get_zephyr_exposure(PurpleAccount *account) |
|
39831
c7e0d1617aae
zephyr: Fix const-ness of variable loading.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
641 | { |
|
40662
80764d18e588
zephyr_login cleanups
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40661
diff
changeset
|
642 | const gchar *exposure; |
|
80764d18e588
zephyr_login cleanups
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40661
diff
changeset
|
643 | gchar *exp2; |
|
80764d18e588
zephyr_login cleanups
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40661
diff
changeset
|
644 | |
|
80764d18e588
zephyr_login cleanups
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40661
diff
changeset
|
645 | exposure = purple_account_get_string(account, "exposure_level", EXPOSE_REALMVIS); |
|
80764d18e588
zephyr_login cleanups
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40661
diff
changeset
|
646 | |
|
80764d18e588
zephyr_login cleanups
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40661
diff
changeset
|
647 | /* Make sure that the exposure (visibility) is set to a sane value */ |
|
80764d18e588
zephyr_login cleanups
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40661
diff
changeset
|
648 | exp2 = g_strstrip(g_ascii_strup(exposure, -1)); |
|
40635
1f8b5b68a806
Some zephyr cleanups
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40634
diff
changeset
|
649 | if (exp2) { |
|
40662
80764d18e588
zephyr_login cleanups
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40661
diff
changeset
|
650 | if (purple_strequal(exp2, EXPOSE_NONE) || |
|
80764d18e588
zephyr_login cleanups
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40661
diff
changeset
|
651 | purple_strequal(exp2, EXPOSE_OPSTAFF) || |
|
40635
1f8b5b68a806
Some zephyr cleanups
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40634
diff
changeset
|
652 | purple_strequal(exp2, EXPOSE_REALMANN) || |
|
40662
80764d18e588
zephyr_login cleanups
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40661
diff
changeset
|
653 | purple_strequal(exp2, EXPOSE_NETVIS) || |
|
80764d18e588
zephyr_login cleanups
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40661
diff
changeset
|
654 | purple_strequal(exp2, EXPOSE_NETANN)) { |
|
40635
1f8b5b68a806
Some zephyr cleanups
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40634
diff
changeset
|
655 | return exp2; |
|
1f8b5b68a806
Some zephyr cleanups
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40634
diff
changeset
|
656 | } |
|
1f8b5b68a806
Some zephyr cleanups
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40634
diff
changeset
|
657 | g_free(exp2); |
|
39831
c7e0d1617aae
zephyr: Fix const-ness of variable loading.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
658 | } |
|
c7e0d1617aae
zephyr: Fix const-ness of variable loading.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
659 | return g_strdup(EXPOSE_REALMVIS); |
|
10038
3589c2eed81c
[gaim-migrate @ 10997]
Luke Schierer <lschiere@pidgin.im>
parents:
10009
diff
changeset
|
660 | } |
|
3589c2eed81c
[gaim-migrate @ 10997]
Luke Schierer <lschiere@pidgin.im>
parents:
10009
diff
changeset
|
661 | |
|
40750
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
662 | gchar * |
|
40698
d06e6660b39c
zephyr_login refactoring
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40697
diff
changeset
|
663 | get_zephyr_realm(PurpleAccount *account, const gchar *local_realm) |
|
d06e6660b39c
zephyr_login refactoring
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40697
diff
changeset
|
664 | { |
|
d06e6660b39c
zephyr_login refactoring
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40697
diff
changeset
|
665 | const char *realm = purple_account_get_string(account, "realm", ""); |
|
d06e6660b39c
zephyr_login refactoring
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40697
diff
changeset
|
666 | if (!*realm) { |
|
d06e6660b39c
zephyr_login refactoring
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40697
diff
changeset
|
667 | realm = local_realm; |
|
d06e6660b39c
zephyr_login refactoring
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40697
diff
changeset
|
668 | } |
|
d06e6660b39c
zephyr_login refactoring
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40697
diff
changeset
|
669 | g_strlcpy(__Zephyr_realm, realm, REALM_SZ - 1); |
|
d06e6660b39c
zephyr_login refactoring
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40697
diff
changeset
|
670 | return g_strdup(realm); |
|
d06e6660b39c
zephyr_login refactoring
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40697
diff
changeset
|
671 | } |
|
d06e6660b39c
zephyr_login refactoring
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40697
diff
changeset
|
672 | |
| 15884 | 673 | static void zephyr_login(PurpleAccount * account) |
| 2086 | 674 | { |
| 15884 | 675 | PurpleConnection *gc; |
| 9896 | 676 | zephyr_account *zephyr; |
|
40698
d06e6660b39c
zephyr_login refactoring
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40697
diff
changeset
|
677 | ZephyrLoginFunc login; |
|
40662
80764d18e588
zephyr_login cleanups
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40661
diff
changeset
|
678 | GSourceFunc check_notify; |
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
679 | ZSubscription_t sub; |
| 9427 | 680 | |
| 15884 | 681 | gc = purple_account_get_connection(account); |
|
10038
3589c2eed81c
[gaim-migrate @ 10997]
Luke Schierer <lschiere@pidgin.im>
parents:
10009
diff
changeset
|
682 | |
| 10867 | 683 | #ifdef WIN32 |
| 15884 | 684 | username = purple_account_get_username(account); |
| 10867 | 685 | #endif |
|
36055
33978dc8ef6f
Remove redundant OPT_PROTO_IM_IMAGE (use \!PURPLE_CONNECTION_FLAG_NO_IMAGES instead)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36031
diff
changeset
|
686 | purple_connection_set_flags(gc, PURPLE_CONNECTION_FLAG_AUTO_RESP | |
|
33978dc8ef6f
Remove redundant OPT_PROTO_IM_IMAGE (use \!PURPLE_CONNECTION_FLAG_NO_IMAGES instead)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36031
diff
changeset
|
687 | PURPLE_CONNECTION_FLAG_HTML | PURPLE_CONNECTION_FLAG_NO_BGCOLOR | |
|
33978dc8ef6f
Remove redundant OPT_PROTO_IM_IMAGE (use \!PURPLE_CONNECTION_FLAG_NO_IMAGES instead)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36031
diff
changeset
|
688 | PURPLE_CONNECTION_FLAG_NO_URLDESC | PURPLE_CONNECTION_FLAG_NO_IMAGES); |
|
32265
8007f413c665
Convert zephyr prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
689 | zephyr = g_new0(zephyr_account, 1); |
|
8007f413c665
Convert zephyr prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
690 | purple_connection_set_protocol_data(gc, zephyr); |
|
10038
3589c2eed81c
[gaim-migrate @ 10997]
Luke Schierer <lschiere@pidgin.im>
parents:
10009
diff
changeset
|
691 | |
| 9896 | 692 | zephyr->account = account; |
|
40662
80764d18e588
zephyr_login cleanups
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40661
diff
changeset
|
693 | zephyr->exposure = get_zephyr_exposure(account); |
|
80764d18e588
zephyr_login cleanups
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40661
diff
changeset
|
694 | |
|
40698
d06e6660b39c
zephyr_login refactoring
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40697
diff
changeset
|
695 | if (purple_account_get_bool(account, "use_tzc", FALSE)) { |
| 15884 | 696 | zephyr->connection_type = PURPLE_ZEPHYR_TZC; |
|
40750
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
697 | login = tzc_login; |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
698 | check_notify = tzc_check_notify; |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
699 | zephyr->subscribe_to = tzc_subscribe_to; |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
700 | zephyr->request_locations = tzc_request_locations; |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
701 | zephyr->send_message = tzc_send_message; |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
702 | zephyr->set_location = tzc_set_location; |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
703 | zephyr->get_subs_from_server = tzc_get_subs_from_server; |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
704 | zephyr->close = tzc_close; |
| 9896 | 705 | } else { |
| 15884 | 706 | zephyr->connection_type = PURPLE_ZEPHYR_KRB4; |
|
40750
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
707 | login = zeph02_login; |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
708 | check_notify = zeph02_check_notify; |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
709 | zephyr->subscribe_to = zeph02_subscribe_to; |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
710 | zephyr->request_locations = zeph02_request_locations; |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
711 | zephyr->send_message = zeph02_send_message; |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
712 | zephyr->set_location = zeph02_set_location; |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
713 | zephyr->get_subs_from_server = zeph02_get_subs_from_server; |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
714 | zephyr->close = zeph02_close; |
| 9896 | 715 | } |
| 716 | ||
|
40662
80764d18e588
zephyr_login cleanups
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40661
diff
changeset
|
717 | zephyr->encoding = (char *)purple_account_get_string(account, "encoding", ZEPHYR_FALLBACK_CHARSET); |
| 15884 | 718 | purple_connection_update_progress(gc, _("Connecting"), 0, 8); |
| 9478 | 719 | |
|
40698
d06e6660b39c
zephyr_login refactoring
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40697
diff
changeset
|
720 | if (!login(zephyr)) { |
| 9896 | 721 | return; |
| 722 | } | |
| 15884 | 723 | purple_debug_info("zephyr","does it get here\n"); |
| 724 | purple_debug_info("zephyr"," realm: %s username:%s\n", zephyr->realm, zephyr->username); | |
| 9896 | 725 | |
| 726 | /* For now */ | |
| 727 | zephyr->galaxy = NULL; | |
| 728 | zephyr->krbtkfile = NULL; | |
| 729 | zephyr_inithosts(zephyr); | |
| 730 | ||
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
731 | sub.zsub_class = "MESSAGE"; |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
732 | sub.zsub_classinst = "PERSONAL"; |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
733 | sub.zsub_recipient = zephyr->username; |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
734 | |
|
40750
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
735 | if (!zephyr->subscribe_to(zephyr, &sub)) { |
| 9478 | 736 | /* XXX don't translate this yet. It could be written better */ |
| 737 | /* XXX error messages could be handled with more detail */ | |
|
40662
80764d18e588
zephyr_login cleanups
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40661
diff
changeset
|
738 | purple_notify_error(gc, NULL, |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34312
diff
changeset
|
739 | "Unable to subscribe to messages", "Unable to subscribe to initial messages", |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34312
diff
changeset
|
740 | purple_request_cpar_from_connection(gc)); |
| 9478 | 741 | return; |
| 2086 | 742 | } |
| 743 | ||
|
34746
dc9c911dbd35
Started GObjectification of PurpleConnection.
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
744 | purple_connection_set_state(gc, PURPLE_CONNECTION_CONNECTED); |
|
10038
3589c2eed81c
[gaim-migrate @ 10997]
Luke Schierer <lschiere@pidgin.im>
parents:
10009
diff
changeset
|
745 | |
|
40698
d06e6660b39c
zephyr_login refactoring
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40697
diff
changeset
|
746 | if (purple_account_get_bool(account, "read_anyone", TRUE)) { |
|
40662
80764d18e588
zephyr_login cleanups
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40661
diff
changeset
|
747 | process_anyone(zephyr); |
|
40698
d06e6660b39c
zephyr_login refactoring
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40697
diff
changeset
|
748 | } |
|
d06e6660b39c
zephyr_login refactoring
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40697
diff
changeset
|
749 | if (purple_account_get_bool(account, "read_zsubs", TRUE)) { |
|
10038
3589c2eed81c
[gaim-migrate @ 10997]
Luke Schierer <lschiere@pidgin.im>
parents:
10009
diff
changeset
|
750 | process_zsubs(zephyr); |
|
40698
d06e6660b39c
zephyr_login refactoring
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40697
diff
changeset
|
751 | } |
|
10038
3589c2eed81c
[gaim-migrate @ 10997]
Luke Schierer <lschiere@pidgin.im>
parents:
10009
diff
changeset
|
752 | |
|
40662
80764d18e588
zephyr_login cleanups
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40661
diff
changeset
|
753 | zephyr->nottimer = g_timeout_add(100, check_notify, gc); |
|
40750
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
754 | zephyr->loctimer = g_timeout_add_seconds(20, check_loc, zephyr); |
| 2086 | 755 | } |
| 756 | ||
| 9610 | 757 | static void write_zsubs(zephyr_account *zephyr) |
| 2086 | 758 | { |
| 9896 | 759 | /* Exports subscription (chat) list back to |
| 760 | * .zephyr.subs | |
| 761 | * XXX deal with %host%, %canon%, unsubscriptions, and negative subscriptions (punts?) | |
| 762 | */ | |
| 9434 | 763 | |
| 9610 | 764 | GSList *s = zephyr->subscrips; |
| 2086 | 765 | zephyr_triple *zt; |
| 766 | FILE *fd; | |
| 767 | char *fname; | |
| 768 | ||
|
8644
ba37f1cc0006
[gaim-migrate @ 9396]
Mark Doliner <markdoliner@pidgin.im>
parents:
8641
diff
changeset
|
769 | char **triple; |
|
ba37f1cc0006
[gaim-migrate @ 9396]
Mark Doliner <markdoliner@pidgin.im>
parents:
8641
diff
changeset
|
770 | |
| 15884 | 771 | fname = g_strdup_printf("%s/.zephyr.subs", purple_home_dir()); |
|
10589
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10401
diff
changeset
|
772 | fd = g_fopen(fname, "w"); |
|
8644
ba37f1cc0006
[gaim-migrate @ 9396]
Mark Doliner <markdoliner@pidgin.im>
parents:
8641
diff
changeset
|
773 | |
| 2086 | 774 | if (!fd) { |
| 775 | g_free(fname); | |
| 776 | return; | |
| 777 | } | |
|
8644
ba37f1cc0006
[gaim-migrate @ 9396]
Mark Doliner <markdoliner@pidgin.im>
parents:
8641
diff
changeset
|
778 | |
| 2086 | 779 | while (s) { |
| 9478 | 780 | char *zclass, *zinst, *zrecip; |
| 2086 | 781 | zt = s->data; |
|
8644
ba37f1cc0006
[gaim-migrate @ 9396]
Mark Doliner <markdoliner@pidgin.im>
parents:
8641
diff
changeset
|
782 | triple = g_strsplit(zt->name, ",", 3); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30138
diff
changeset
|
783 | |
| 9478 | 784 | /* deal with classes */ |
| 9610 | 785 | if (!g_ascii_strcasecmp(triple[0],zephyr->ourhost)) { |
|
9775
e3a3555b0621
[gaim-migrate @ 10643]
Daniel Atallah <datallah@pidgin.im>
parents:
9754
diff
changeset
|
786 | zclass = g_strdup("%host%"); |
| 9610 | 787 | } else if (!g_ascii_strcasecmp(triple[0],zephyr->ourhostcanon)) { |
|
9775
e3a3555b0621
[gaim-migrate @ 10643]
Daniel Atallah <datallah@pidgin.im>
parents:
9754
diff
changeset
|
788 | zclass = g_strdup("%canon%"); |
| 9478 | 789 | } else { |
| 790 | zclass = g_strdup(triple[0]); | |
| 791 | } | |
| 792 | ||
| 793 | /* deal with instances */ | |
| 794 | ||
| 9610 | 795 | if (!g_ascii_strcasecmp(triple[1],zephyr->ourhost)) { |
|
9775
e3a3555b0621
[gaim-migrate @ 10643]
Daniel Atallah <datallah@pidgin.im>
parents:
9754
diff
changeset
|
796 | zinst = g_strdup("%host%"); |
| 9610 | 797 | } else if (!g_ascii_strcasecmp(triple[1],zephyr->ourhostcanon)) { |
| 9896 | 798 | zinst = g_strdup("%canon%");; |
| 799 | } else { | |
| 9478 | 800 | zinst = g_strdup(triple[1]); |
| 9896 | 801 | } |
| 9478 | 802 | |
| 803 | /* deal with recipients */ | |
| 804 | if (triple[2] == NULL) { | |
| 805 | zrecip = g_strdup("*"); | |
| 806 | } else if (!g_ascii_strcasecmp(triple[2],"")){ | |
| 807 | zrecip = g_strdup("*"); | |
| 9896 | 808 | } else if (!g_ascii_strcasecmp(triple[2], zephyr->username)) { |
| 9478 | 809 | zrecip = g_strdup("%me%"); |
| 3277 | 810 | } else { |
| 9478 | 811 | zrecip = g_strdup(triple[2]); |
| 3277 | 812 | } |
| 9478 | 813 | |
| 814 | fprintf(fd, "%s,%s,%s\n",zclass,zinst,zrecip); | |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30138
diff
changeset
|
815 | |
| 9478 | 816 | g_free(zclass); |
| 817 | g_free(zinst); | |
| 818 | g_free(zrecip); | |
|
40514
30d9cbf04922
Fix some leaks.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40507
diff
changeset
|
819 | g_strfreev(triple); |
| 2086 | 820 | s = s->next; |
| 821 | } | |
| 822 | g_free(fname); | |
| 823 | fclose(fd); | |
| 824 | } | |
| 825 | ||
|
31352
7f6c8c77ead0
Use convenience variables.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31294
diff
changeset
|
826 | static void write_anyone(zephyr_account *zephyr) |
| 2086 | 827 | { |
|
27199
ab2af9d15cba
Use purple_find_buddies() instead of iterating the buddy list.
Paul Aurich <darkrain42@pidgin.im>
parents:
27198
diff
changeset
|
828 | GSList *buddies; |
| 9912 | 829 | char *fname; |
| 2086 | 830 | FILE *fd; |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23352
diff
changeset
|
831 | PurpleAccount *account; |
| 15884 | 832 | fname = g_strdup_printf("%s/.anyone", purple_home_dir()); |
|
10589
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10401
diff
changeset
|
833 | fd = g_fopen(fname, "w"); |
| 2086 | 834 | if (!fd) { |
| 835 | g_free(fname); | |
| 836 | return; | |
| 837 | } | |
| 838 | ||
|
31352
7f6c8c77ead0
Use convenience variables.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31294
diff
changeset
|
839 | account = zephyr->account; |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34717
diff
changeset
|
840 | for (buddies = purple_blist_find_buddies(account, NULL); buddies; |
|
27199
ab2af9d15cba
Use purple_find_buddies() instead of iterating the buddy list.
Paul Aurich <darkrain42@pidgin.im>
parents:
27198
diff
changeset
|
841 | buddies = g_slist_delete_link(buddies, buddies)) { |
|
ab2af9d15cba
Use purple_find_buddies() instead of iterating the buddy list.
Paul Aurich <darkrain42@pidgin.im>
parents:
27198
diff
changeset
|
842 | PurpleBuddy *b = buddies->data; |
|
ab2af9d15cba
Use purple_find_buddies() instead of iterating the buddy list.
Paul Aurich <darkrain42@pidgin.im>
parents:
27198
diff
changeset
|
843 | gchar *stripped_user = zephyr_strip_local_realm(zephyr, purple_buddy_get_name(b)); |
|
ab2af9d15cba
Use purple_find_buddies() instead of iterating the buddy list.
Paul Aurich <darkrain42@pidgin.im>
parents:
27198
diff
changeset
|
844 | fprintf(fd, "%s\n", stripped_user); |
|
ab2af9d15cba
Use purple_find_buddies() instead of iterating the buddy list.
Paul Aurich <darkrain42@pidgin.im>
parents:
27198
diff
changeset
|
845 | g_free(stripped_user); |
| 2086 | 846 | } |
| 847 | ||
| 848 | fclose(fd); | |
| 849 | g_free(fname); | |
| 850 | } | |
| 851 | ||
| 15884 | 852 | static void zephyr_close(PurpleConnection * gc) |
| 2086 | 853 | { |
|
32265
8007f413c665
Convert zephyr prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
854 | zephyr_account *zephyr = purple_connection_get_protocol_data(gc); |
|
8644
ba37f1cc0006
[gaim-migrate @ 9396]
Mark Doliner <markdoliner@pidgin.im>
parents:
8641
diff
changeset
|
855 | |
|
40043
90446617d967
Use GList functions instead of manual iterations
qarkai <qarkai@gmail.com>
parents:
39970
diff
changeset
|
856 | g_list_free_full(zephyr->pending_zloc_names, g_free); |
|
8644
ba37f1cc0006
[gaim-migrate @ 9396]
Mark Doliner <markdoliner@pidgin.im>
parents:
8641
diff
changeset
|
857 | |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32624
diff
changeset
|
858 | if (purple_account_get_bool(purple_connection_get_account(gc), "write_anyone", FALSE)) |
|
31352
7f6c8c77ead0
Use convenience variables.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31294
diff
changeset
|
859 | write_anyone(zephyr); |
|
8644
ba37f1cc0006
[gaim-migrate @ 9396]
Mark Doliner <markdoliner@pidgin.im>
parents:
8641
diff
changeset
|
860 | |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32624
diff
changeset
|
861 | if (purple_account_get_bool(purple_connection_get_account(gc), "write_zsubs", FALSE)) |
|
31352
7f6c8c77ead0
Use convenience variables.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31294
diff
changeset
|
862 | write_zsubs(zephyr); |
|
8644
ba37f1cc0006
[gaim-migrate @ 9396]
Mark Doliner <markdoliner@pidgin.im>
parents:
8641
diff
changeset
|
863 | |
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
864 | g_slist_free_full(zephyr->subscrips, (GDestroyNotify)zephyr_triple_free); |
|
8644
ba37f1cc0006
[gaim-migrate @ 9396]
Mark Doliner <markdoliner@pidgin.im>
parents:
8641
diff
changeset
|
865 | |
| 9610 | 866 | if (zephyr->nottimer) |
|
38433
361c801c4536
Remove purple_timeout_* function usage
Mike Ruprecht <cmaiku@gmail.com>
parents:
37523
diff
changeset
|
867 | g_source_remove(zephyr->nottimer); |
| 9610 | 868 | zephyr->nottimer = 0; |
| 869 | if (zephyr->loctimer) | |
|
38433
361c801c4536
Remove purple_timeout_* function usage
Mike Ruprecht <cmaiku@gmail.com>
parents:
37523
diff
changeset
|
870 | g_source_remove(zephyr->loctimer); |
| 9610 | 871 | zephyr->loctimer = 0; |
|
40750
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
872 | zephyr->close(zephyr); |
|
40809
691bd780ab06
Replace gethostname by g_get_host_name
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40800
diff
changeset
|
873 | |
|
691bd780ab06
Replace gethostname by g_get_host_name
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40800
diff
changeset
|
874 | g_clear_pointer(&zephyr->ourhost, g_free); |
|
691bd780ab06
Replace gethostname by g_get_host_name
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40800
diff
changeset
|
875 | g_clear_pointer(&zephyr->ourhostcanon, g_free); |
| 2086 | 876 | } |
| 877 | ||
|
40750
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
878 | static gboolean |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
879 | zephyr_send_message(zephyr_account *zephyr, gchar *zclass, gchar *instance, |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
880 | gchar *recipient, const gchar *im, const gchar *sig, |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
881 | gchar *opcode) |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
882 | { |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
883 | /* (From the tzc source) |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
884 | * emacs sends something of the form: |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
885 | * ((class . "MESSAGE") |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
886 | * (auth . t) |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
887 | * (recipients ("PERSONAL" . "bovik") ("test" . "")) |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
888 | * (sender . "bovik") |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
889 | * (message . ("Harry Bovik" "my zgram")) |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
890 | * ) |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
891 | */ |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
892 | char *tmp_buf; |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
893 | char *html_buf; |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
894 | gboolean result; |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
895 | |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
896 | tmp_buf = html_to_zephyr(im); |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
897 | html_buf = purple_unescape_html(tmp_buf); |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
898 | g_free(tmp_buf); |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
899 | |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
900 | result = zephyr->send_message(zephyr, zclass, instance, recipient, html_buf, sig, opcode); |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
901 | g_free(html_buf); |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
902 | return result; |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
903 | } |
| 9434 | 904 | |
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
905 | static gint |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
906 | zephyr_triple_cmp_id(gconstpointer data, gconstpointer user_data) |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
907 | { |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
908 | const zephyr_triple *zt = data; |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
909 | int id = GPOINTER_TO_INT(user_data); |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
910 | return zt->id - id; |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
911 | } |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
912 | |
|
22104
56970903b8e9
Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@pidgin.im>
parents:
20288
diff
changeset
|
913 | static const char * zephyr_get_signature(void) |
| 9434 | 914 | { |
| 9478 | 915 | /* XXX add zephyr error reporting */ |
| 916 | const char * sig =ZGetVariable("zwrite-signature"); | |
| 9896 | 917 | if (!sig) { |
| 918 | sig = g_get_real_name(); | |
| 919 | } | |
| 920 | return sig; | |
| 9434 | 921 | } |
| 922 | ||
|
40697
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40686
diff
changeset
|
923 | static int |
|
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40686
diff
changeset
|
924 | zephyr_chat_send(PurpleProtocolChat *protocol_chat, PurpleConnection *gc, |
|
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40686
diff
changeset
|
925 | int id, PurpleMessage *msg) |
| 2086 | 926 | { |
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
927 | GSList *l; |
| 2086 | 928 | zephyr_triple *zt; |
| 929 | const char *sig; | |
|
40885
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40865
diff
changeset
|
930 | PurpleConversation *gcc; |
|
40997
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40985
diff
changeset
|
931 | PurpleConversationManager *manager; |
|
8644
ba37f1cc0006
[gaim-migrate @ 9396]
Mark Doliner <markdoliner@pidgin.im>
parents:
8641
diff
changeset
|
932 | char *inst; |
| 9896 | 933 | char *recipient; |
|
32265
8007f413c665
Convert zephyr prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
934 | zephyr_account *zephyr = purple_connection_get_protocol_data(gc); |
| 2086 | 935 | |
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
936 | l = g_slist_find_custom(zephyr->subscrips, GINT_TO_POINTER(id), zephyr_triple_cmp_id); |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
937 | if (!l) { |
| 2086 | 938 | /* this should never happen. */ |
|
2167
cbb558585911
[gaim-migrate @ 2177]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2162
diff
changeset
|
939 | return -EINVAL; |
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
940 | } |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
941 | |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
942 | zt = l->data; |
| 9896 | 943 | sig = zephyr_get_signature(); |
| 2086 | 944 | |
|
40997
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40985
diff
changeset
|
945 | manager = purple_conversation_manager_get_default(); |
|
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40985
diff
changeset
|
946 | gcc = purple_conversation_manager_find_chat(manager, |
|
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40985
diff
changeset
|
947 | purple_connection_get_account(gc), |
|
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40985
diff
changeset
|
948 | zt->name); |
| 8212 | 949 | |
|
40885
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40865
diff
changeset
|
950 | if (!(inst = (char *)purple_chat_conversation_get_topic(PURPLE_CHAT_CONVERSATION(gcc)))) |
| 9434 | 951 | inst = g_strdup("PERSONAL"); |
|
8644
ba37f1cc0006
[gaim-migrate @ 9396]
Mark Doliner <markdoliner@pidgin.im>
parents:
8641
diff
changeset
|
952 | |
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
953 | if (!g_ascii_strcasecmp(zt->sub.zsub_recipient, "*")) { |
|
40750
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
954 | recipient = zephyr_normalize_local_realm(zephyr, ""); |
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
955 | } else { |
|
40750
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
956 | recipient = zephyr_normalize_local_realm(zephyr, zt->sub.zsub_recipient); |
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
957 | } |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
958 | zephyr_send_message(zephyr, zt->sub.zsub_class, inst, recipient, |
|
36077
b7328f4317c7
Switch purple_serv_chat_send to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36076
diff
changeset
|
959 | purple_message_get_contents(msg), sig, ""); |
|
2167
cbb558585911
[gaim-migrate @ 2177]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2162
diff
changeset
|
960 | return 0; |
| 2086 | 961 | } |
| 962 | ||
| 9434 | 963 | |
|
40507
77d7bc9e5151
Make PurpleProtocolIM a proper interface
Gary Kramlich <grim@reaperworld.com>
parents:
40462
diff
changeset
|
964 | static int zephyr_send_im(PurpleProtocolIM *im, PurpleConnection *gc, PurpleMessage *msg) |
|
8644
ba37f1cc0006
[gaim-migrate @ 9396]
Mark Doliner <markdoliner@pidgin.im>
parents:
8641
diff
changeset
|
965 | { |
| 2086 | 966 | const char *sig; |
|
32265
8007f413c665
Convert zephyr prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
967 | zephyr_account *zephyr = purple_connection_get_protocol_data(gc); |
|
36076
a0e5b68ff4ef
Switch purple_serv_send_im to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36055
diff
changeset
|
968 | |
|
a0e5b68ff4ef
Switch purple_serv_send_im to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36055
diff
changeset
|
969 | if (purple_message_get_flags(msg) & PURPLE_MESSAGE_AUTO_RESP) { |
| 2086 | 970 | sig = "Automated reply:"; |
|
36076
a0e5b68ff4ef
Switch purple_serv_send_im to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36055
diff
changeset
|
971 | } else { |
| 9434 | 972 | sig = zephyr_get_signature(); |
| 2086 | 973 | } |
|
36076
a0e5b68ff4ef
Switch purple_serv_send_im to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36055
diff
changeset
|
974 | zephyr_send_message(zephyr, "MESSAGE", "PERSONAL", |
|
40750
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
975 | zephyr_normalize_local_realm(zephyr, purple_message_get_recipient(msg)), |
|
36076
a0e5b68ff4ef
Switch purple_serv_send_im to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36055
diff
changeset
|
976 | purple_message_get_contents(msg), sig, ""); |
| 9434 | 977 | |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30138
diff
changeset
|
978 | return 1; |
| 9434 | 979 | } |
| 2086 | 980 | |
|
40715
206563c8b5c6
zephyr_tzc_escape_msg and zephyr_tzc_deescape_str refactoring
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40708
diff
changeset
|
981 | |
|
206563c8b5c6
zephyr_tzc_escape_msg and zephyr_tzc_deescape_str refactoring
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40708
diff
changeset
|
982 | /* Basically the inverse of zephyr_strip_local_realm */ |
|
40750
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
983 | char * |
|
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
984 | zephyr_normalize_local_realm(const zephyr_account *zephyr, const char *orig) |
| 8354 | 985 | { |
|
40700
4c3ee00e6107
Replace g_strdup_printf("%s", string) with g_strdup(string)
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40698
diff
changeset
|
986 | if (*orig == '\0' || strchr(orig, '@')) { |
|
4c3ee00e6107
Replace g_strdup_printf("%s", string) with g_strdup(string)
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40698
diff
changeset
|
987 | return g_strdup(orig); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30138
diff
changeset
|
988 | } |
|
40635
1f8b5b68a806
Some zephyr cleanups
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40634
diff
changeset
|
989 | |
|
1f8b5b68a806
Some zephyr cleanups
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40634
diff
changeset
|
990 | return g_strdup_printf("%s@%s", orig, zephyr->realm); |
| 2086 | 991 | } |
| 992 | ||
|
40634
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40633
diff
changeset
|
993 | static const char * |
|
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40633
diff
changeset
|
994 | zephyr_normalize(PurpleProtocolClient *client, PurpleAccount *account, |
|
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40633
diff
changeset
|
995 | const char *who) |
|
22391
823ac1e9cfbb
Get rid of some privacy checking code from zephyr that is done in
Mark Doliner <markdoliner@pidgin.im>
parents:
22389
diff
changeset
|
996 | { |
|
823ac1e9cfbb
Get rid of some privacy checking code from zephyr that is done in
Mark Doliner <markdoliner@pidgin.im>
parents:
22389
diff
changeset
|
997 | static char buf[BUF_LEN]; |
|
823ac1e9cfbb
Get rid of some privacy checking code from zephyr that is done in
Mark Doliner <markdoliner@pidgin.im>
parents:
22389
diff
changeset
|
998 | PurpleConnection *gc; |
|
823ac1e9cfbb
Get rid of some privacy checking code from zephyr that is done in
Mark Doliner <markdoliner@pidgin.im>
parents:
22389
diff
changeset
|
999 | char *tmp; |
|
823ac1e9cfbb
Get rid of some privacy checking code from zephyr that is done in
Mark Doliner <markdoliner@pidgin.im>
parents:
22389
diff
changeset
|
1000 | |
|
35853
700097e7206b
Zephyr: fix username validation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35692
diff
changeset
|
1001 | if (account == NULL) { |
|
700097e7206b
Zephyr: fix username validation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35692
diff
changeset
|
1002 | if (strlen(who) >= sizeof(buf)) |
|
700097e7206b
Zephyr: fix username validation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35692
diff
changeset
|
1003 | return NULL; |
|
700097e7206b
Zephyr: fix username validation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35692
diff
changeset
|
1004 | return who; |
|
700097e7206b
Zephyr: fix username validation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35692
diff
changeset
|
1005 | } |
|
700097e7206b
Zephyr: fix username validation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35692
diff
changeset
|
1006 | |
|
39833
cd90938cd6f7
Silence various discarded const warnings.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39831
diff
changeset
|
1007 | gc = purple_account_get_connection((PurpleAccount *)account); |
|
22543
a73c80f1b40d
Fix a crash in the zephyr normalize function that I added when gc is
Mark Doliner <markdoliner@pidgin.im>
parents:
22391
diff
changeset
|
1008 | if (gc == NULL) |
|
a73c80f1b40d
Fix a crash in the zephyr normalize function that I added when gc is
Mark Doliner <markdoliner@pidgin.im>
parents:
22391
diff
changeset
|
1009 | return NULL; |
|
a73c80f1b40d
Fix a crash in the zephyr normalize function that I added when gc is
Mark Doliner <markdoliner@pidgin.im>
parents:
22391
diff
changeset
|
1010 | |
|
40750
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
1011 | tmp = zephyr_normalize_local_realm(purple_connection_get_protocol_data(gc), who); |
|
22391
823ac1e9cfbb
Get rid of some privacy checking code from zephyr that is done in
Mark Doliner <markdoliner@pidgin.im>
parents:
22389
diff
changeset
|
1012 | |
|
823ac1e9cfbb
Get rid of some privacy checking code from zephyr that is done in
Mark Doliner <markdoliner@pidgin.im>
parents:
22389
diff
changeset
|
1013 | if (strlen(tmp) >= sizeof(buf)) { |
|
823ac1e9cfbb
Get rid of some privacy checking code from zephyr that is done in
Mark Doliner <markdoliner@pidgin.im>
parents:
22389
diff
changeset
|
1014 | g_free(tmp); |
|
823ac1e9cfbb
Get rid of some privacy checking code from zephyr that is done in
Mark Doliner <markdoliner@pidgin.im>
parents:
22389
diff
changeset
|
1015 | return NULL; |
|
823ac1e9cfbb
Get rid of some privacy checking code from zephyr that is done in
Mark Doliner <markdoliner@pidgin.im>
parents:
22389
diff
changeset
|
1016 | } |
|
823ac1e9cfbb
Get rid of some privacy checking code from zephyr that is done in
Mark Doliner <markdoliner@pidgin.im>
parents:
22389
diff
changeset
|
1017 | |
|
31954
e5631d5590cc
Replace numerous strcpy() invocations with strlcpy() in Zephyr.
Ethan Blanton <elb@pidgin.im>
parents:
31595
diff
changeset
|
1018 | g_strlcpy(buf, tmp, sizeof(buf)); |
|
22391
823ac1e9cfbb
Get rid of some privacy checking code from zephyr that is done in
Mark Doliner <markdoliner@pidgin.im>
parents:
22389
diff
changeset
|
1019 | g_free(tmp); |
|
823ac1e9cfbb
Get rid of some privacy checking code from zephyr that is done in
Mark Doliner <markdoliner@pidgin.im>
parents:
22389
diff
changeset
|
1020 | |
|
823ac1e9cfbb
Get rid of some privacy checking code from zephyr that is done in
Mark Doliner <markdoliner@pidgin.im>
parents:
22389
diff
changeset
|
1021 | return buf; |
|
823ac1e9cfbb
Get rid of some privacy checking code from zephyr that is done in
Mark Doliner <markdoliner@pidgin.im>
parents:
22389
diff
changeset
|
1022 | } |
|
823ac1e9cfbb
Get rid of some privacy checking code from zephyr that is done in
Mark Doliner <markdoliner@pidgin.im>
parents:
22389
diff
changeset
|
1023 | |
|
40708
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40703
diff
changeset
|
1024 | static void |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40703
diff
changeset
|
1025 | zephyr_zloc(PurpleProtocolServer *protocol_server, PurpleConnection *gc, |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40703
diff
changeset
|
1026 | const gchar *who) |
| 2086 | 1027 | { |
|
32265
8007f413c665
Convert zephyr prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
1028 | zephyr_account *zephyr = purple_connection_get_protocol_data(gc); |
|
40750
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
1029 | gchar *normalized_who = zephyr_normalize_local_realm(zephyr, who); |
|
22197
853f77cffbbd
Part of a large patch from o_sukhodolsky to fix some build warnings.
Richard Laager <rlaager@pidgin.im>
parents:
22104
diff
changeset
|
1030 | |
|
40739
f391d9d9352d
Split zephyr_request_locations
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40737
diff
changeset
|
1031 | if (zephyr->request_locations(zephyr, normalized_who)) { |
|
40635
1f8b5b68a806
Some zephyr cleanups
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40634
diff
changeset
|
1032 | zephyr->pending_zloc_names = g_list_append(zephyr->pending_zloc_names, normalized_who); |
|
1f8b5b68a806
Some zephyr cleanups
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40634
diff
changeset
|
1033 | } else { |
|
1f8b5b68a806
Some zephyr cleanups
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40634
diff
changeset
|
1034 | /* XXX deal with errors somehow */ |
|
1f8b5b68a806
Some zephyr cleanups
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40634
diff
changeset
|
1035 | g_free(normalized_who); |
|
1f8b5b68a806
Some zephyr cleanups
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40634
diff
changeset
|
1036 | } |
|
1f8b5b68a806
Some zephyr cleanups
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40634
diff
changeset
|
1037 | } |
|
1f8b5b68a806
Some zephyr cleanups
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40634
diff
changeset
|
1038 | |
|
1f8b5b68a806
Some zephyr cleanups
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40634
diff
changeset
|
1039 | static void |
|
40708
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40703
diff
changeset
|
1040 | zephyr_set_status(PurpleProtocolServer *protocol_server, |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40703
diff
changeset
|
1041 | PurpleAccount *account, PurpleStatus *status) |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40703
diff
changeset
|
1042 | { |
|
32265
8007f413c665
Convert zephyr prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
1043 | PurpleConnection *gc = purple_account_get_connection(account); |
|
8007f413c665
Convert zephyr prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
1044 | zephyr_account *zephyr = purple_connection_get_protocol_data(gc); |
|
34855
9c289149eed4
Global replaces according to GObject status API
Ankit Vani <a@nevitus.org>
parents:
34811
diff
changeset
|
1045 | PurpleStatusPrimitive primitive = purple_status_type_get_primitive(purple_status_get_status_type(status)); |
| 9986 | 1046 | |
|
37426
6fd4989b77e4
The last of the NULL-checks before free()
Michael McConville <mmcco@mykolab.com>
parents:
37163
diff
changeset
|
1047 | g_free(zephyr->away); |
|
6fd4989b77e4
The last of the NULL-checks before free()
Michael McConville <mmcco@mykolab.com>
parents:
37163
diff
changeset
|
1048 | zephyr->away = NULL; |
|
4111
93b27900416e
[gaim-migrate @ 4326]
Robert McQueen <robot101@debian.org>
parents:
3867
diff
changeset
|
1049 | |
| 15884 | 1050 | if (primitive == PURPLE_STATUS_AWAY) { |
| 1051 | zephyr->away = g_strdup(purple_status_get_attr_string(status,"message")); | |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30138
diff
changeset
|
1052 | } |
| 15884 | 1053 | else if (primitive == PURPLE_STATUS_AVAILABLE) { |
|
40750
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
1054 | zephyr->set_location(zephyr, zephyr->exposure); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30138
diff
changeset
|
1055 | } |
| 15884 | 1056 | else if (primitive == PURPLE_STATUS_INVISIBLE) { |
| 9478 | 1057 | /* XXX handle errors */ |
|
40750
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
1058 | zephyr->set_location(zephyr, EXPOSE_OPSTAFF); |
| 9478 | 1059 | } |
| 2086 | 1060 | } |
| 1061 | ||
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30138
diff
changeset
|
1062 | static GList *zephyr_status_types(PurpleAccount *account) |
| 2086 | 1063 | { |
| 15884 | 1064 | PurpleStatusType *type; |
| 9986 | 1065 | GList *types = NULL; |
| 1066 | ||
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30138
diff
changeset
|
1067 | /* zephyr has several exposures |
| 9986 | 1068 | NONE (where you are hidden, and zephyrs to you are in practice silently dropped -- yes this is wrong) |
| 1069 | OPSTAFF "hidden" | |
| 1070 | REALM-VISIBLE visible to people in local realm | |
| 1071 | REALM-ANNOUNCED REALM-VISIBLE+ plus your logins/logouts are announced to <login,username,*> | |
| 1072 | NET-VISIBLE REALM-ANNOUNCED, plus visible to people in foreign realm | |
| 1073 | NET-ANNOUNCED NET-VISIBLE, plus logins/logouts are announced to <login,username,*> | |
|
12658
4aa7a873628d
[gaim-migrate @ 15001]
Mark Doliner <markdoliner@pidgin.im>
parents:
12645
diff
changeset
|
1074 | |
| 9986 | 1075 | Online will set the user to the exposure they have in their options (defaulting to REALM-VISIBLE), |
| 1076 | Hidden, will set the user's exposure to OPSTAFF | |
| 2086 | 1077 | |
| 9986 | 1078 | Away won't change their exposure but will set an auto away message (for IMs only) |
| 1079 | */ | |
|
12658
4aa7a873628d
[gaim-migrate @ 15001]
Mark Doliner <markdoliner@pidgin.im>
parents:
12645
diff
changeset
|
1080 | |
| 15884 | 1081 | type = purple_status_type_new(PURPLE_STATUS_AVAILABLE, NULL, NULL, TRUE); |
| 9986 | 1082 | types = g_list_append(types,type); |
| 2086 | 1083 | |
| 15884 | 1084 | type = purple_status_type_new(PURPLE_STATUS_INVISIBLE, NULL, NULL, TRUE); |
| 9986 | 1085 | types = g_list_append(types,type); |
| 1086 | ||
| 15884 | 1087 | type = purple_status_type_new_with_attrs( |
| 1088 | PURPLE_STATUS_AWAY, NULL, NULL, TRUE, TRUE, FALSE, | |
|
35005
bff56dfca65d
Renamed purple_g_value_* to purple_value_*
Ankit Vani <a@nevitus.org>
parents:
34955
diff
changeset
|
1089 | "message", _("Message"), purple_value_new(G_TYPE_STRING), |
|
12595
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12467
diff
changeset
|
1090 | NULL); |
| 9986 | 1091 | types = g_list_append(types, type); |
| 1092 | ||
| 15884 | 1093 | type = purple_status_type_new(PURPLE_STATUS_OFFLINE, NULL, NULL, TRUE); |
|
12658
4aa7a873628d
[gaim-migrate @ 15001]
Mark Doliner <markdoliner@pidgin.im>
parents:
12645
diff
changeset
|
1094 | types = g_list_append(types,type); |
|
4aa7a873628d
[gaim-migrate @ 15001]
Mark Doliner <markdoliner@pidgin.im>
parents:
12645
diff
changeset
|
1095 | |
| 9986 | 1096 | return types; |
| 2086 | 1097 | } |
| 1098 | ||
|
40697
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40686
diff
changeset
|
1099 | static GList * |
|
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40686
diff
changeset
|
1100 | zephyr_chat_info(PurpleProtocolChat *protocol_chat, PurpleConnection * gc) { |
|
2205
68c42ce8eba6
[gaim-migrate @ 2215]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2170
diff
changeset
|
1101 | GList *m = NULL; |
|
36555
fc17a4351e63
Replaced struct proto_chat_entry with PurpleProtocolChatEntry
Ankit Vani <a@nevitus.org>
parents:
36545
diff
changeset
|
1102 | PurpleProtocolChatEntry *pce; |
|
fc17a4351e63
Replaced struct proto_chat_entry with PurpleProtocolChatEntry
Ankit Vani <a@nevitus.org>
parents:
36545
diff
changeset
|
1103 | |
|
fc17a4351e63
Replaced struct proto_chat_entry with PurpleProtocolChatEntry
Ankit Vani <a@nevitus.org>
parents:
36545
diff
changeset
|
1104 | pce = g_new0(PurpleProtocolChatEntry, 1); |
|
8644
ba37f1cc0006
[gaim-migrate @ 9396]
Mark Doliner <markdoliner@pidgin.im>
parents:
8641
diff
changeset
|
1105 | |
|
7841
0000a4c68bf8
[gaim-migrate @ 8494]
Mark Doliner <markdoliner@pidgin.im>
parents:
7475
diff
changeset
|
1106 | pce->label = _("_Class:"); |
| 5234 | 1107 | pce->identifier = "class"; |
| 3158 | 1108 | m = g_list_append(m, pce); |
| 2086 | 1109 | |
|
36555
fc17a4351e63
Replaced struct proto_chat_entry with PurpleProtocolChatEntry
Ankit Vani <a@nevitus.org>
parents:
36545
diff
changeset
|
1110 | pce = g_new0(PurpleProtocolChatEntry, 1); |
|
8644
ba37f1cc0006
[gaim-migrate @ 9396]
Mark Doliner <markdoliner@pidgin.im>
parents:
8641
diff
changeset
|
1111 | |
|
7841
0000a4c68bf8
[gaim-migrate @ 8494]
Mark Doliner <markdoliner@pidgin.im>
parents:
7475
diff
changeset
|
1112 | pce->label = _("_Instance:"); |
| 5234 | 1113 | pce->identifier = "instance"; |
| 3158 | 1114 | m = g_list_append(m, pce); |
| 2086 | 1115 | |
|
36555
fc17a4351e63
Replaced struct proto_chat_entry with PurpleProtocolChatEntry
Ankit Vani <a@nevitus.org>
parents:
36545
diff
changeset
|
1116 | pce = g_new0(PurpleProtocolChatEntry, 1); |
|
8644
ba37f1cc0006
[gaim-migrate @ 9396]
Mark Doliner <markdoliner@pidgin.im>
parents:
8641
diff
changeset
|
1117 | |
|
7841
0000a4c68bf8
[gaim-migrate @ 8494]
Mark Doliner <markdoliner@pidgin.im>
parents:
7475
diff
changeset
|
1118 | pce->label = _("_Recipient:"); |
| 5234 | 1119 | pce->identifier = "recipient"; |
| 3158 | 1120 | m = g_list_append(m, pce); |
| 2086 | 1121 | |
|
2205
68c42ce8eba6
[gaim-migrate @ 2215]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2170
diff
changeset
|
1122 | return m; |
| 2086 | 1123 | } |
| 1124 | ||
|
40697
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40686
diff
changeset
|
1125 | static char * |
|
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40686
diff
changeset
|
1126 | zephyr_get_chat_name(PurpleProtocolChat *protocol_chat, GHashTable *data) { |
| 9922 | 1127 | gchar* zclass = g_hash_table_lookup(data,"class"); |
| 1128 | gchar* inst = g_hash_table_lookup(data,"instance"); | |
| 1129 | gchar* recipient = g_hash_table_lookup(data, "recipient"); | |
| 1130 | if (!zclass) /* This should never happen */ | |
| 1131 | zclass = ""; | |
| 1132 | if (!inst) | |
| 1133 | inst = "*"; | |
| 1134 | if (!recipient) | |
| 1135 | recipient = ""; | |
| 1136 | return g_strdup_printf("%s,%s,%s",zclass,inst,recipient); | |
|
9917
2fbb3c9fab2b
[gaim-migrate @ 10809]
Daniel Atallah <datallah@pidgin.im>
parents:
9912
diff
changeset
|
1137 | } |
|
2fbb3c9fab2b
[gaim-migrate @ 10809]
Daniel Atallah <datallah@pidgin.im>
parents:
9912
diff
changeset
|
1138 | |
| 9922 | 1139 | |
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1140 | static void |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1141 | zephyr_triple_open_personal(zephyr_triple *zt, PurpleConnection *gc, char *instance) |
| 2086 | 1142 | { |
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1143 | if (!g_ascii_strcasecmp(instance, "*")) { |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1144 | instance = "PERSONAL"; |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1145 | } |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1146 | zephyr_triple_open(zt, gc, instance); |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1147 | } |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1148 | |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1149 | static void |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1150 | zephyr_join_chat(PurpleConnection *gc, ZSubscription_t *sub) |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1151 | { |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1152 | GSList *l; |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1153 | zephyr_triple *zt; |
|
32265
8007f413c665
Convert zephyr prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
1154 | zephyr_account *zephyr = purple_connection_get_protocol_data(gc); |
|
40150
eda298799a8e
Add some NULL checks to silence scan-build.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40131
diff
changeset
|
1155 | |
|
eda298799a8e
Add some NULL checks to silence scan-build.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40131
diff
changeset
|
1156 | g_return_if_fail(zephyr != NULL); |
|
eda298799a8e
Add some NULL checks to silence scan-build.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40131
diff
changeset
|
1157 | |
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1158 | if (!sub->zsub_class) { |
|
2205
68c42ce8eba6
[gaim-migrate @ 2215]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2170
diff
changeset
|
1159 | return; |
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1160 | } |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1161 | if (!g_ascii_strcasecmp(sub->zsub_class, "%host%")) { |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1162 | sub->zsub_class = zephyr->ourhost; |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1163 | } else if (!g_ascii_strcasecmp(sub->zsub_class, "%canon%")) { |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1164 | sub->zsub_class = zephyr->ourhostcanon; |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1165 | } |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1166 | |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1167 | if (!sub->zsub_classinst || *sub->zsub_classinst == '\0') { |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1168 | sub->zsub_classinst = "*"; |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1169 | } else if (!g_ascii_strcasecmp(sub->zsub_classinst, "%host%")) { |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1170 | sub->zsub_classinst = zephyr->ourhost; |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1171 | } else if (!g_ascii_strcasecmp(sub->zsub_classinst, "%canon%")) { |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1172 | sub->zsub_classinst = zephyr->ourhostcanon; |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1173 | } |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1174 | |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1175 | if (!sub->zsub_recipient || *sub->zsub_recipient == '*') { |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1176 | sub->zsub_recipient = ""; |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1177 | } else if (!g_ascii_strcasecmp(sub->zsub_recipient, "%me%")) { |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1178 | sub->zsub_recipient = zephyr->username; |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1179 | } |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1180 | |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1181 | l = g_slist_find_custom(zephyr->subscrips, &sub, (GCompareFunc)zephyr_triple_subset); |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1182 | if (l) { |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1183 | zt = l->data; |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1184 | if (!zt->open) { |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1185 | zephyr_triple_open_personal(zt, gc, sub->zsub_classinst); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30138
diff
changeset
|
1186 | } |
| 2086 | 1187 | return; |
| 1188 | } | |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30138
diff
changeset
|
1189 | |
|
40750
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
1190 | if (!zephyr->subscribe_to(zephyr, sub)) { |
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1191 | /* Called when the server notifies us a message couldn't get sent */ |
| 9478 | 1192 | /* XXX output better subscription information */ |
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1193 | gchar *subscribe_failed = g_strdup_printf(_("Attempt to subscribe to %s,%s,%s failed"), |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1194 | sub->zsub_class, sub->zsub_classinst, sub->zsub_recipient); |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1195 | purple_notify_error(gc,"", subscribe_failed, NULL, purple_request_cpar_from_connection(gc)); |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1196 | g_free(subscribe_failed); |
| 2086 | 1197 | return; |
| 1198 | } | |
| 1199 | ||
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1200 | zt = zephyr_triple_new(zephyr, sub); |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1201 | zephyr->subscrips = g_slist_append(zephyr->subscrips, zt); |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1202 | zephyr_triple_open_personal(zt, gc, sub->zsub_classinst); |
| 2086 | 1203 | } |
| 1204 | ||
|
40697
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40686
diff
changeset
|
1205 | static void |
|
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40686
diff
changeset
|
1206 | zephyr_protocol_chat_join(PurpleProtocolChat *protocol_chat, |
|
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40686
diff
changeset
|
1207 | PurpleConnection *gc, GHashTable * data) |
|
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40686
diff
changeset
|
1208 | { |
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1209 | ZSubscription_t sub = { |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1210 | .zsub_class = g_hash_table_lookup(data, "class"), |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1211 | .zsub_classinst = g_hash_table_lookup(data, "instance"), |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1212 | .zsub_recipient = g_hash_table_lookup(data, "recipient") |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1213 | }; |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1214 | zephyr_join_chat(gc, &sub); |
|
40697
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40686
diff
changeset
|
1215 | } |
|
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40686
diff
changeset
|
1216 | |
|
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40686
diff
changeset
|
1217 | static void |
|
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40686
diff
changeset
|
1218 | zephyr_chat_leave(PurpleProtocolChat *protocol_chat, PurpleConnection * gc, |
|
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40686
diff
changeset
|
1219 | int id) |
| 2086 | 1220 | { |
|
32265
8007f413c665
Convert zephyr prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
1221 | zephyr_account *zephyr = purple_connection_get_protocol_data(gc); |
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1222 | GSList *l; |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1223 | |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1224 | l = g_slist_find_custom(zephyr->subscrips, GINT_TO_POINTER(id), zephyr_triple_cmp_id); |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1225 | if (l) { |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1226 | zephyr_triple *zt = l->data; |
| 2086 | 1227 | zt->open = FALSE; |
| 9610 | 1228 | zt->id = ++(zephyr->last_id); |
| 2086 | 1229 | } |
| 1230 | } | |
| 1231 | ||
|
40634
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40633
diff
changeset
|
1232 | static PurpleChat * |
|
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40633
diff
changeset
|
1233 | zephyr_find_blist_chat(PurpleProtocolClient *client, PurpleAccount *account, |
|
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40633
diff
changeset
|
1234 | const char *name) |
| 9478 | 1235 | { |
| 15884 | 1236 | PurpleBlistNode *gnode, *cnode; |
| 9478 | 1237 | |
| 1238 | /* XXX needs to be %host%,%canon%, and %me% clean */ | |
|
39665
2172e3b8eeef
Rename some buddy list accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39480
diff
changeset
|
1239 | for (gnode = purple_blist_get_default_root(); gnode; |
|
2172e3b8eeef
Rename some buddy list accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39480
diff
changeset
|
1240 | gnode = purple_blist_node_get_sibling_next(gnode)) { |
|
24945
6678a8c83797
Some more struct hiding.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24398
diff
changeset
|
1241 | for(cnode = purple_blist_node_get_first_child(gnode); |
|
6678a8c83797
Some more struct hiding.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24398
diff
changeset
|
1242 | cnode; |
|
6678a8c83797
Some more struct hiding.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24398
diff
changeset
|
1243 | cnode = purple_blist_node_get_sibling_next(cnode)) { |
| 15884 | 1244 | PurpleChat *chat = (PurpleChat*)cnode; |
|
39918
1c8e11f9274f
Fix several memory leaks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39913
diff
changeset
|
1245 | const gchar *zclass, *inst, *recip; |
| 9478 | 1246 | char** triple; |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23352
diff
changeset
|
1247 | GHashTable *components; |
|
34696
6e0d13978666
Global replace to use GObject-style macros. See details.
Ankit Vani <a@nevitus.org>
parents:
34670
diff
changeset
|
1248 | if(!PURPLE_IS_CHAT(cnode)) |
| 9478 | 1249 | continue; |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23352
diff
changeset
|
1250 | if(purple_chat_get_account(chat) != account) |
| 9478 | 1251 | continue; |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23352
diff
changeset
|
1252 | components = purple_chat_get_components(chat); |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23352
diff
changeset
|
1253 | if(!(zclass = g_hash_table_lookup(components, "class"))) |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23352
diff
changeset
|
1254 | continue; |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23352
diff
changeset
|
1255 | if(!(inst = g_hash_table_lookup(components, "instance"))) |
|
39918
1c8e11f9274f
Fix several memory leaks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39913
diff
changeset
|
1256 | inst = ""; |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23352
diff
changeset
|
1257 | if(!(recip = g_hash_table_lookup(components, "recipient"))) |
|
39918
1c8e11f9274f
Fix several memory leaks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39913
diff
changeset
|
1258 | recip = ""; |
| 15884 | 1259 | /* purple_debug_info("zephyr","in zephyr_find_blist_chat name: %s\n",name?name:""); */ |
| 9478 | 1260 | triple = g_strsplit(name,",",3); |
|
39918
1c8e11f9274f
Fix several memory leaks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39913
diff
changeset
|
1261 | if (!g_ascii_strcasecmp(triple[0], zclass) && |
|
1c8e11f9274f
Fix several memory leaks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39913
diff
changeset
|
1262 | !g_ascii_strcasecmp(triple[1], inst) && |
|
1c8e11f9274f
Fix several memory leaks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39913
diff
changeset
|
1263 | !g_ascii_strcasecmp(triple[2], recip)) { |
|
1c8e11f9274f
Fix several memory leaks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39913
diff
changeset
|
1264 | g_strfreev(triple); |
| 9478 | 1265 | return chat; |
|
39918
1c8e11f9274f
Fix several memory leaks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39913
diff
changeset
|
1266 | } |
|
1c8e11f9274f
Fix several memory leaks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39913
diff
changeset
|
1267 | g_strfreev(triple); |
| 9478 | 1268 | } |
| 1269 | } | |
| 1270 | return NULL; | |
| 1271 | } | |
| 15884 | 1272 | static const char *zephyr_list_icon(PurpleAccount * a, PurpleBuddy * b) |
|
5202
2c78987f497b
[gaim-migrate @ 5568]
Mark Doliner <markdoliner@pidgin.im>
parents:
5136
diff
changeset
|
1273 | { |
|
2c78987f497b
[gaim-migrate @ 5568]
Mark Doliner <markdoliner@pidgin.im>
parents:
5136
diff
changeset
|
1274 | return "zephyr"; |
|
2c78987f497b
[gaim-migrate @ 5568]
Mark Doliner <markdoliner@pidgin.im>
parents:
5136
diff
changeset
|
1275 | } |
|
2c78987f497b
[gaim-migrate @ 5568]
Mark Doliner <markdoliner@pidgin.im>
parents:
5136
diff
changeset
|
1276 | |
|
40813
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40809
diff
changeset
|
1277 | static GList * |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40809
diff
changeset
|
1278 | zephyr_protocol_get_account_options(PurpleProtocol *protocol) { |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40809
diff
changeset
|
1279 | PurpleAccountOption *option; |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40809
diff
changeset
|
1280 | GList *opts = NULL; |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40809
diff
changeset
|
1281 | const gchar *tmp = get_exposure_level(); |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40809
diff
changeset
|
1282 | |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40809
diff
changeset
|
1283 | option = purple_account_option_bool_new(_("Use tzc"), "use_tzc", FALSE); |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40809
diff
changeset
|
1284 | opts = g_list_append(opts, option); |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40809
diff
changeset
|
1285 | |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40809
diff
changeset
|
1286 | option = purple_account_option_string_new(_("tzc command"), "tzc_command", |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40809
diff
changeset
|
1287 | "/usr/bin/tzc -e %s"); |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40809
diff
changeset
|
1288 | opts = g_list_append(opts, option); |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40809
diff
changeset
|
1289 | |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40809
diff
changeset
|
1290 | option = purple_account_option_bool_new(_("Export to .anyone"), |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40809
diff
changeset
|
1291 | "write_anyone", FALSE); |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40809
diff
changeset
|
1292 | opts = g_list_append(opts, option); |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40809
diff
changeset
|
1293 | |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40809
diff
changeset
|
1294 | option = purple_account_option_bool_new(_("Export to .zephyr.subs"), |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40809
diff
changeset
|
1295 | "write_zsubs", FALSE); |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40809
diff
changeset
|
1296 | opts = g_list_append(opts, option); |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40809
diff
changeset
|
1297 | |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40809
diff
changeset
|
1298 | option = purple_account_option_bool_new(_("Import from .anyone"), |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40809
diff
changeset
|
1299 | "read_anyone", TRUE); |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40809
diff
changeset
|
1300 | opts = g_list_append(opts, option); |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40809
diff
changeset
|
1301 | |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40809
diff
changeset
|
1302 | option = purple_account_option_bool_new(_("Import from .zephyr.subs"), |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40809
diff
changeset
|
1303 | "read_zsubs", TRUE); |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40809
diff
changeset
|
1304 | opts = g_list_append(opts, option); |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40809
diff
changeset
|
1305 | |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40809
diff
changeset
|
1306 | option = purple_account_option_string_new(_("Realm"), "realm", ""); |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40809
diff
changeset
|
1307 | opts = g_list_append(opts, option); |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40809
diff
changeset
|
1308 | |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40809
diff
changeset
|
1309 | option = purple_account_option_string_new(_("Exposure"), "exposure_level", |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40809
diff
changeset
|
1310 | tmp); |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40809
diff
changeset
|
1311 | opts = g_list_append(opts, option); |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40809
diff
changeset
|
1312 | |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40809
diff
changeset
|
1313 | option = purple_account_option_string_new(_("Encoding"), "encoding", |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40809
diff
changeset
|
1314 | ZEPHYR_FALLBACK_CHARSET); |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40809
diff
changeset
|
1315 | opts = g_list_append(opts, option); |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40809
diff
changeset
|
1316 | |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40809
diff
changeset
|
1317 | return opts; |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40809
diff
changeset
|
1318 | } |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40809
diff
changeset
|
1319 | |
|
40732
0ac1c00269b1
Send typing for tzc too.
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40715
diff
changeset
|
1320 | static unsigned int |
|
0ac1c00269b1
Send typing for tzc too.
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40715
diff
changeset
|
1321 | zephyr_send_typing(G_GNUC_UNUSED PurpleProtocolIM *im, PurpleConnection *gc, const char *who, PurpleIMTypingState state) |
|
0ac1c00269b1
Send typing for tzc too.
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40715
diff
changeset
|
1322 | { |
|
0ac1c00269b1
Send typing for tzc too.
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40715
diff
changeset
|
1323 | zephyr_account *zephyr; |
| 9478 | 1324 | gchar *recipient; |
|
40732
0ac1c00269b1
Send typing for tzc too.
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40715
diff
changeset
|
1325 | |
|
0ac1c00269b1
Send typing for tzc too.
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40715
diff
changeset
|
1326 | if (state == PURPLE_IM_NOT_TYPING) { |
| 9896 | 1327 | return 0; |
|
40732
0ac1c00269b1
Send typing for tzc too.
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40715
diff
changeset
|
1328 | } |
|
0ac1c00269b1
Send typing for tzc too.
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40715
diff
changeset
|
1329 | |
|
0ac1c00269b1
Send typing for tzc too.
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40715
diff
changeset
|
1330 | zephyr = purple_connection_get_protocol_data(gc); |
| 9478 | 1331 | /* XXX We probably should care if this fails. Or maybe we don't want to */ |
| 1332 | if (!who) { | |
| 15884 | 1333 | purple_debug_info("zephyr", "who is null\n"); |
|
40750
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
1334 | recipient = zephyr_normalize_local_realm(zephyr, ""); |
| 9478 | 1335 | } else { |
| 10111 | 1336 | char *comma = strrchr(who, ','); |
| 9896 | 1337 | /* Don't ping broadcast (chat) recipients */ |
| 1338 | /* The strrchr case finds a realm-stripped broadcast subscription | |
| 1339 | e.g. comma is the last character in the string */ | |
|
40732
0ac1c00269b1
Send typing for tzc too.
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40715
diff
changeset
|
1340 | if (comma && ((*(comma+1) == '\0') || (*(comma+1) == '@'))) { |
| 9896 | 1341 | return 0; |
|
40732
0ac1c00269b1
Send typing for tzc too.
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40715
diff
changeset
|
1342 | } |
|
0ac1c00269b1
Send typing for tzc too.
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40715
diff
changeset
|
1343 | |
|
40750
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
1344 | recipient = zephyr_normalize_local_realm(zephyr, who); |
| 9478 | 1345 | } |
| 1346 | ||
|
40732
0ac1c00269b1
Send typing for tzc too.
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40715
diff
changeset
|
1347 | purple_debug_info("zephyr", "about to send typing notification to %s", recipient); |
|
0ac1c00269b1
Send typing for tzc too.
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40715
diff
changeset
|
1348 | zephyr_send_message(zephyr, "MESSAGE", "PERSONAL", recipient, "", "", "PING"); |
|
0ac1c00269b1
Send typing for tzc too.
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40715
diff
changeset
|
1349 | purple_debug_info("zephyr", "sent typing notification\n"); |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13548
diff
changeset
|
1350 | |
|
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13548
diff
changeset
|
1351 | /* |
|
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13548
diff
changeset
|
1352 | * TODO: Is this correct? It means we will call |
|
35499
c4c5e0a670b1
Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents:
35005
diff
changeset
|
1353 | * purple_serv_send_typing(gc, who, PURPLE_IM_TYPING) once every 15 seconds |
| 15884 | 1354 | * until the Purple user stops typing. |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13548
diff
changeset
|
1355 | */ |
| 9478 | 1356 | return ZEPHYR_TYPING_SEND_TIMEOUT; |
| 1357 | } | |
| 8212 | 1358 | |
| 9434 | 1359 | |
| 1360 | ||
| 15884 | 1361 | static void zephyr_chat_set_topic(PurpleConnection * gc, int id, const char *topic) |
|
8644
ba37f1cc0006
[gaim-migrate @ 9396]
Mark Doliner <markdoliner@pidgin.im>
parents:
8641
diff
changeset
|
1362 | { |
|
ba37f1cc0006
[gaim-migrate @ 9396]
Mark Doliner <markdoliner@pidgin.im>
parents:
8641
diff
changeset
|
1363 | zephyr_triple *zt; |
|
40885
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40865
diff
changeset
|
1364 | PurpleConversation *gcc; |
|
40997
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40985
diff
changeset
|
1365 | PurpleConversationManager *manager; |
| 9896 | 1366 | gchar *topic_utf8; |
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1367 | zephyr_account *zephyr = purple_connection_get_protocol_data(gc); |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1368 | GSList *l; |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1369 | |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1370 | l = g_slist_find_custom(zephyr->subscrips, GINT_TO_POINTER(id), zephyr_triple_cmp_id); |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1371 | if (!l) { |
| 9986 | 1372 | return; |
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1373 | } |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1374 | zt = l->data; |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1375 | |
|
40997
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40985
diff
changeset
|
1376 | manager = purple_conversation_manager_get_default(); |
|
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40985
diff
changeset
|
1377 | gcc = purple_conversation_manager_find_chat(manager, |
|
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40985
diff
changeset
|
1378 | purple_connection_get_account(gc), |
|
997ab408c113
Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents:
40985
diff
changeset
|
1379 | zt->name); |
| 9434 | 1380 | |
|
40750
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
1381 | topic_utf8 = convert_to_utf8(topic, zephyr->encoding); |
|
40885
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40865
diff
changeset
|
1382 | purple_chat_conversation_set_topic(PURPLE_CHAT_CONVERSATION(gcc), zephyr->username, topic_utf8); |
| 9896 | 1383 | g_free(topic_utf8); |
| 9434 | 1384 | } |
| 1385 | ||
|
40697
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40686
diff
changeset
|
1386 | static void |
|
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40686
diff
changeset
|
1387 | zephyr_protocol_chat_set_topic(PurpleProtocolChat *protocol_chat, |
|
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40686
diff
changeset
|
1388 | PurpleConnection *gc, int id, const char *topic) |
|
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40686
diff
changeset
|
1389 | { |
|
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40686
diff
changeset
|
1390 | zephyr_chat_set_topic(gc, id, topic); |
|
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40686
diff
changeset
|
1391 | } |
|
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40686
diff
changeset
|
1392 | |
| 9434 | 1393 | /* commands */ |
| 1394 | ||
| 15884 | 1395 | static PurpleCmdRet zephyr_purple_cmd_msg(PurpleConversation *conv, |
| 9896 | 1396 | const char *cmd, char **args, char **error, void *data) |
| 9434 | 1397 | { |
| 9896 | 1398 | char *recipient; |
|
33694
dabb189b6ac9
zephyr.c: Fix multiple leaks
Niels Thykier <niels@thykier.net>
parents:
32698
diff
changeset
|
1399 | PurpleCmdRet ret; |
|
32698
154e4a2a6287
Our API really shouldn't have a 'gc' in it anymore.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32678
diff
changeset
|
1400 | PurpleConnection *gc = purple_conversation_get_connection(conv); |
|
32265
8007f413c665
Convert zephyr prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
1401 | zephyr_account *zephyr = purple_connection_get_protocol_data(gc);; |
| 9896 | 1402 | if (!g_ascii_strcasecmp(args[0],"*")) |
| 15884 | 1403 | return PURPLE_CMD_RET_FAILED; /* "*" is not a valid argument */ |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30138
diff
changeset
|
1404 | else |
|
40750
e87c321f05fa
Move tzc and zeph02 to own modules and some cleanup
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40739
diff
changeset
|
1405 | recipient = zephyr_normalize_local_realm(zephyr, args[0]); |
| 9434 | 1406 | |
|
33694
dabb189b6ac9
zephyr.c: Fix multiple leaks
Niels Thykier <niels@thykier.net>
parents:
32698
diff
changeset
|
1407 | if (strlen(recipient) < 1) { |
|
dabb189b6ac9
zephyr.c: Fix multiple leaks
Niels Thykier <niels@thykier.net>
parents:
32698
diff
changeset
|
1408 | g_free(recipient); |
| 15884 | 1409 | return PURPLE_CMD_RET_FAILED; /* a null recipient is a chat message, not an IM */ |
|
33694
dabb189b6ac9
zephyr.c: Fix multiple leaks
Niels Thykier <niels@thykier.net>
parents:
32698
diff
changeset
|
1410 | } |
| 9478 | 1411 | |
| 9896 | 1412 | if (zephyr_send_message(zephyr,"MESSAGE","PERSONAL",recipient,args[1],zephyr_get_signature(),"")) |
|
33694
dabb189b6ac9
zephyr.c: Fix multiple leaks
Niels Thykier <niels@thykier.net>
parents:
32698
diff
changeset
|
1413 | ret = PURPLE_CMD_RET_OK; |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30138
diff
changeset
|
1414 | else |
|
33694
dabb189b6ac9
zephyr.c: Fix multiple leaks
Niels Thykier <niels@thykier.net>
parents:
32698
diff
changeset
|
1415 | ret = PURPLE_CMD_RET_FAILED; |
|
dabb189b6ac9
zephyr.c: Fix multiple leaks
Niels Thykier <niels@thykier.net>
parents:
32698
diff
changeset
|
1416 | g_free(recipient); |
|
dabb189b6ac9
zephyr.c: Fix multiple leaks
Niels Thykier <niels@thykier.net>
parents:
32698
diff
changeset
|
1417 | return ret; |
| 9434 | 1418 | } |
| 1419 | ||
| 15884 | 1420 | static PurpleCmdRet zephyr_purple_cmd_zlocate(PurpleConversation *conv, |
| 9896 | 1421 | const char *cmd, char **args, char **error, void *data) |
| 9434 | 1422 | { |
|
40708
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40703
diff
changeset
|
1423 | zephyr_zloc(NULL, purple_conversation_get_connection(conv),args[0]); |
| 15884 | 1424 | return PURPLE_CMD_RET_OK; |
| 9434 | 1425 | } |
| 1426 | ||
| 15884 | 1427 | static PurpleCmdRet zephyr_purple_cmd_instance(PurpleConversation *conv, |
| 9896 | 1428 | const char *cmd, char **args, char **error, void *data) |
| 9434 | 1429 | { |
| 9896 | 1430 | /* Currently it sets the instance with leading spaces and |
| 1431 | * all. This might not be the best thing to do, though having | |
| 1432 | * one word isn't ideal either. */ | |
| 9434 | 1433 | |
| 9896 | 1434 | const char* instance = args[0]; |
|
34643
e261a066d78d
Refactored zephyr protocol to use GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34625
diff
changeset
|
1435 | zephyr_chat_set_topic(purple_conversation_get_connection(conv), |
|
e261a066d78d
Refactored zephyr protocol to use GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34625
diff
changeset
|
1436 | purple_chat_conversation_get_id(PURPLE_CHAT_CONVERSATION(conv)),instance); |
| 15884 | 1437 | return PURPLE_CMD_RET_OK; |
| 9434 | 1438 | } |
| 1439 | ||
| 15884 | 1440 | static PurpleCmdRet zephyr_purple_cmd_joinchat_cir(PurpleConversation *conv, |
| 9896 | 1441 | const char *cmd, char **args, char **error, void *data) |
| 9434 | 1442 | { |
| 9896 | 1443 | /* Join a new zephyr chat */ |
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1444 | ZSubscription_t sub = { |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1445 | .zsub_class = args[0], |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1446 | .zsub_classinst = args[1], |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1447 | .zsub_recipient = args[2] |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1448 | }; |
|
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1449 | zephyr_join_chat(purple_conversation_get_connection(conv), &sub); |
| 15884 | 1450 | return PURPLE_CMD_RET_OK; |
| 9434 | 1451 | } |
| 1452 | ||
| 15884 | 1453 | static PurpleCmdRet zephyr_purple_cmd_zi(PurpleConversation *conv, |
| 9896 | 1454 | const char *cmd, char **args, char **error, void *data) |
| 9434 | 1455 | { |
| 9896 | 1456 | /* args = instance, message */ |
|
32698
154e4a2a6287
Our API really shouldn't have a 'gc' in it anymore.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32678
diff
changeset
|
1457 | PurpleConnection *gc = purple_conversation_get_connection(conv); |
|
32265
8007f413c665
Convert zephyr prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
1458 | zephyr_account *zephyr = purple_connection_get_protocol_data(gc); |
| 9896 | 1459 | if ( zephyr_send_message(zephyr,"message",args[0],"",args[1],zephyr_get_signature(),"")) |
| 15884 | 1460 | return PURPLE_CMD_RET_OK; |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30138
diff
changeset
|
1461 | else |
| 15884 | 1462 | return PURPLE_CMD_RET_FAILED; |
| 9434 | 1463 | } |
| 1464 | ||
| 15884 | 1465 | static PurpleCmdRet zephyr_purple_cmd_zci(PurpleConversation *conv, |
| 9896 | 1466 | const char *cmd, char **args, char **error, void *data) |
| 9434 | 1467 | { |
| 9896 | 1468 | /* args = class, instance, message */ |
|
32698
154e4a2a6287
Our API really shouldn't have a 'gc' in it anymore.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32678
diff
changeset
|
1469 | PurpleConnection *gc = purple_conversation_get_connection(conv); |
|
32265
8007f413c665
Convert zephyr prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
1470 | zephyr_account *zephyr = purple_connection_get_protocol_data(gc); |
| 9896 | 1471 | if ( zephyr_send_message(zephyr,args[0],args[1],"",args[2],zephyr_get_signature(),"")) |
| 15884 | 1472 | return PURPLE_CMD_RET_OK; |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30138
diff
changeset
|
1473 | else |
| 15884 | 1474 | return PURPLE_CMD_RET_FAILED; |
| 9434 | 1475 | } |
|
8644
ba37f1cc0006
[gaim-migrate @ 9396]
Mark Doliner <markdoliner@pidgin.im>
parents:
8641
diff
changeset
|
1476 | |
| 15884 | 1477 | static PurpleCmdRet zephyr_purple_cmd_zcir(PurpleConversation *conv, |
| 9896 | 1478 | const char *cmd, char **args, char **error, void *data) |
| 9434 | 1479 | { |
| 9896 | 1480 | /* args = class, instance, recipient, message */ |
|
32698
154e4a2a6287
Our API really shouldn't have a 'gc' in it anymore.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32678
diff
changeset
|
1481 | PurpleConnection *gc = purple_conversation_get_connection(conv); |
|
32265
8007f413c665
Convert zephyr prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
1482 | zephyr_account *zephyr = purple_connection_get_protocol_data(gc); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30138
diff
changeset
|
1483 | if ( zephyr_send_message(zephyr,args[0],args[1],args[2],args[3],zephyr_get_signature(),"")) |
| 15884 | 1484 | return PURPLE_CMD_RET_OK; |
| 9896 | 1485 | else |
| 15884 | 1486 | return PURPLE_CMD_RET_FAILED; |
| 8212 | 1487 | } |
| 1488 | ||
| 15884 | 1489 | static PurpleCmdRet zephyr_purple_cmd_zir(PurpleConversation *conv, |
| 9896 | 1490 | const char *cmd, char **args, char **error, void *data) |
| 9434 | 1491 | { |
| 9896 | 1492 | /* args = instance, recipient, message */ |
|
32698
154e4a2a6287
Our API really shouldn't have a 'gc' in it anymore.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32678
diff
changeset
|
1493 | PurpleConnection *gc = purple_conversation_get_connection(conv); |
|
32265
8007f413c665
Convert zephyr prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
1494 | zephyr_account *zephyr = purple_connection_get_protocol_data(gc); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30138
diff
changeset
|
1495 | if ( zephyr_send_message(zephyr,"message",args[0],args[1],args[2],zephyr_get_signature(),"")) |
| 15884 | 1496 | return PURPLE_CMD_RET_OK; |
| 9896 | 1497 | else |
| 15884 | 1498 | return PURPLE_CMD_RET_FAILED; |
| 9434 | 1499 | } |
| 1500 | ||
| 15884 | 1501 | static PurpleCmdRet zephyr_purple_cmd_zc(PurpleConversation *conv, |
| 9896 | 1502 | const char *cmd, char **args, char **error, void *data) |
| 9434 | 1503 | { |
| 9896 | 1504 | /* args = class, message */ |
|
32698
154e4a2a6287
Our API really shouldn't have a 'gc' in it anymore.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32678
diff
changeset
|
1505 | PurpleConnection *gc = purple_conversation_get_connection(conv); |
|
32265
8007f413c665
Convert zephyr prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
1506 | zephyr_account *zephyr = purple_connection_get_protocol_data(gc); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30138
diff
changeset
|
1507 | if ( zephyr_send_message(zephyr,args[0],"PERSONAL","",args[1],zephyr_get_signature(),"")) |
| 15884 | 1508 | return PURPLE_CMD_RET_OK; |
| 9896 | 1509 | else |
| 15884 | 1510 | return PURPLE_CMD_RET_FAILED; |
| 9434 | 1511 | } |
| 1512 | ||
|
22104
56970903b8e9
Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@pidgin.im>
parents:
20288
diff
changeset
|
1513 | static void zephyr_register_slash_commands(void) |
| 9434 | 1514 | { |
|
36663
c61b6dbc1f03
Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents:
36653
diff
changeset
|
1515 | PurpleCmdId id; |
|
c61b6dbc1f03
Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents:
36653
diff
changeset
|
1516 | |
|
c61b6dbc1f03
Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents:
36653
diff
changeset
|
1517 | id = purple_cmd_register("msg","ws", PURPLE_CMD_P_PROTOCOL, |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
1518 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PROTOCOL_ONLY, |
| 9896 | 1519 | "prpl-zephyr", |
| 15884 | 1520 | zephyr_purple_cmd_msg, _("msg <nick> <message>: Send a private message to a user"), NULL); |
|
36663
c61b6dbc1f03
Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents:
36653
diff
changeset
|
1521 | cmds = g_slist_prepend(cmds, GUINT_TO_POINTER(id)); |
|
c61b6dbc1f03
Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents:
36653
diff
changeset
|
1522 | |
|
c61b6dbc1f03
Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents:
36653
diff
changeset
|
1523 | id = purple_cmd_register("zlocate","w", PURPLE_CMD_P_PROTOCOL, |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
1524 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PROTOCOL_ONLY, |
| 9896 | 1525 | "prpl-zephyr", |
| 15884 | 1526 | zephyr_purple_cmd_zlocate, _("zlocate <nick>: Locate user"), NULL); |
|
36663
c61b6dbc1f03
Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents:
36653
diff
changeset
|
1527 | cmds = g_slist_prepend(cmds, GUINT_TO_POINTER(id)); |
|
c61b6dbc1f03
Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents:
36653
diff
changeset
|
1528 | |
|
c61b6dbc1f03
Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents:
36653
diff
changeset
|
1529 | id = purple_cmd_register("zl","w", PURPLE_CMD_P_PROTOCOL, |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
1530 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PROTOCOL_ONLY, |
| 9896 | 1531 | "prpl-zephyr", |
| 15884 | 1532 | zephyr_purple_cmd_zlocate, _("zl <nick>: Locate user"), NULL); |
|
36663
c61b6dbc1f03
Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents:
36653
diff
changeset
|
1533 | cmds = g_slist_prepend(cmds, GUINT_TO_POINTER(id)); |
|
c61b6dbc1f03
Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents:
36653
diff
changeset
|
1534 | |
|
c61b6dbc1f03
Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents:
36653
diff
changeset
|
1535 | id = purple_cmd_register("instance","s", PURPLE_CMD_P_PROTOCOL, |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
1536 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PROTOCOL_ONLY, |
| 9896 | 1537 | "prpl-zephyr", |
| 15884 | 1538 | zephyr_purple_cmd_instance, _("instance <instance>: Set the instance to be used on this class"), NULL); |
|
36663
c61b6dbc1f03
Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents:
36653
diff
changeset
|
1539 | cmds = g_slist_prepend(cmds, GUINT_TO_POINTER(id)); |
|
c61b6dbc1f03
Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents:
36653
diff
changeset
|
1540 | |
|
c61b6dbc1f03
Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents:
36653
diff
changeset
|
1541 | id = purple_cmd_register("inst","s", PURPLE_CMD_P_PROTOCOL, |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
1542 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PROTOCOL_ONLY, |
| 9896 | 1543 | "prpl-zephyr", |
| 15884 | 1544 | zephyr_purple_cmd_instance, _("inst <instance>: Set the instance to be used on this class"), NULL); |
|
36663
c61b6dbc1f03
Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents:
36653
diff
changeset
|
1545 | cmds = g_slist_prepend(cmds, GUINT_TO_POINTER(id)); |
|
c61b6dbc1f03
Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents:
36653
diff
changeset
|
1546 | |
|
c61b6dbc1f03
Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents:
36653
diff
changeset
|
1547 | id = purple_cmd_register("topic","s", PURPLE_CMD_P_PROTOCOL, |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
1548 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PROTOCOL_ONLY, |
|
10038
3589c2eed81c
[gaim-migrate @ 10997]
Luke Schierer <lschiere@pidgin.im>
parents:
10009
diff
changeset
|
1549 | "prpl-zephyr", |
| 15884 | 1550 | zephyr_purple_cmd_instance, _("topic <instance>: Set the instance to be used on this class"), NULL); |
|
36663
c61b6dbc1f03
Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents:
36653
diff
changeset
|
1551 | cmds = g_slist_prepend(cmds, GUINT_TO_POINTER(id)); |
|
c61b6dbc1f03
Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents:
36653
diff
changeset
|
1552 | |
|
c61b6dbc1f03
Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents:
36653
diff
changeset
|
1553 | id = purple_cmd_register("sub", "www", PURPLE_CMD_P_PROTOCOL, |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
1554 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PROTOCOL_ONLY, |
| 9896 | 1555 | "prpl-zephyr", |
| 15884 | 1556 | zephyr_purple_cmd_joinchat_cir, |
| 9896 | 1557 | _("sub <class> <instance> <recipient>: Join a new chat"), NULL); |
|
36663
c61b6dbc1f03
Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents:
36653
diff
changeset
|
1558 | cmds = g_slist_prepend(cmds, GUINT_TO_POINTER(id)); |
|
c61b6dbc1f03
Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents:
36653
diff
changeset
|
1559 | |
|
c61b6dbc1f03
Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents:
36653
diff
changeset
|
1560 | id = purple_cmd_register("zi","ws", PURPLE_CMD_P_PROTOCOL, |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
1561 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PROTOCOL_ONLY, |
| 9896 | 1562 | "prpl-zephyr", |
| 15884 | 1563 | zephyr_purple_cmd_zi, _("zi <instance>: Send a message to <message,<i>instance</i>,*>"), NULL); |
|
36663
c61b6dbc1f03
Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents:
36653
diff
changeset
|
1564 | cmds = g_slist_prepend(cmds, GUINT_TO_POINTER(id)); |
|
c61b6dbc1f03
Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents:
36653
diff
changeset
|
1565 | |
|
c61b6dbc1f03
Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents:
36653
diff
changeset
|
1566 | id = purple_cmd_register("zci","wws",PURPLE_CMD_P_PROTOCOL, |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
1567 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PROTOCOL_ONLY, |
| 9896 | 1568 | "prpl-zephyr", |
| 15884 | 1569 | zephyr_purple_cmd_zci, |
| 9896 | 1570 | _("zci <class> <instance>: Send a message to <<i>class</i>,<i>instance</i>,*>"), NULL); |
|
36663
c61b6dbc1f03
Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents:
36653
diff
changeset
|
1571 | cmds = g_slist_prepend(cmds, GUINT_TO_POINTER(id)); |
|
c61b6dbc1f03
Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents:
36653
diff
changeset
|
1572 | |
|
c61b6dbc1f03
Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents:
36653
diff
changeset
|
1573 | id = purple_cmd_register("zcir","wwws",PURPLE_CMD_P_PROTOCOL, |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
1574 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PROTOCOL_ONLY, |
| 9896 | 1575 | "prpl-zephyr", |
| 15884 | 1576 | zephyr_purple_cmd_zcir, |
| 9896 | 1577 | _("zcir <class> <instance> <recipient>: Send a message to <<i>class</i>,<i>instance</i>,<i>recipient</i>>"), NULL); |
|
36663
c61b6dbc1f03
Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents:
36653
diff
changeset
|
1578 | cmds = g_slist_prepend(cmds, GUINT_TO_POINTER(id)); |
|
c61b6dbc1f03
Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents:
36653
diff
changeset
|
1579 | |
|
c61b6dbc1f03
Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents:
36653
diff
changeset
|
1580 | id = purple_cmd_register("zir","wws",PURPLE_CMD_P_PROTOCOL, |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
1581 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PROTOCOL_ONLY, |
| 9896 | 1582 | "prpl-zephyr", |
| 15884 | 1583 | zephyr_purple_cmd_zir, |
| 9896 | 1584 | _("zir <instance> <recipient>: Send a message to <MESSAGE,<i>instance</i>,<i>recipient</i>>"), NULL); |
|
36663
c61b6dbc1f03
Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents:
36653
diff
changeset
|
1585 | cmds = g_slist_prepend(cmds, GUINT_TO_POINTER(id)); |
|
c61b6dbc1f03
Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents:
36653
diff
changeset
|
1586 | |
|
c61b6dbc1f03
Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents:
36653
diff
changeset
|
1587 | id = purple_cmd_register("zc","ws", PURPLE_CMD_P_PROTOCOL, |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
1588 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PROTOCOL_ONLY, |
| 9896 | 1589 | "prpl-zephyr", |
| 15884 | 1590 | zephyr_purple_cmd_zc, _("zc <class>: Send a message to <<i>class</i>,PERSONAL,*>"), NULL); |
|
36663
c61b6dbc1f03
Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents:
36653
diff
changeset
|
1591 | cmds = g_slist_prepend(cmds, GUINT_TO_POINTER(id)); |
|
c61b6dbc1f03
Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents:
36653
diff
changeset
|
1592 | } |
|
c61b6dbc1f03
Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents:
36653
diff
changeset
|
1593 | |
|
c61b6dbc1f03
Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents:
36653
diff
changeset
|
1594 | |
|
c61b6dbc1f03
Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents:
36653
diff
changeset
|
1595 | static void zephyr_unregister_slash_commands(void) |
|
c61b6dbc1f03
Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents:
36653
diff
changeset
|
1596 | { |
|
40052
cc03b5af25ea
Use GSList functions instead of manual iterations
qarkai <qarkai@gmail.com>
parents:
40045
diff
changeset
|
1597 | g_slist_free_full(cmds, (GDestroyNotify)purple_cmd_unregister); |
| 9434 | 1598 | } |
| 1599 | ||
| 1600 | ||
|
40703
153098577f8c
Inline zephyr_resubscribe
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40702
diff
changeset
|
1601 | /* Resubscribe to the in-memory list of subscriptions and also unsubscriptions */ |
|
153098577f8c
Inline zephyr_resubscribe
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40702
diff
changeset
|
1602 | static void |
|
41469
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1603 | zephyr_action_resubscribe(G_GNUC_UNUSED GSimpleAction *action, |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1604 | GVariant *parameter, |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1605 | G_GNUC_UNUSED gpointer data) |
| 9427 | 1606 | { |
|
41469
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1607 | const gchar *account_id = NULL; |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1608 | PurpleAccountManager *manager = NULL; |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1609 | PurpleAccount *account = NULL; |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1610 | PurpleConnection *connection = NULL; |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1611 | zephyr_account *zephyr = NULL; |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1612 | |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1613 | if(!g_variant_is_of_type(parameter, G_VARIANT_TYPE_STRING)) { |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1614 | g_critical("Zephyr resubscribe action parameter is of incorrect type %s", |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1615 | g_variant_get_type_string(parameter)); |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1616 | return; |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1617 | } |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1618 | |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1619 | account_id = g_variant_get_string(parameter, NULL); |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1620 | manager = purple_account_manager_get_default(); |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1621 | account = purple_account_manager_find_by_id(manager, account_id); |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1622 | connection = purple_account_get_connection(account); |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1623 | zephyr = purple_connection_get_protocol_data(connection); |
|
40703
153098577f8c
Inline zephyr_resubscribe
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40702
diff
changeset
|
1624 | |
|
40702
d036174d9e22
zephyr_subscribe_to refactoring
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40701
diff
changeset
|
1625 | for (GSList *s = zephyr->subscrips; s; s = s->next) { |
|
d036174d9e22
zephyr_subscribe_to refactoring
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40701
diff
changeset
|
1626 | zephyr_triple *zt = s->data; |
| 9896 | 1627 | /* XXX We really should care if this fails */ |
|
40733
1bad06536f81
Use ZSubscription_t in zephyr_triple
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40732
diff
changeset
|
1628 | zephyr->subscribe_to(zephyr, &zt->sub); |
| 9896 | 1629 | } |
| 1630 | /* XXX handle unsubscriptions */ | |
| 9427 | 1631 | } |
| 1632 | ||
| 1633 | ||
|
41469
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1634 | static void |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1635 | zephyr_action_get_subs_from_server(G_GNUC_UNUSED GSimpleAction *action, |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1636 | GVariant *parameter, |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1637 | G_GNUC_UNUSED gpointer data) |
| 9478 | 1638 | { |
|
41469
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1639 | const gchar *account_id = NULL; |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1640 | PurpleAccountManager *manager = NULL; |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1641 | PurpleAccount *account = NULL; |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1642 | PurpleConnection *connection = NULL; |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1643 | zephyr_account *zephyr = NULL; |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1644 | |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1645 | if(!g_variant_is_of_type(parameter, G_VARIANT_TYPE_STRING)) { |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1646 | g_critical("Zephyr get subscriptions action parameter is of incorrect type %s", |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1647 | g_variant_get_type_string(parameter)); |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1648 | return; |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1649 | } |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1650 | |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1651 | account_id = g_variant_get_string(parameter, NULL); |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1652 | manager = purple_account_manager_get_default(); |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1653 | account = purple_account_manager_find_by_id(manager, account_id); |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1654 | connection = purple_account_get_connection(account); |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1655 | zephyr = purple_connection_get_protocol_data(connection); |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1656 | |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1657 | zephyr->get_subs_from_server(zephyr, connection); |
| 9478 | 1658 | } |
| 1659 | ||
| 1660 | ||
|
41469
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1661 | static const gchar * |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1662 | zephyr_protocol_actions_get_prefix(PurpleProtocolActions *actions) { |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1663 | return "prpl-zephyr"; |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1664 | } |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1665 | |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1666 | static GActionGroup * |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1667 | zephyr_protocol_actions_get_action_group(PurpleProtocolActions *actions, |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1668 | G_GNUC_UNUSED PurpleConnection *connection) |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1669 | { |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1670 | GSimpleActionGroup *group = NULL; |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1671 | GActionEntry entries[] = { |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1672 | { |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1673 | .name = "resubscribe", |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1674 | .activate = zephyr_action_resubscribe, |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1675 | .parameter_type = "s", |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1676 | }, |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1677 | { |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1678 | .name = "get-subcriptions", |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1679 | .activate = zephyr_action_get_subs_from_server, |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1680 | .parameter_type = "s", |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1681 | }, |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1682 | }; |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1683 | gsize nentries = G_N_ELEMENTS(entries); |
|
36535
66c2fb23888f
Refactored zephye to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1684 | |
|
41469
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1685 | group = g_simple_action_group_new(); |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1686 | g_action_map_add_action_entries(G_ACTION_MAP(group), entries, nentries, |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1687 | NULL); |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1688 | |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1689 | return G_ACTION_GROUP(group); |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1690 | } |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1691 | |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1692 | |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1693 | static GMenu * |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1694 | zephyr_protocol_actions_get_menu(PurpleProtocolActions *actions) { |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1695 | GMenu *menu = NULL; |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1696 | GMenuItem *item = NULL; |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1697 | |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1698 | menu = g_menu_new(); |
| 9427 | 1699 | |
|
41469
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1700 | item = g_menu_item_new(_("Resubscribe"), "prpl-zephyr.resubscribe"); |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1701 | g_menu_item_set_attribute(item, PURPLE_MENU_ATTRIBUTE_DYNAMIC_TARGET, "s", |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1702 | "account"); |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1703 | g_menu_append_item(menu, item); |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1704 | g_object_unref(item); |
| 9478 | 1705 | |
|
41469
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1706 | item = g_menu_item_new(_("Retrieve subscriptions from server"), |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1707 | "prpl-zephyr.get-subscriptions"); |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1708 | g_menu_item_set_attribute(item, PURPLE_MENU_ATTRIBUTE_DYNAMIC_TARGET, "s", |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1709 | "account"); |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1710 | g_menu_append_item(menu, item); |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1711 | g_object_unref(item); |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1712 | |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1713 | return menu; |
| 9427 | 1714 | } |
| 1715 | ||
|
36600
c7d2eee19333
Refactored zephyr to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
1716 | |
|
c7d2eee19333
Refactored zephyr to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
1717 | static void |
|
39894
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
1718 | zephyr_protocol_init(ZephyrProtocol *self) |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1719 | { |
|
36684
ecc74498e088
Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents:
36678
diff
changeset
|
1720 | } |
|
ecc74498e088
Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents:
36678
diff
changeset
|
1721 | |
|
ecc74498e088
Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents:
36678
diff
changeset
|
1722 | |
|
ecc74498e088
Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents:
36678
diff
changeset
|
1723 | static void |
|
39894
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
1724 | zephyr_protocol_class_init(ZephyrProtocolClass *klass) |
|
36684
ecc74498e088
Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents:
36678
diff
changeset
|
1725 | { |
|
39894
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
1726 | PurpleProtocolClass *protocol_class = PURPLE_PROTOCOL_CLASS(klass); |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
1727 | |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
1728 | protocol_class->login = zephyr_login; |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
1729 | protocol_class->close = zephyr_close; |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
1730 | protocol_class->status_types = zephyr_status_types; |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
1731 | protocol_class->list_icon = zephyr_list_icon; |
|
40813
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40809
diff
changeset
|
1732 | |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40809
diff
changeset
|
1733 | protocol_class->get_account_options = zephyr_protocol_get_account_options; |
|
39894
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
1734 | } |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
1735 | |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
1736 | |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
1737 | static void |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
1738 | zephyr_protocol_class_finalize(G_GNUC_UNUSED ZephyrProtocolClass *klass) |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
1739 | { |
|
36663
c61b6dbc1f03
Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents:
36653
diff
changeset
|
1740 | } |
|
c61b6dbc1f03
Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents:
36653
diff
changeset
|
1741 | |
|
c61b6dbc1f03
Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents:
36653
diff
changeset
|
1742 | |
|
36600
c7d2eee19333
Refactored zephyr to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
1743 | static void |
|
41469
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1744 | zephyr_protocol_actions_iface_init(PurpleProtocolActionsInterface *iface) |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1745 | { |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1746 | iface->get_prefix = zephyr_protocol_actions_get_prefix; |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1747 | iface->get_action_group = zephyr_protocol_actions_get_action_group; |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1748 | iface->get_menu = zephyr_protocol_actions_get_menu; |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1749 | } |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1750 | |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1751 | static void |
|
39757
4a5ba806d8c9
Rename *Iface to more standard names.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39665
diff
changeset
|
1752 | zephyr_protocol_client_iface_init(PurpleProtocolClientInterface *client_iface) |
|
36600
c7d2eee19333
Refactored zephyr to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
1753 | { |
|
36737
1ce884985d2d
Refactored yahoo, zephyr to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
1754 | client_iface->normalize = zephyr_normalize; |
|
1ce884985d2d
Refactored yahoo, zephyr to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
1755 | client_iface->find_blist_chat = zephyr_find_blist_chat; |
|
1ce884985d2d
Refactored yahoo, zephyr to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
1756 | } |
|
1ce884985d2d
Refactored yahoo, zephyr to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
1757 | |
|
1ce884985d2d
Refactored yahoo, zephyr to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
1758 | |
|
1ce884985d2d
Refactored yahoo, zephyr to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
1759 | static void |
|
39757
4a5ba806d8c9
Rename *Iface to more standard names.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39665
diff
changeset
|
1760 | zephyr_protocol_server_iface_init(PurpleProtocolServerInterface *server_iface) |
|
36737
1ce884985d2d
Refactored yahoo, zephyr to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
1761 | { |
|
1ce884985d2d
Refactored yahoo, zephyr to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
1762 | server_iface->get_info = zephyr_zloc; |
|
1ce884985d2d
Refactored yahoo, zephyr to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
1763 | server_iface->set_status = zephyr_set_status; |
|
1ce884985d2d
Refactored yahoo, zephyr to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
1764 | |
|
1ce884985d2d
Refactored yahoo, zephyr to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
1765 | server_iface->set_info = NULL; /* XXX Location? */ |
|
1ce884985d2d
Refactored yahoo, zephyr to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
1766 | server_iface->set_buddy_icon = NULL; /* XXX */ |
|
1ce884985d2d
Refactored yahoo, zephyr to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
1767 | } |
|
1ce884985d2d
Refactored yahoo, zephyr to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
1768 | |
|
1ce884985d2d
Refactored yahoo, zephyr to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
1769 | |
|
1ce884985d2d
Refactored yahoo, zephyr to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
1770 | static void |
|
39757
4a5ba806d8c9
Rename *Iface to more standard names.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39665
diff
changeset
|
1771 | zephyr_protocol_im_iface_init(PurpleProtocolIMInterface *im_iface) |
|
36737
1ce884985d2d
Refactored yahoo, zephyr to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
1772 | { |
|
1ce884985d2d
Refactored yahoo, zephyr to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
1773 | im_iface->send = zephyr_send_im; |
|
1ce884985d2d
Refactored yahoo, zephyr to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
1774 | im_iface->send_typing = zephyr_send_typing; |
|
1ce884985d2d
Refactored yahoo, zephyr to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
1775 | } |
|
1ce884985d2d
Refactored yahoo, zephyr to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
1776 | |
|
1ce884985d2d
Refactored yahoo, zephyr to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
1777 | |
|
1ce884985d2d
Refactored yahoo, zephyr to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
1778 | static void |
|
39757
4a5ba806d8c9
Rename *Iface to more standard names.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39665
diff
changeset
|
1779 | zephyr_protocol_chat_iface_init(PurpleProtocolChatInterface *chat_iface) |
|
36737
1ce884985d2d
Refactored yahoo, zephyr to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
1780 | { |
|
1ce884985d2d
Refactored yahoo, zephyr to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
1781 | chat_iface->info = zephyr_chat_info; |
|
40697
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40686
diff
changeset
|
1782 | chat_iface->join = zephyr_protocol_chat_join; |
|
36737
1ce884985d2d
Refactored yahoo, zephyr to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
1783 | chat_iface->get_name = zephyr_get_chat_name; |
|
1ce884985d2d
Refactored yahoo, zephyr to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
1784 | chat_iface->leave = zephyr_chat_leave; |
|
1ce884985d2d
Refactored yahoo, zephyr to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
1785 | chat_iface->send = zephyr_chat_send; |
|
40697
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40686
diff
changeset
|
1786 | chat_iface->set_topic = zephyr_protocol_chat_set_topic; |
|
36737
1ce884985d2d
Refactored yahoo, zephyr to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
1787 | |
|
1ce884985d2d
Refactored yahoo, zephyr to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
1788 | chat_iface->get_user_real_name = NULL; /* XXX */ |
|
36600
c7d2eee19333
Refactored zephyr to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
1789 | } |
|
c7d2eee19333
Refactored zephyr to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
1790 | |
|
c7d2eee19333
Refactored zephyr to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
1791 | |
|
39894
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
1792 | G_DEFINE_DYNAMIC_TYPE_EXTENDED( |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
1793 | ZephyrProtocol, zephyr_protocol, PURPLE_TYPE_PROTOCOL, 0, |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
1794 | |
|
41469
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1795 | G_IMPLEMENT_INTERFACE_DYNAMIC(PURPLE_TYPE_PROTOCOL_ACTIONS, |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1796 | zephyr_protocol_actions_iface_init) |
|
4ba7001d8a86
Convert Zephyr to new actions interface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41348
diff
changeset
|
1797 | |
|
39894
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
1798 | G_IMPLEMENT_INTERFACE_DYNAMIC(PURPLE_TYPE_PROTOCOL_CLIENT, |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
1799 | zephyr_protocol_client_iface_init) |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
1800 | |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
1801 | G_IMPLEMENT_INTERFACE_DYNAMIC(PURPLE_TYPE_PROTOCOL_SERVER, |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
1802 | zephyr_protocol_server_iface_init) |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
1803 | |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
1804 | G_IMPLEMENT_INTERFACE_DYNAMIC(PURPLE_TYPE_PROTOCOL_IM, |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
1805 | zephyr_protocol_im_iface_init) |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
1806 | |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
1807 | G_IMPLEMENT_INTERFACE_DYNAMIC(PURPLE_TYPE_PROTOCOL_CHAT, |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
1808 | zephyr_protocol_chat_iface_init)); |
|
36714
ec178f7d66da
Refactored protocols to use the new type definition macros
Ankit Vani <a@nevitus.org>
parents:
36684
diff
changeset
|
1809 | |
|
40813
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40809
diff
changeset
|
1810 | static PurpleProtocol * |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40809
diff
changeset
|
1811 | zephyr_protocol_new(void) { |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40809
diff
changeset
|
1812 | return PURPLE_PROTOCOL(g_object_new( |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40809
diff
changeset
|
1813 | ZEPHYR_TYPE_PROTOCOL, |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40809
diff
changeset
|
1814 | "id", "prpl-zephyr", |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40809
diff
changeset
|
1815 | "name", "Zephyr", |
|
41348
74b1a5db343b
Mark the protocol descriptions for translation and tweak them a bit.
Gary Kramlich <grim@reaperworld.com>
parents:
41078
diff
changeset
|
1816 | "description", _("The chat component of Project Athena."), |
|
41075
94a357cfec6c
move the zephyr protocol plugins icons to a resource in the plugin
Gary Kramlich <grim@reaperworld.com>
parents:
40997
diff
changeset
|
1817 | "icon-name", "im-zephyr", |
|
94a357cfec6c
move the zephyr protocol plugins icons to a resource in the plugin
Gary Kramlich <grim@reaperworld.com>
parents:
40997
diff
changeset
|
1818 | "icon-resource-path", "/im/pidgin/libpurple/zephyr/icons", |
|
40813
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40809
diff
changeset
|
1819 | "options", OPT_PROTO_CHAT_TOPIC | OPT_PROTO_NO_PASSWORD, |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40809
diff
changeset
|
1820 | NULL)); |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40809
diff
changeset
|
1821 | } |
|
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40809
diff
changeset
|
1822 | |
|
40945
bbeb2e98ea5b
Use GPLUGIN_NATIVE_PLUGIN_DECLARE for all libpurple plugins and remove PURPLE_PLUGIN_INIT
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
1823 | static GPluginPluginInfo * |
|
bbeb2e98ea5b
Use GPLUGIN_NATIVE_PLUGIN_DECLARE for all libpurple plugins and remove PURPLE_PLUGIN_INIT
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
1824 | zephyr_query(GError **error) |
|
36535
66c2fb23888f
Refactored zephye to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1825 | { |
|
66c2fb23888f
Refactored zephye to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1826 | return purple_plugin_info_new( |
|
36985
9faafe43603e
Rename protocol plugin IDs to prpl-*
Ankit Vani <a@nevitus.org>
parents:
36862
diff
changeset
|
1827 | "id", "prpl-zephyr", |
|
36638
5f6dcd83e8c1
Seperate plugin and protocol IDs. Protocol ID example: "msn". Plugin ID example: "protocol-msn".
Ankit Vani <a@nevitus.org>
parents:
36637
diff
changeset
|
1828 | "name", "Zephyr Protocol", |
|
36535
66c2fb23888f
Refactored zephye to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1829 | "version", DISPLAY_VERSION, |
|
66c2fb23888f
Refactored zephye to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1830 | "category", N_("Protocol"), |
|
66c2fb23888f
Refactored zephye to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1831 | "summary", N_("Zephyr Protocol Plugin"), |
|
66c2fb23888f
Refactored zephye to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1832 | "description", N_("Zephyr Protocol Plugin"), |
|
66c2fb23888f
Refactored zephye to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1833 | "website", PURPLE_WEBSITE, |
|
66c2fb23888f
Refactored zephye to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1834 | "abi-version", PURPLE_ABI_VERSION, |
|
36653
4084c34c051d
Override gplugin info's "flags" property. Added PURPLE_PLUGIN_INFO_FLAGS_INTERNAL and PURPLE_PLUGIN_INFO_FLAGS_AUTO_LOAD.
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
1835 | "flags", PURPLE_PLUGIN_INFO_FLAGS_INTERNAL | |
|
4084c34c051d
Override gplugin info's "flags" property. Added PURPLE_PLUGIN_INFO_FLAGS_INTERNAL and PURPLE_PLUGIN_INFO_FLAGS_AUTO_LOAD.
Ankit Vani <a@nevitus.org>
parents:
36638
diff
changeset
|
1836 | PURPLE_PLUGIN_INFO_FLAGS_AUTO_LOAD, |
|
36535
66c2fb23888f
Refactored zephye to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1837 | NULL |
|
66c2fb23888f
Refactored zephye to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1838 | ); |
|
66c2fb23888f
Refactored zephye to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1839 | } |
|
66c2fb23888f
Refactored zephye to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1840 | |
|
36600
c7d2eee19333
Refactored zephyr to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
1841 | |
|
c7d2eee19333
Refactored zephyr to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
1842 | static gboolean |
|
40945
bbeb2e98ea5b
Use GPLUGIN_NATIVE_PLUGIN_DECLARE for all libpurple plugins and remove PURPLE_PLUGIN_INIT
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
1843 | zephyr_load(GPluginPlugin *plugin, GError **error) |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1844 | { |
|
40800
be00e9c87cb7
Convert all of the protocols to use the new protocol_manager_ api
Gary Kramlich <grim@reaperworld.com>
parents:
40778
diff
changeset
|
1845 | PurpleProtocolManager *manager = purple_protocol_manager_get_default(); |
|
be00e9c87cb7
Convert all of the protocols to use the new protocol_manager_ api
Gary Kramlich <grim@reaperworld.com>
parents:
40778
diff
changeset
|
1846 | |
|
39894
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
1847 | zephyr_protocol_register_type(G_TYPE_MODULE(plugin)); |
|
36714
ec178f7d66da
Refactored protocols to use the new type definition macros
Ankit Vani <a@nevitus.org>
parents:
36684
diff
changeset
|
1848 | |
|
40813
71305a7d7423
Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
40809
diff
changeset
|
1849 | my_protocol = zephyr_protocol_new(); |
|
40800
be00e9c87cb7
Convert all of the protocols to use the new protocol_manager_ api
Gary Kramlich <grim@reaperworld.com>
parents:
40778
diff
changeset
|
1850 | if(!purple_protocol_manager_register(manager, my_protocol, error)) { |
|
be00e9c87cb7
Convert all of the protocols to use the new protocol_manager_ api
Gary Kramlich <grim@reaperworld.com>
parents:
40778
diff
changeset
|
1851 | g_clear_object(&my_protocol); |
|
be00e9c87cb7
Convert all of the protocols to use the new protocol_manager_ api
Gary Kramlich <grim@reaperworld.com>
parents:
40778
diff
changeset
|
1852 | |
|
36600
c7d2eee19333
Refactored zephyr to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
1853 | return FALSE; |
|
40800
be00e9c87cb7
Convert all of the protocols to use the new protocol_manager_ api
Gary Kramlich <grim@reaperworld.com>
parents:
40778
diff
changeset
|
1854 | } |
|
36600
c7d2eee19333
Refactored zephyr to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
1855 | |
| 9896 | 1856 | zephyr_register_slash_commands(); |
|
36677
081733748bbc
Only initialize/finalize protocol class data in *_base_init/finalize for protocols.
Ankit Vani <a@nevitus.org>
parents:
36663
diff
changeset
|
1857 | |
|
36535
66c2fb23888f
Refactored zephye to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1858 | return TRUE; |
| 2086 | 1859 | } |
| 1860 | ||
|
36600
c7d2eee19333
Refactored zephyr to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
1861 | |
|
c7d2eee19333
Refactored zephyr to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
1862 | static gboolean |
|
41078
84e48180ef67
Update to gplugin 0.35.0
Gary Kramlich <grim@reaperworld.com>
parents:
41075
diff
changeset
|
1863 | zephyr_unload(GPluginPlugin *plugin, gboolean shutdown, GError **error) |
|
36535
66c2fb23888f
Refactored zephye to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1864 | { |
|
40800
be00e9c87cb7
Convert all of the protocols to use the new protocol_manager_ api
Gary Kramlich <grim@reaperworld.com>
parents:
40778
diff
changeset
|
1865 | PurpleProtocolManager *manager = purple_protocol_manager_get_default(); |
|
be00e9c87cb7
Convert all of the protocols to use the new protocol_manager_ api
Gary Kramlich <grim@reaperworld.com>
parents:
40778
diff
changeset
|
1866 | |
|
be00e9c87cb7
Convert all of the protocols to use the new protocol_manager_ api
Gary Kramlich <grim@reaperworld.com>
parents:
40778
diff
changeset
|
1867 | if(!purple_protocol_manager_unregister(manager, my_protocol, error)) { |
|
be00e9c87cb7
Convert all of the protocols to use the new protocol_manager_ api
Gary Kramlich <grim@reaperworld.com>
parents:
40778
diff
changeset
|
1868 | return FALSE; |
|
be00e9c87cb7
Convert all of the protocols to use the new protocol_manager_ api
Gary Kramlich <grim@reaperworld.com>
parents:
40778
diff
changeset
|
1869 | } |
|
be00e9c87cb7
Convert all of the protocols to use the new protocol_manager_ api
Gary Kramlich <grim@reaperworld.com>
parents:
40778
diff
changeset
|
1870 | |
|
36677
081733748bbc
Only initialize/finalize protocol class data in *_base_init/finalize for protocols.
Ankit Vani <a@nevitus.org>
parents:
36663
diff
changeset
|
1871 | zephyr_unregister_slash_commands(); |
|
081733748bbc
Only initialize/finalize protocol class data in *_base_init/finalize for protocols.
Ankit Vani <a@nevitus.org>
parents:
36663
diff
changeset
|
1872 | |
|
40800
be00e9c87cb7
Convert all of the protocols to use the new protocol_manager_ api
Gary Kramlich <grim@reaperworld.com>
parents:
40778
diff
changeset
|
1873 | g_clear_object(&my_protocol); |
|
36600
c7d2eee19333
Refactored zephyr to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
1874 | |
|
36535
66c2fb23888f
Refactored zephye to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1875 | return TRUE; |
|
66c2fb23888f
Refactored zephye to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1876 | } |
|
66c2fb23888f
Refactored zephye to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1877 | |
|
40945
bbeb2e98ea5b
Use GPLUGIN_NATIVE_PLUGIN_DECLARE for all libpurple plugins and remove PURPLE_PLUGIN_INIT
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
1878 | GPLUGIN_NATIVE_PLUGIN_DECLARE(zephyr) |