Mercurial > pidgin.yaz
annotate src/protocols/gg/gg.c @ 12220:64254fbabc7b
[gaim-migrate @ 14522]
SF Patch #1363787 from Bartosz Oler
"This is a fix to the 'Find buddies' command in which,
after the search results window was closed, prpl's
internal state was not cleared. A minor modification in
the notify API was required.
This patch also adds a few more notifications for the
user."
There also appears to be a few unrelated GG prpl updates in here. I noticed that more strings are marked for translation now.
I made several changes to this patch. I also found out that we're not honoring the callbacks passed in to the notify API. That's a bug since we document them. I'm not in the mood to fix it. I changed GCallback to GHookFunc as it has the right type (whereas GCallback did not). The name isn't too bad either. I didn't really want to create a new callback function typedef.
committer: Tailor Script <tailor@pidgin.im>
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Fri, 25 Nov 2005 01:33:10 +0000 |
parents | 4d3119205a33 |
children | ca27de274225 |
rev | line source |
---|---|
11394 | 1 /** |
2 * @file gg.c Gadu-Gadu protocol plugin | |
3 * | |
4 * gaim | |
5 * | |
6 * Copyright (C) 2005 Bartosz Oler <bartosz@bzimage.us> | |
7 * | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
8 * Some parts of the code are adapted or taken from the previous implementation |
11394 | 9 * of this plugin written by Arkadiusz Miskiewicz <misiek@pld.org.pl> |
10 * | |
11 * Thanks to Google's Summer of Code Program. | |
12 * | |
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 | |
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
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 | |
25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
26 */ | |
27 | |
11360 | 28 |
2393 | 29 /* |
11360 | 30 * NOTES |
2393 | 31 * |
11360 | 32 * I don't like automatic updates of the buddylist stored on the server, so not |
33 * going to implement this. Maybe some kind of option to enable/disable this | |
34 * feature. | |
2393 | 35 */ |
11360 | 36 |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
37 #include "internal.h" |
2393 | 38 |
11360 | 39 #include "plugin.h" |
40 #include "version.h" | |
41 #include "notify.h" | |
42 #include "status.h" | |
9030 | 43 #include "blist.h" |
11360 | 44 #include "accountopt.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
45 #include "debug.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
46 #include "util.h" |
11360 | 47 #include "request.h" |
2393 | 48 |
11360 | 49 #include "lib/libgadu.h" |
5603 | 50 |
11414 | 51 #include "gg.h" |
52 #include "confer.h" | |
53 #include "search.h" | |
54 #include "buddylist.h" | |
55 #include "utils.h" | |
11394 | 56 |
11414 | 57 static GaimPlugin *my_protocol = NULL; |
11394 | 58 |
11360 | 59 /* ---------------------------------------------------------------------- */ |
11414 | 60 /* ----- EXTERNAL CALLBACKS --------------------------------------------- */ |
11360 | 61 /* ---------------------------------------------------------------------- */ |
9950 | 62 |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
63 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
64 /* ----- HELPERS -------------------------------------------------------- */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
65 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
66 /* |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
67 */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
68 /* static void ggp_async_token_handler(gpointer _gc, gint fd, GaimInputCondition cond) {{{ */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
69 static void ggp_async_token_handler(gpointer _gc, gint fd, GaimInputCondition cond) |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
70 { |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
71 GaimConnection *gc = _gc; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
72 GGPInfo *info = gc->proto_data; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
73 GGPToken *token = info->token; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
74 GGPTokenCallback cb; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
75 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
76 struct gg_token *t = NULL; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
77 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
78 gaim_debug_info("gg", "token_handler: token->req->fd = %d\n", token->req->fd); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
79 gaim_debug_info("gg", "token_handler: token->req: check = %d; state = %d;\n", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
80 token->req->check, token->req->state); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
81 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
82 if (gg_token_watch_fd(token->req) == -1 || token->req->state == GG_STATE_ERROR) { |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
83 gaim_debug_error("gg", "token error (1): %d\n", token->req->error); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
84 gaim_input_remove(token->inpa); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
85 gg_token_free(token->req); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
86 token->req = NULL; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
87 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
88 gaim_notify_error(gaim_connection_get_account(gc), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
89 _("Token Error"), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
90 _("Unable to fetch the token.\n"), NULL); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
91 return; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
92 } |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
93 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
94 if (token->req->state != GG_STATE_DONE) { |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
95 gaim_input_remove(token->inpa); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
96 token->inpa = gaim_input_add(token->req->fd, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
97 (token->req->check == 1) |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
98 ? GAIM_INPUT_WRITE |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
99 : GAIM_INPUT_READ, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
100 ggp_async_token_handler, gc); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
101 return; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
102 } |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
103 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
104 if (!(t = token->req->data) || !token->req->body) { |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
105 gaim_debug_error("gg", "token error (2): %d\n", token->req->error); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
106 gaim_input_remove(token->inpa); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
107 gg_token_free(token->req); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
108 token->req = NULL; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
109 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
110 gaim_notify_error(gaim_connection_get_account(gc), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
111 _("Token Error"), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
112 _("Unable to fetch the token.\n"), NULL); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
113 return; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
114 } |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
115 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
116 gaim_input_remove(token->inpa); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
117 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
118 token->id = g_strdup(t->tokenid); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
119 token->size = token->req->body_size; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
120 token->data = g_new0(char, token->size); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
121 memcpy(token->data, token->req->body, token->size); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
122 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
123 gaim_debug_info("gg", "TOKEN! tokenid = %s; size = %d\n", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
124 token->id, token->size); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
125 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
126 gg_token_free(token->req); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
127 token->req = NULL; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
128 token->inpa = 0; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
129 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
130 cb = token->cb; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
131 token->cb = NULL; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
132 cb(gc); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
133 } |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
134 /* }}} */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
135 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
136 /* |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
137 */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
138 /* static void ggp_token_request(GaimConnection *gc, GGPTokenCallback cb) {{{ */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
139 static void ggp_token_request(GaimConnection *gc, GGPTokenCallback cb) |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
140 { |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
141 GGPInfo *info = gc->proto_data; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
142 struct gg_http *req; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
143 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
144 if ((req = gg_token(1)) == NULL) { |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
145 gaim_notify_error(gaim_connection_get_account(gc), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
146 _("Token Error"), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
147 _("Unable to fetch the token.\n"), NULL); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
148 return; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
149 } |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
150 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
151 info->token = g_new(GGPToken, 1); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
152 info->token->cb = cb; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
153 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
154 info->token->req = req; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
155 info->token->inpa = gaim_input_add(req->fd, GAIM_INPUT_READ, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
156 ggp_async_token_handler, gc); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
157 } |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
158 /* }}} */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
159 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
160 /* ---------------------------------------------------------------------- */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
161 |
11360 | 162 /** |
163 * Request buddylist from the server. | |
164 * Buddylist is received in the ggp_callback_recv(). | |
165 * | |
166 * @param Current action handler. | |
167 */ | |
168 /* static void ggp_action_buddylist_get(GaimPluginAction *action) {{{ */ | |
169 static void ggp_action_buddylist_get(GaimPluginAction *action) | |
170 { | |
171 GaimConnection *gc = (GaimConnection *)action->context; | |
172 GGPInfo *info = gc->proto_data; | |
173 | |
174 gaim_debug_info("gg", "Downloading...\n"); | |
175 | |
176 gg_userlist_request(info->session, GG_USERLIST_GET, NULL); | |
177 } | |
178 /* }}} */ | |
179 | |
180 /** | |
181 * Upload the buddylist to the server. | |
182 * | |
183 * @param action Current action handler. | |
184 */ | |
185 /* static void ggp_action_buddylist_put(GaimPluginAction *action) {{{ */ | |
186 static void ggp_action_buddylist_put(GaimPluginAction *action) | |
187 { | |
188 GaimConnection *gc = (GaimConnection *)action->context; | |
189 GGPInfo *info = gc->proto_data; | |
190 | |
191 char *buddylist = ggp_buddylist_dump(gaim_connection_get_account(gc)); | |
192 | |
193 gaim_debug_info("gg", "Uploading...\n"); | |
194 | |
195 if (buddylist == NULL) | |
196 return; | |
197 | |
198 gg_userlist_request(info->session, GG_USERLIST_PUT, buddylist); | |
199 g_free(buddylist); | |
200 } | |
201 /* }}} */ | |
202 | |
203 /** | |
204 * Delete buddylist from the server. | |
205 * | |
206 * @param action Current action handler. | |
207 */ | |
208 /* static void ggp_action_buddylist_delete(GaimPluginAction *action) {{{ */ | |
209 static void ggp_action_buddylist_delete(GaimPluginAction *action) | |
210 { | |
211 GaimConnection *gc = (GaimConnection *)action->context; | |
212 GGPInfo *info = gc->proto_data; | |
213 | |
214 gaim_debug_info("gg", "Deleting...\n"); | |
215 | |
216 gg_userlist_request(info->session, GG_USERLIST_PUT, NULL); | |
217 } | |
218 /* }}} */ | |
219 | |
220 /* | |
221 */ | |
222 /* static void ggp_callback_buddylist_save_ok(GaimConnection *gc, gchar *file) {{{ */ | |
223 static void ggp_callback_buddylist_save_ok(GaimConnection *gc, gchar *file) | |
224 { | |
225 GaimAccount *account = gaim_connection_get_account(gc); | |
226 | |
227 FILE *fh; | |
228 char *buddylist = ggp_buddylist_dump(account); | |
229 gchar *msg; | |
230 | |
231 gaim_debug_info("gg", "Saving...\n"); | |
232 gaim_debug_info("gg", "file = %s\n", file); | |
233 | |
234 if (buddylist == NULL) { | |
235 gaim_notify_info(account, _("Save Buddylist..."), | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
236 _("Your buddylist is empty, nothing was written to the file."), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
237 NULL); |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
238 return; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
239 } |
2393 | 240 |
11360 | 241 if ((fh = g_fopen(file, "wb")) == NULL) { |
242 msg = g_strconcat(_("Couldn't open file"), ": ", file, "\n", NULL); | |
243 gaim_debug_error("gg", "Could not open file: %s\n", file); | |
244 gaim_notify_error(account, _("Couldn't open file"), msg, NULL); | |
245 g_free(msg); | |
246 g_free(file); | |
247 return; | |
248 } | |
249 | |
250 fwrite(buddylist, sizeof(char), g_utf8_strlen(buddylist, -1), fh); | |
251 fclose(fh); | |
252 g_free(buddylist); | |
253 | |
254 gaim_notify_info(account, _("Save Buddylist..."), | |
255 _("Buddylist saved successfully!"), NULL); | |
256 } | |
257 /* }}} */ | |
2806
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
258 |
11360 | 259 /* |
260 */ | |
261 /* static void ggp_callback_buddylist_load_ok(GaimConnection *gc, gchar *file) {{{ */ | |
262 static void ggp_callback_buddylist_load_ok(GaimConnection *gc, gchar *file) | |
263 { | |
264 GaimAccount *account = gaim_connection_get_account(gc); | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
265 GError *error = NULL; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
266 char *buddylist = NULL; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
267 gsize length; |
11360 | 268 |
269 gaim_debug_info("gg", "file_name = %s\n", file); | |
270 | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
271 if (!g_file_get_contents(file, &buddylist, &length, &error)) { |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
272 gaim_notify_error(account, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
273 _("Couldn't load buddylist"), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
274 _("Couldn't load buddylist"), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
275 error->message); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
276 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
277 gaim_debug_error("gg", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
278 "Couldn't load buddylist. file = %s; error = %s\n", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
279 file, error->message); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
280 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
281 g_error_free(error); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
282 |
2806
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
283 return; |
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
284 } |
11360 | 285 |
286 ggp_buddylist_load(gc, buddylist); | |
287 g_free(buddylist); | |
288 | |
289 gaim_notify_info(account, | |
290 _("Load Buddylist..."), | |
291 _("Buddylist loaded successfully!"), NULL); | |
2806
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
292 } |
11360 | 293 /* }}} */ |
294 | |
295 /* | |
296 */ | |
297 /* static void ggp_action_buddylist_save(GaimPluginAction *action) {{{ */ | |
298 static void ggp_action_buddylist_save(GaimPluginAction *action) | |
299 { | |
300 GaimConnection *gc = (GaimConnection *)action->context; | |
301 | |
302 gaim_request_file(action, _("Save buddylist..."), NULL, TRUE, | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
303 G_CALLBACK(ggp_callback_buddylist_save_ok), NULL, gc); |
11360 | 304 } |
305 /* }}} */ | |
2806
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
306 |
11360 | 307 /* |
308 */ | |
309 /* static void ggp_action_buddylist_load(GaimPluginAction *action) {{{ */ | |
310 static void ggp_action_buddylist_load(GaimPluginAction *action) | |
311 { | |
312 GaimConnection *gc = (GaimConnection *)action->context; | |
313 | |
314 gaim_request_file(action, "Load buddylist from file...", NULL, FALSE, | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
315 G_CALLBACK(ggp_callback_buddylist_load_ok), NULL, gc); |
11360 | 316 } |
317 /* }}} */ | |
318 | |
319 /* | |
320 */ | |
11414 | 321 /* static void ggp_callback_register_account_ok(GaimConnection *gc, GaimRequestFields *fields) {{{ */ |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
322 static void ggp_callback_register_account_ok(GaimConnection *gc, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
323 GaimRequestFields *fields) |
11414 | 324 { |
325 GaimAccount *account; | |
326 GGPInfo *info = gc->proto_data; | |
327 struct gg_http *h = NULL; | |
328 struct gg_pubdir *s; | |
329 uin_t uin; | |
330 gchar *email, *p1, *p2, *t; | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
331 GGPToken *token = info->token; |
11414 | 332 |
333 email = charset_convert(gaim_request_fields_get_string(fields, "email"), | |
334 "UTF-8", "CP1250"); | |
335 p1 = charset_convert(gaim_request_fields_get_string(fields, "password1"), | |
336 "UTF-8", "CP1250"); | |
337 p2 = charset_convert(gaim_request_fields_get_string(fields, "password2"), | |
338 "UTF-8", "CP1250"); | |
339 t = charset_convert(gaim_request_fields_get_string(fields, "token"), | |
340 "UTF-8", "CP1250"); | |
341 | |
342 account = gaim_connection_get_account(gc); | |
343 | |
344 if (email == NULL || p1 == NULL || p2 == NULL || t == NULL || | |
345 *email == '\0' || *p1 == '\0' || *p2 == '\0' || *t == '\0') { | |
11545
85abf1deac05
[gaim-migrate @ 13800]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11544
diff
changeset
|
346 gaim_connection_error(gc, _("Fill in the registration fields.")); |
11414 | 347 goto exit_err; |
348 } | |
349 | |
350 if (g_utf8_collate(p1, p2) != 0) { | |
11545
85abf1deac05
[gaim-migrate @ 13800]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11544
diff
changeset
|
351 gaim_connection_error(gc, _("Passwords do not match.")); |
11414 | 352 goto exit_err; |
353 } | |
354 | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
355 gaim_debug_info("gg", "register_account_ok: token_id = %d; t = %s\n", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
356 token->id, t); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
357 h = gg_register3(email, p1, token->id, t, 0); |
11414 | 358 if (h == NULL || !(s = h->data) || !s->success) { |
11545
85abf1deac05
[gaim-migrate @ 13800]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11544
diff
changeset
|
359 gaim_connection_error(gc, |
85abf1deac05
[gaim-migrate @ 13800]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11544
diff
changeset
|
360 _("Unable to register new account. Error occurred.\n")); |
11414 | 361 goto exit_err; |
362 } | |
363 | |
364 uin = s->uin; | |
365 gaim_debug_info("gg", "registered uin: %d\n", uin); | |
366 | |
11545
85abf1deac05
[gaim-migrate @ 13800]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11544
diff
changeset
|
367 g_free(t); |
85abf1deac05
[gaim-migrate @ 13800]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11544
diff
changeset
|
368 t = g_strdup_printf("%u", uin); |
85abf1deac05
[gaim-migrate @ 13800]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11544
diff
changeset
|
369 gaim_account_set_username(account, t); |
85abf1deac05
[gaim-migrate @ 13800]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11544
diff
changeset
|
370 /* Save the password if remembering passwords for the account */ |
85abf1deac05
[gaim-migrate @ 13800]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11544
diff
changeset
|
371 gaim_account_set_password(account, p1); |
85abf1deac05
[gaim-migrate @ 13800]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11544
diff
changeset
|
372 |
11414 | 373 gaim_notify_info(NULL, _("New Gadu-Gadu Account Registered"), |
374 _("Registration completed successfully!"), NULL); | |
375 | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
376 /* TODO: the currently open Accounts Window will not be updated withthe |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
377 * new username and etc, we need to somehow have it refresh at this |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
378 * point |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
379 */ |
11545
85abf1deac05
[gaim-migrate @ 13800]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11544
diff
changeset
|
380 |
85abf1deac05
[gaim-migrate @ 13800]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11544
diff
changeset
|
381 /* Need to disconnect or actually log in. For now, we disconnect. */ |
85abf1deac05
[gaim-migrate @ 13800]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11544
diff
changeset
|
382 gaim_connection_destroy(gc); |
85abf1deac05
[gaim-migrate @ 13800]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11544
diff
changeset
|
383 |
11414 | 384 exit_err: |
385 gg_register_free(h); | |
386 g_free(email); | |
387 g_free(p1); | |
388 g_free(p2); | |
389 g_free(t); | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
390 g_free(token->id); |
11545
85abf1deac05
[gaim-migrate @ 13800]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11544
diff
changeset
|
391 g_free(token); |
11414 | 392 } |
393 /* }}} */ | |
394 | |
11565 | 395 /* |
396 */ | |
397 /* static void ggp_callback_register_account_cancel(GaimConnection *gc, GaimRequestFields *fields) {{{ */ | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
398 static void ggp_callback_register_account_cancel(GaimConnection *gc, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
399 GaimRequestFields *fields) |
11545
85abf1deac05
[gaim-migrate @ 13800]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11544
diff
changeset
|
400 { |
85abf1deac05
[gaim-migrate @ 13800]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11544
diff
changeset
|
401 GGPInfo *info = gc->proto_data; |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
402 GGPToken *token = info->token; |
11545
85abf1deac05
[gaim-migrate @ 13800]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11544
diff
changeset
|
403 |
85abf1deac05
[gaim-migrate @ 13800]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11544
diff
changeset
|
404 gaim_connection_destroy(gc); |
85abf1deac05
[gaim-migrate @ 13800]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11544
diff
changeset
|
405 |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
406 g_free(token->id); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
407 g_free(token->data); |
11545
85abf1deac05
[gaim-migrate @ 13800]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11544
diff
changeset
|
408 g_free(token); |
85abf1deac05
[gaim-migrate @ 13800]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11544
diff
changeset
|
409 |
85abf1deac05
[gaim-migrate @ 13800]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11544
diff
changeset
|
410 } |
11565 | 411 /* }}} */ |
11545
85abf1deac05
[gaim-migrate @ 13800]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11544
diff
changeset
|
412 |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
413 /* |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
414 */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
415 /* static void ggp_register_user_dialog(GaimConnection *gc) {{{ */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
416 static void ggp_register_user_dialog(GaimConnection *gc) |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
417 { |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
418 GaimAccount *account; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
419 GaimRequestFields *fields; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
420 GaimRequestFieldGroup *group; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
421 GaimRequestField *field; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
422 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
423 GGPInfo *info = gc->proto_data; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
424 GGPToken *token = info->token; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
425 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
426 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
427 account = gaim_connection_get_account(gc); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
428 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
429 fields = gaim_request_fields_new(); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
430 group = gaim_request_field_group_new(NULL); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
431 gaim_request_fields_add_group(fields, group); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
432 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
433 field = gaim_request_field_string_new("email", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
434 _("e-Mail"), "", FALSE); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
435 gaim_request_field_string_set_masked(field, FALSE); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
436 gaim_request_field_group_add_field(group, field); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
437 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
438 field = gaim_request_field_string_new("password1", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
439 _("Password"), "", FALSE); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
440 gaim_request_field_string_set_masked(field, TRUE); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
441 gaim_request_field_group_add_field(group, field); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
442 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
443 field = gaim_request_field_string_new("password2", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
444 _("Password (retype)"), "", FALSE); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
445 gaim_request_field_string_set_masked(field, TRUE); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
446 gaim_request_field_group_add_field(group, field); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
447 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
448 field = gaim_request_field_string_new("token", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
449 _("Enter current token"), "", FALSE); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
450 gaim_request_field_string_set_masked(field, FALSE); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
451 gaim_request_field_group_add_field(group, field); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
452 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
453 /* original size: 60x24 */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
454 field = gaim_request_field_image_new("token_img", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
455 _("Current token"), token->data, token->size); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
456 gaim_request_field_group_add_field(group, field); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
457 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
458 gaim_request_fields(account, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
459 _("Register New Gadu-Gadu Account"), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
460 _("Register New Gadu-Gadu Account"), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
461 _("Please, fill in the following fields"), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
462 fields, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
463 _("OK"), G_CALLBACK(ggp_callback_register_account_ok), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
464 _("Cancel"), G_CALLBACK(ggp_callback_register_account_cancel), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
465 gc); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
466 } |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
467 /* }}} */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
468 |
11414 | 469 /* ----- PUBLIC DIRECTORY SEARCH ---------------------------------------- */ |
470 | |
471 /* | |
472 */ | |
473 /* static void ggp_callback_show_next(GaimConnection *gc, GList *row) {{{ */ | |
474 static void ggp_callback_show_next(GaimConnection *gc, GList *row) | |
475 { | |
476 GGPInfo *info = gc->proto_data; | |
477 | |
478 g_free(info->search_form->offset); | |
479 info->search_form->offset = g_strdup(info->search_form->last_uin); | |
480 ggp_search_start(gc, info->search_form); | |
481 } | |
482 /* }}} */ | |
483 | |
484 /* | |
485 */ | |
486 /* static void ggp_callback_add_buddy(GaimConnection *gc, GList *row) {{{ */ | |
487 static void ggp_callback_add_buddy(GaimConnection *gc, GList *row) | |
488 { | |
489 gaim_blist_request_add_buddy(gaim_connection_get_account(gc), | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
490 g_list_nth_data(row, 0), NULL, NULL); |
11414 | 491 } |
492 /* }}} */ | |
493 | |
494 /* | |
495 */ | |
496 /* static void ggp_callback_find_buddies(GaimConnection *gc, GaimRequestFields *fields) {{{ */ | |
497 static void ggp_callback_find_buddies(GaimConnection *gc, GaimRequestFields *fields) | |
498 { | |
499 GGPInfo *info = gc->proto_data; | |
500 GGPSearchForm *form; | |
501 | |
502 form = ggp_search_form_new(); | |
503 info->search_form = form; | |
504 | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
505 form->lastname = charset_convert( |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
506 gaim_request_fields_get_string(fields, "lastname"), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
507 "UTF-8", "CP1250"); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
508 form->firstname = charset_convert( |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
509 gaim_request_fields_get_string(fields, "firstname"), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
510 "UTF-8", "CP1250"); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
511 form->nickname = charset_convert( |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
512 gaim_request_fields_get_string(fields, "nickname"), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
513 "UTF-8", "CP1250"); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
514 form->city = charset_convert( |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
515 gaim_request_fields_get_string(fields, "city"), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
516 "UTF-8", "CP1250"); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
517 form->birthyear = charset_convert( |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
518 gaim_request_fields_get_string(fields, "year"), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
519 "UTF-8", "CP1250"); |
11414 | 520 |
521 switch (gaim_request_fields_get_choice(fields, "gender")) { | |
522 case 1: | |
523 form->gender = g_strdup(GG_PUBDIR50_GENDER_MALE); | |
524 break; | |
525 case 2: | |
526 form->gender = g_strdup(GG_PUBDIR50_GENDER_FEMALE); | |
527 break; | |
528 default: | |
529 form->gender = NULL; | |
530 break; | |
531 } | |
532 | |
533 form->active = gaim_request_fields_get_bool(fields, "active") | |
534 ? g_strdup(GG_PUBDIR50_ACTIVE_TRUE) : NULL; | |
535 | |
536 form->offset = g_strdup("0"); | |
537 | |
538 ggp_search_start(gc, form); | |
539 } | |
540 /* }}} */ | |
541 | |
542 /* | |
543 */ | |
544 /* static void ggp_find_buddies(GaimPluginAction *action) {{{ */ | |
545 static void ggp_find_buddies(GaimPluginAction *action) | |
546 { | |
547 GaimConnection *gc = (GaimConnection *)action->context; | |
12220
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
548 GGPInfo *info = gc->proto_data; |
11414 | 549 |
550 GaimRequestFields *fields; | |
551 GaimRequestFieldGroup *group; | |
552 GaimRequestField *field; | |
553 | |
12220
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
554 if (info->search_form != NULL) { |
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
555 gaim_notify_error(gc, NULL, |
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
556 _("Unable to initiate a new search"), |
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
557 _("You have a pending search. Please wait for it to finish.")); |
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
558 return; |
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
559 } |
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
560 |
11414 | 561 fields = gaim_request_fields_new(); |
562 group = gaim_request_field_group_new(NULL); | |
563 gaim_request_fields_add_group(fields, group); | |
564 | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
565 field = gaim_request_field_string_new("lastname", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
566 _("Last name"), NULL, FALSE); |
11414 | 567 gaim_request_field_string_set_masked(field, FALSE); |
568 gaim_request_field_group_add_field(group, field); | |
569 | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
570 field = gaim_request_field_string_new("firstname", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
571 _("First name"), NULL, FALSE); |
11414 | 572 gaim_request_field_string_set_masked(field, FALSE); |
573 gaim_request_field_group_add_field(group, field); | |
574 | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
575 field = gaim_request_field_string_new("nickname", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
576 _("Nickname"), NULL, FALSE); |
11414 | 577 gaim_request_field_string_set_masked(field, FALSE); |
578 gaim_request_field_group_add_field(group, field); | |
579 | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
580 field = gaim_request_field_string_new("city", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
581 _("City"), NULL, FALSE); |
11414 | 582 gaim_request_field_string_set_masked(field, FALSE); |
583 gaim_request_field_group_add_field(group, field); | |
584 | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
585 field = gaim_request_field_string_new("year", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
586 _("Year of birth"), NULL, FALSE); |
11414 | 587 gaim_request_field_group_add_field(group, field); |
588 | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
589 field = gaim_request_field_choice_new("gender", _("Gender"), 0); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
590 gaim_request_field_choice_add(field, _("Male or female")); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
591 gaim_request_field_choice_add(field, _("Male")); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
592 gaim_request_field_choice_add(field, _("Female")); |
11414 | 593 gaim_request_field_group_add_field(group, field); |
594 | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
595 field = gaim_request_field_bool_new("active", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
596 _("Only online"), FALSE); |
11414 | 597 gaim_request_field_group_add_field(group, field); |
598 | |
599 gaim_request_fields(gc, | |
600 _("Find buddies"), | |
601 _("Find buddies"), | |
602 _("Please, enter your search criteria below"), | |
603 fields, | |
604 _("OK"), G_CALLBACK(ggp_callback_find_buddies), | |
605 _("Cancel"), NULL, | |
606 gc); | |
607 } | |
608 /* }}} */ | |
609 | |
610 /* ----- CHANGE PASSWORD ------------------------------------------------ */ | |
611 | |
612 /* | |
613 */ | |
11360 | 614 /* static void ggp_callback_change_passwd_ok(GaimConnection *gc, GaimRequestFields *fields) {{{ */ |
615 static void ggp_callback_change_passwd_ok(GaimConnection *gc, GaimRequestFields *fields) | |
2393 | 616 { |
11360 | 617 GaimAccount *account; |
618 GGPInfo *info = gc->proto_data; | |
619 struct gg_http *h; | |
620 gchar *cur, *p1, *p2, *t; | |
621 | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
622 cur = charset_convert( |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
623 gaim_request_fields_get_string(fields, "password_cur"), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
624 "UTF-8", "CP1250"); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
625 p1 = charset_convert( |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
626 gaim_request_fields_get_string(fields, "password1"), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
627 "UTF-8", "CP1250"); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
628 p2 = charset_convert( |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
629 gaim_request_fields_get_string(fields, "password2"), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
630 "UTF-8", "CP1250"); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
631 t = charset_convert( |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
632 gaim_request_fields_get_string(fields, "token"), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
633 "UTF-8", "CP1250"); |
11360 | 634 |
635 account = gaim_connection_get_account(gc); | |
636 | |
637 if (cur == NULL || p1 == NULL || p2 == NULL || t == NULL || | |
638 *cur == '\0' || *p1 == '\0' || *p2 == '\0' || *t == '\0') { | |
639 gaim_notify_error(account, NULL, _("Fill in the fields."), NULL); | |
640 goto exit_err; | |
641 } | |
642 | |
643 if (g_utf8_collate(p1, p2) != 0) { | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
644 gaim_notify_error(account, NULL, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
645 _("New passwords do not match."), NULL); |
11360 | 646 goto exit_err; |
647 } | |
2393 | 648 |
11360 | 649 if (g_utf8_collate(cur, gaim_account_get_password(account)) != 0) { |
650 gaim_notify_error(account, NULL, | |
651 _("Your current password is different from the one that you specified."), | |
652 NULL); | |
653 goto exit_err; | |
654 } | |
655 | |
656 gaim_debug_info("gg", "change_passwd: old=%s; p1=%s; token=%s\n", | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
657 cur, p1, info->token->id); |
11360 | 658 |
659 /* XXX: this e-mail should be a pref... */ | |
660 h = gg_change_passwd4(ggp_get_uin(account), | |
661 "user@example.net", gaim_account_get_password(account), | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
662 p1, info->token->id, t, 0); |
2393 | 663 |
11360 | 664 if (h == NULL) { |
665 gaim_notify_error(account, NULL, | |
666 _("Unable to change password. Error occured.\n"), | |
667 NULL); | |
668 goto exit_err; | |
669 } | |
670 | |
671 gaim_account_set_password(account, p1); | |
672 | |
673 gg_change_passwd_free(h); | |
674 | |
675 gaim_notify_info(account, _("Change password for the Gadu-Gadu account"), | |
676 _("Password was changed successfully!"), NULL); | |
677 | |
678 exit_err: | |
679 g_free(cur); | |
680 g_free(p1); | |
681 g_free(p2); | |
682 g_free(t); | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
683 g_free(info->token->id); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
684 g_free(info->token->data); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
685 g_free(info->token); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
686 } |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
687 /* }}} */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
688 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
689 /* |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
690 */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
691 /* static void ggp_change_passwd_dialog(GaimConnection *gc) {{{ */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
692 static void ggp_change_passwd_dialog(GaimConnection *gc) |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
693 { |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
694 GaimRequestFields *fields; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
695 GaimRequestFieldGroup *group; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
696 GaimRequestField *field; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
697 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
698 GGPInfo *info = gc->proto_data; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
699 GGPToken *token = info->token; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
700 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
701 char *msg; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
702 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
703 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
704 fields = gaim_request_fields_new(); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
705 group = gaim_request_field_group_new(NULL); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
706 gaim_request_fields_add_group(fields, group); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
707 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
708 field = gaim_request_field_string_new("password_cur", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
709 _("Current password"), "", FALSE); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
710 gaim_request_field_string_set_masked(field, TRUE); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
711 gaim_request_field_group_add_field(group, field); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
712 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
713 field = gaim_request_field_string_new("password1", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
714 _("Password"), "", FALSE); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
715 gaim_request_field_string_set_masked(field, TRUE); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
716 gaim_request_field_group_add_field(group, field); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
717 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
718 field = gaim_request_field_string_new("password2", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
719 _("Password (retype)"), "", FALSE); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
720 gaim_request_field_string_set_masked(field, TRUE); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
721 gaim_request_field_group_add_field(group, field); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
722 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
723 field = gaim_request_field_string_new("token", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
724 _("Enter current token"), "", FALSE); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
725 gaim_request_field_string_set_masked(field, FALSE); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
726 gaim_request_field_group_add_field(group, field); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
727 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
728 /* original size: 60x24 */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
729 field = gaim_request_field_image_new("token_img", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
730 _("Current token"), token->data, token->size); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
731 gaim_request_field_group_add_field(group, field); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
732 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
733 msg = g_strdup_printf("%s %d", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
734 _("Please, enter your current password and your new password for UIN: "), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
735 ggp_get_uin(gaim_connection_get_account(gc))); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
736 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
737 gaim_request_fields(gc, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
738 _("Change Gadu-Gadu Password"), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
739 _("Change Gadu-Gadu Password"), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
740 msg, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
741 fields, _("OK"), G_CALLBACK(ggp_callback_change_passwd_ok), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
742 _("Cancel"), NULL, gc); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
743 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
744 g_free(msg); |
11360 | 745 } |
746 /* }}} */ | |
2393 | 747 |
11360 | 748 /* |
749 */ | |
750 /* static void ggp_change_passwd(GaimPluginAction *action) {{{ */ | |
751 static void ggp_change_passwd(GaimPluginAction *action) | |
752 { | |
753 GaimConnection *gc = (GaimConnection *)action->context; | |
754 | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
755 ggp_token_request(gc, ggp_change_passwd_dialog); |
11360 | 756 } |
757 /* }}} */ | |
758 | |
11414 | 759 /* ----- CONFERENCES ---------------------------------------------------- */ |
760 | |
11394 | 761 /* |
762 */ | |
763 /* static void ggp_callback_add_to_chat_ok(GaimConnection *gc, GaimRequestFields *fields) {{{ */ | |
764 static void ggp_callback_add_to_chat_ok(GaimConnection *gc, GaimRequestFields *fields) | |
765 { | |
766 GGPInfo *info = gc->proto_data; | |
767 GaimRequestField *field; | |
768 const GList *sel, *l; | |
769 | |
770 field = gaim_request_fields_get_field(fields, "name"); | |
771 sel = gaim_request_field_list_get_selected(field); | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
772 gaim_debug_info("gg", "selected chat %s for buddy %s\n", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
773 sel->data, info->tmp_buddy); |
11394 | 774 |
775 for (l = info->chats; l != NULL; l = l->next) { | |
776 GGPChat *chat = l->data; | |
777 | |
778 if (g_utf8_collate(chat->name, sel->data) == 0) { | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
779 chat->participants = g_list_append(chat->participants, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
780 info->tmp_buddy); |
11394 | 781 break; |
782 } | |
783 } | |
784 } | |
785 /* }}} */ | |
786 | |
787 /* | |
788 */ | |
789 /* static void ggp_bmenu_add_to_chat(GaimBlistNode *node, gpointer ignored) {{{ */ | |
790 static void ggp_bmenu_add_to_chat(GaimBlistNode *node, gpointer ignored) | |
791 { | |
792 GaimBuddy *buddy; | |
793 GaimConnection *gc; | |
794 GGPInfo *info; | |
795 | |
796 GaimRequestFields *fields; | |
797 GaimRequestFieldGroup *group; | |
798 GaimRequestField *field; | |
799 | |
800 GList *l; | |
801 gchar *msg; | |
802 | |
803 buddy = (GaimBuddy *)node; | |
804 gc = gaim_account_get_connection(gaim_buddy_get_account(buddy)); | |
805 info = gc->proto_data; | |
806 | |
807 /* TODO: It tmp_buddy != NULL then stop! */ | |
808 info->tmp_buddy = g_strdup(gaim_buddy_get_name(buddy)); | |
809 | |
810 fields = gaim_request_fields_new(); | |
811 group = gaim_request_field_group_new(NULL); | |
812 gaim_request_fields_add_group(fields, group); | |
813 | |
814 field = gaim_request_field_list_new("name", "Chat name"); | |
815 for (l = info->chats; l != NULL; l = l->next) { | |
816 GGPChat *chat = l->data; | |
817 gaim_debug_info("gg", "adding chat %s\n", chat->name); | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
818 gaim_request_field_list_add(field, g_strdup(chat->name), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
819 g_strdup(chat->name)); |
11394 | 820 } |
821 gaim_request_field_group_add_field(group, field); | |
822 | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
823 msg = g_strdup_printf(_("Select a chat for buddy: %s"), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
824 gaim_buddy_get_name(buddy)); |
11394 | 825 gaim_request_fields(gc, |
826 _("Add to chat..."), | |
827 _("Add to chat..."), | |
828 msg, | |
829 fields, | |
830 _("Add"), G_CALLBACK(ggp_callback_add_to_chat_ok), | |
831 _("Cancel"), NULL, gc); | |
832 g_free(msg); | |
833 } | |
834 /* }}} */ | |
835 | |
11414 | 836 /* ----- BLOCK BUDDIES -------------------------------------------------- */ |
837 | |
11410 | 838 /* |
839 */ | |
840 /* static void ggp_bmenu_block(GaimBlistNode *node, gpointer ignored) {{{ */ | |
841 static void ggp_bmenu_block(GaimBlistNode *node, gpointer ignored) | |
842 { | |
843 GaimConnection *gc; | |
844 GaimBuddy *buddy; | |
845 GGPInfo *info; | |
846 uin_t uin; | |
847 | |
848 buddy = (GaimBuddy *)node; | |
849 gc = gaim_account_get_connection(gaim_buddy_get_account(buddy)); | |
850 info = gc->proto_data; | |
851 | |
852 uin = ggp_str_to_uin(gaim_buddy_get_name(buddy)); | |
853 | |
854 if (gaim_blist_node_get_bool(node, "blocked")) { | |
855 gaim_blist_node_set_bool(node, "blocked", FALSE); | |
856 gg_remove_notify_ex(info->session, uin, GG_USER_BLOCKED); | |
857 gg_add_notify_ex(info->session, uin, GG_USER_NORMAL); | |
858 gaim_debug_info("gg", "send: uin=%d; mode=NORMAL\n", uin); | |
859 } else { | |
860 gaim_blist_node_set_bool(node, "blocked", TRUE); | |
861 gg_remove_notify_ex(info->session, uin, GG_USER_NORMAL); | |
862 gg_add_notify_ex(info->session, uin, GG_USER_BLOCKED); | |
863 gaim_debug_info("gg", "send: uin=%d; mode=BLOCKED\n", uin); | |
864 } | |
865 } | |
866 /* }}} */ | |
867 | |
11360 | 868 /* ---------------------------------------------------------------------- */ |
11414 | 869 /* ----- INTERNAL CALLBACKS --------------------------------------------- */ |
870 /* ---------------------------------------------------------------------- */ | |
871 | |
872 /** | |
873 * Handle change of the status of the buddy. | |
874 * | |
875 * @param gc GaimConnection | |
876 * @param uin UIN of the buddy. | |
877 * @param status ID of the status. | |
878 * @param descr Description. | |
879 */ | |
880 /* static void ggp_generic_status_handler(GaimConnection *gc, uin_t uin, int status, const char *descr) {{{ */ | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
881 static void ggp_generic_status_handler(GaimConnection *gc, uin_t uin, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
882 int status, const char *descr) |
11414 | 883 { |
884 gchar *from; | |
885 const char *st; | |
886 gchar *msg; | |
887 | |
888 from = g_strdup_printf("%ld", (unsigned long int)uin); | |
889 switch (status) { | |
890 case GG_STATUS_NOT_AVAIL: | |
891 case GG_STATUS_NOT_AVAIL_DESCR: | |
892 st = "offline"; | |
893 break; | |
894 case GG_STATUS_AVAIL: | |
895 case GG_STATUS_AVAIL_DESCR: | |
11638 | 896 st = "available"; |
11414 | 897 break; |
898 case GG_STATUS_BUSY: | |
899 case GG_STATUS_BUSY_DESCR: | |
900 st = "away"; | |
901 break; | |
902 case GG_STATUS_BLOCKED: | |
903 /* user is blocking us.... */ | |
904 st = "blocked"; | |
905 break; | |
906 default: | |
11638 | 907 st = "available"; |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
908 gaim_debug_info("gg", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
909 "GG_EVENT_NOTIFY: Unknown status: %d\n", status); |
11414 | 910 break; |
911 } | |
912 | |
913 gaim_debug_info("gg", "st = %s\n", st); | |
914 msg = charset_convert(descr, "CP1250", "UTF-8"); | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
915 gaim_prpl_got_user_status(gaim_connection_get_account(gc), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
916 from, st, "message", msg, NULL); |
11414 | 917 g_free(from); |
918 g_free(msg); | |
919 } | |
920 /* }}} */ | |
921 | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
922 /* |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
923 */ |
12220
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
924 /* static void ggp_sr_close_cb(GaimAccount *account) {{{ */ |
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
925 static void ggp_sr_close_cb(GaimAccount *account) |
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
926 { |
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
927 GaimConnection *gc = gaim_account_get_connection(account); |
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
928 GGPInfo *info = gc->proto_data; |
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
929 GGPSearchForm *f; |
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
930 |
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
931 info->searchresults_window = NULL; |
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
932 |
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
933 f = info->search_form; |
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
934 g_free(f->uin); |
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
935 g_free(f->lastname); |
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
936 g_free(f->firstname); |
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
937 g_free(f->nickname); |
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
938 g_free(f->city); |
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
939 g_free(f->birthyear); |
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
940 g_free(f->gender); |
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
941 g_free(f->active); |
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
942 g_free(f->offset); |
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
943 g_free(f->last_uin); |
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
944 g_free(f); |
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
945 |
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
946 info->search_form = NULL; |
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
947 } |
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
948 /* }}} */ |
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
949 |
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
950 /* |
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
951 */ |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
952 /* static void ggp_pubdir_reply_handler(GaimConnection *gc, gg_pubdir50_t req) {{{ */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
953 static void ggp_pubdir_reply_handler(GaimConnection *gc, gg_pubdir50_t req) |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
954 { |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
955 GGPInfo *info = gc->proto_data; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
956 GaimNotifySearchResults *results; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
957 GaimNotifySearchColumn *column; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
958 int res_count = 0; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
959 int start; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
960 int i; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
961 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
962 res_count = gg_pubdir50_count(req); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
963 if (res_count < 1) { |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
964 gaim_debug_info("gg", "GG_EVENT_PUBDIR50_SEARCH_REPLY: Nothing found\n"); |
12220
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
965 gaim_notify_error(gc, NULL, |
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
966 _("No matching users found"), |
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
967 _("There are no users matching your search criteria.")); |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
968 return; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
969 } |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
970 res_count = (res_count > 20) ? 20 : res_count; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
971 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
972 results = gaim_notify_searchresults_new(); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
973 |
12220
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
974 column = gaim_notify_searchresults_column_new(_("UIN")); |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
975 gaim_notify_searchresults_column_add(results, column); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
976 |
12220
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
977 column = gaim_notify_searchresults_column_new(_("First name")); |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
978 gaim_notify_searchresults_column_add(results, column); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
979 |
12220
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
980 column = gaim_notify_searchresults_column_new(_("Nick name")); |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
981 gaim_notify_searchresults_column_add(results, column); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
982 |
12220
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
983 column = gaim_notify_searchresults_column_new(_("City")); |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
984 gaim_notify_searchresults_column_add(results, column); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
985 |
12220
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
986 column = gaim_notify_searchresults_column_new(_("Birth year")); |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
987 gaim_notify_searchresults_column_add(results, column); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
988 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
989 gaim_debug_info("gg", "Going with %d entries\n", res_count); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
990 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
991 start = (int)ggp_str_to_uin(gg_pubdir50_get(req, 0, GG_PUBDIR50_START)); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
992 gaim_debug_info("gg", "start = %d\n", start); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
993 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
994 for (i = 0; i < res_count; i++) { |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
995 GList *row = NULL; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
996 char *birth = ggp_search_get_result(req, i, GG_PUBDIR50_BIRTHYEAR); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
997 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
998 /* TODO: Status will be displayed as an icon. */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
999 /* row = g_list_append(row, ggp_search_get_result(req, i, GG_PUBDIR50_STATUS)); */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1000 row = g_list_append(row, ggp_search_get_result(req, i, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1001 GG_PUBDIR50_UIN)); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1002 row = g_list_append(row, ggp_search_get_result(req, i, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1003 GG_PUBDIR50_FIRSTNAME)); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1004 row = g_list_append(row, ggp_search_get_result(req, i, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1005 GG_PUBDIR50_NICKNAME)); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1006 row = g_list_append(row, ggp_search_get_result(req, i, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1007 GG_PUBDIR50_CITY)); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1008 row = g_list_append(row, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1009 (birth && strncmp(birth, "0", 1)) ? birth : g_strdup("-")); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1010 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1011 gaim_notify_searchresults_row_add(results, row); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1012 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1013 if (i == res_count - 1) { |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1014 g_free(info->search_form->last_uin); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1015 info->search_form->last_uin = ggp_search_get_result(req, i, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1016 GG_PUBDIR50_UIN); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1017 } |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1018 } |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1019 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1020 gaim_notify_searchresults_button_add(results, GAIM_NOTIFY_BUTTON_CONTINUE, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1021 ggp_callback_show_next); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1022 gaim_notify_searchresults_button_add(results, GAIM_NOTIFY_BUTTON_ADD_BUDDY, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1023 ggp_callback_add_buddy); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1024 if (info->searchresults_window == NULL) { |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1025 void *h = gaim_notify_searchresults(gc, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1026 _("Gadu-Gadu Public Directory"), |
12220
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
1027 _("Search results"), NULL, results, |
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
1028 (GHookFunc)ggp_sr_close_cb, |
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
1029 gaim_connection_get_account(gc)); |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1030 info->searchresults_window = h; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1031 } else { |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1032 gaim_notify_searchresults_new_rows(gc, results, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1033 info->searchresults_window, NULL); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1034 } |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1035 } |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1036 /* }}} */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1037 |
11414 | 1038 /** |
1039 * Dispatch a message received from a buddy. | |
1040 * | |
1041 * @param gc GaimConnection. | |
1042 * @param ev Gadu-Gadu event structure. | |
1043 */ | |
1044 /* static void ggp_recv_message_handler(GaimConnection *gc, const struct gg_event *ev) {{{ */ | |
1045 static void ggp_recv_message_handler(GaimConnection *gc, const struct gg_event *ev) | |
1046 { | |
1047 GGPInfo *info = gc->proto_data; | |
1048 GaimConversation *conv; | |
1049 gchar *from; | |
1050 gchar *msg; | |
1051 gchar *tmp; | |
1052 const char *chat_name; | |
1053 int chat_id; | |
1054 | |
1055 from = g_strdup_printf("%lu", (unsigned long int)ev->event.msg.sender); | |
1056 | |
1057 msg = charset_convert((const char *)ev->event.msg.message, | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1058 "CP1250", "UTF-8"); |
11920 | 1059 gaim_str_strip_char(msg, '\r'); |
11414 | 1060 tmp = g_markup_escape_text(msg, -1); |
1061 | |
1062 gaim_debug_info("gg", "msg form (%s): %s (class = %d; rcpt_count = %d)\n", | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1063 from, tmp, ev->event.msg.msgclass, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1064 ev->event.msg.recipients_count); |
11414 | 1065 |
1066 if (ev->event.msg.recipients_count == 0) { | |
1067 serv_got_im(gc, from, tmp, 0, ev->event.msg.time); | |
1068 } else { | |
1069 chat_name = ggp_confer_find_by_participants(gc, | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1070 ev->event.msg.recipients, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1071 ev->event.msg.recipients_count); |
11414 | 1072 if (chat_name == NULL) { |
1073 chat_name = ggp_confer_add_new(gc, NULL); | |
1074 serv_got_joined_chat(gc, info->chats_count, chat_name); | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1075 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1076 ggp_confer_participants_add_uin(gc, chat_name, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1077 ev->event.msg.sender); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1078 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1079 ggp_confer_participants_add(gc, chat_name, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1080 ev->event.msg.recipients, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1081 ev->event.msg.recipients_count); |
11414 | 1082 } |
1083 conv = ggp_confer_find_by_name(gc, chat_name); | |
1084 chat_id = gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)); | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1085 serv_got_chat_in(gc, chat_id, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1086 ggp_buddy_get_name(gc, ev->event.msg.sender), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1087 0, msg, ev->event.msg.time); |
11414 | 1088 } |
1089 g_free(msg); | |
1090 g_free(tmp); | |
1091 g_free(from); | |
1092 } | |
1093 /* }}} */ | |
1094 | |
1095 /* | |
1096 */ | |
1097 /* static void ggp_callback_recv(gpointer _gc, gint fd, GaimInputCondition cond) {{{ */ | |
1098 static void ggp_callback_recv(gpointer _gc, gint fd, GaimInputCondition cond) | |
1099 { | |
1100 GaimConnection *gc = _gc; | |
1101 GGPInfo *info = gc->proto_data; | |
1102 struct gg_event *ev; | |
1103 int i; | |
1104 | |
1105 if (!(ev = gg_watch_fd(info->session))) { | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1106 gaim_debug_error("gg", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1107 "ggp_callback_recv: gg_watch_fd failed -- CRITICAL!\n"); |
11414 | 1108 gaim_connection_error(gc, _("Unable to read socket")); |
1109 return; | |
1110 } | |
1111 | |
1112 switch (ev->type) { | |
1113 case GG_EVENT_NONE: | |
1114 /* Nothing happened. */ | |
1115 break; | |
1116 case GG_EVENT_MSG: | |
1117 ggp_recv_message_handler(gc, ev); | |
1118 break; | |
1119 case GG_EVENT_ACK: | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1120 gaim_debug_info("gg", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1121 "message sent to: %ld, delivery status=%d, seq=%d\n", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1122 ev->event.ack.recipient, ev->event.ack.status, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1123 ev->event.ack.seq); |
11414 | 1124 break; |
1125 case GG_EVENT_NOTIFY: | |
1126 case GG_EVENT_NOTIFY_DESCR: | |
1127 { | |
1128 struct gg_notify_reply *n; | |
1129 char *descr; | |
1130 | |
1131 gaim_debug_info("gg", "notify_pre: (%d) status: %d\n", | |
1132 ev->event.notify->uin, | |
1133 ev->event.notify->status); | |
1134 | |
1135 n = (ev->type == GG_EVENT_NOTIFY) ? ev->event.notify | |
1136 : ev->event.notify_descr.notify; | |
1137 | |
1138 for (; n->uin; n++) { | |
1139 descr = (ev->type == GG_EVENT_NOTIFY) ? NULL | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1140 : ev->event.notify_descr.descr; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1141 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1142 gaim_debug_info("gg", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1143 "notify: (%d) status: %d; descr: %s\n", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1144 n->uin, n->status, descr); |
11414 | 1145 |
1146 ggp_generic_status_handler(gc, | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1147 n->uin, n->status, descr); |
11414 | 1148 } |
1149 } | |
1150 break; | |
1151 case GG_EVENT_NOTIFY60: | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1152 gaim_debug_info("gg", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1153 "notify60_pre: (%d) status=%d; version=%d; descr=%s\n", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1154 ev->event.notify60->uin, ev->event.notify60->status, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1155 ev->event.notify60->version, ev->event.notify60->descr); |
11414 | 1156 |
1157 for (i = 0; ev->event.notify60[i].uin; i++) { | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1158 gaim_debug_info("gg", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1159 "notify60: (%d) status=%d; version=%d; descr=%s\n", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1160 ev->event.notify60[i].uin, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1161 ev->event.notify60[i].status, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1162 ev->event.notify60[i].version, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1163 ev->event.notify60[i].descr); |
11414 | 1164 |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1165 ggp_generic_status_handler(gc, ev->event.notify60[i].uin, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1166 ev->event.notify60[i].status, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1167 ev->event.notify60[i].descr); |
11414 | 1168 } |
1169 break; | |
1170 case GG_EVENT_STATUS: | |
1171 gaim_debug_info("gg", "status: (%d) status=%d; descr=%s\n", | |
1172 ev->event.status.uin, ev->event.status.status, | |
1173 ev->event.status.descr); | |
1174 | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1175 ggp_generic_status_handler(gc, ev->event.status.uin, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1176 ev->event.status.status, ev->event.status.descr); |
11414 | 1177 break; |
1178 case GG_EVENT_STATUS60: | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1179 gaim_debug_info("gg", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1180 "status60: (%d) status=%d; version=%d; descr=%s\n", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1181 ev->event.status60.uin, ev->event.status60.status, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1182 ev->event.status60.version, ev->event.status60.descr); |
11414 | 1183 |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1184 ggp_generic_status_handler(gc, ev->event.status60.uin, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1185 ev->event.status60.status, ev->event.status60.descr); |
11414 | 1186 break; |
1187 case GG_EVENT_USERLIST: | |
1188 if (ev->event.userlist.type == GG_USERLIST_GET_REPLY) { | |
1189 gaim_debug_info("gg", "GG_USERLIST_GET_REPLY\n"); | |
12220
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
1190 gaim_notify_info(gc, NULL, |
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
1191 _("Buddy list downloaded"), |
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
1192 _("Your buddy list was downloaded from the server.")); |
11414 | 1193 if (ev->event.userlist.reply != NULL) { |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1194 ggp_buddylist_load(gc, ev->event.userlist.reply); |
11414 | 1195 } |
1196 } else { | |
12220
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
1197 gaim_debug_info("gg", "GG_USERLIST_PUT_REPLY\n"); |
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
1198 gaim_notify_info(gc, NULL, |
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
1199 _("Buddy list uploaded"), |
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
1200 _("Your buddy list was stored on the server.")); |
11414 | 1201 } |
1202 break; | |
1203 case GG_EVENT_PUBDIR50_SEARCH_REPLY: | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1204 ggp_pubdir_reply_handler(gc, ev->event.pubdir50); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1205 break; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1206 default: |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1207 gaim_debug_error("gg", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1208 "unsupported event type=%d\n", ev->type); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1209 break; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1210 } |
11414 | 1211 |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1212 gg_free_event(ev); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1213 } |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1214 /* }}} */ |
11414 | 1215 |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1216 /* |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1217 */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1218 /* static void ggp_async_login_handler(gpointer _gc, gint fd, GaimInputCondition cond) {{{ */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1219 static void ggp_async_login_handler(gpointer _gc, gint fd, GaimInputCondition cond) |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1220 { |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1221 GaimConnection *gc = _gc; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1222 GGPInfo *info = gc->proto_data; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1223 struct gg_event *ev; |
11414 | 1224 |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1225 gaim_debug_info("gg", "login_handler: session: check = %d; state = %d;\n", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1226 info->session->check, info->session->state); |
11414 | 1227 |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1228 switch (info->session->state) { |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1229 case GG_STATE_RESOLVING: |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1230 gaim_debug_info("gg", "GG_STATE_RESOLVING\n"); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1231 break; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1232 case GG_STATE_CONNECTING_HUB: |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1233 gaim_debug_info("gg", "GG_STATE_CONNECTING_HUB\n"); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1234 break; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1235 case GG_STATE_READING_DATA: |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1236 gaim_debug_info("gg", "GG_STATE_READING_DATA\n"); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1237 break; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1238 case GG_STATE_CONNECTING_GG: |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1239 gaim_debug_info("gg", "GG_STATE_CONNECTING_GG\n"); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1240 break; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1241 case GG_STATE_READING_KEY: |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1242 gaim_debug_info("gg", "GG_STATE_READING_KEY\n"); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1243 break; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1244 case GG_STATE_READING_REPLY: |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1245 gaim_debug_info("gg", "GG_STATE_READING_REPLY\n"); |
11414 | 1246 break; |
1247 default: | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1248 gaim_debug_error("gg", "unknown state = %d\n", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1249 info->session->state); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1250 break; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1251 } |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1252 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1253 if (!(ev = gg_watch_fd(info->session))) { |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1254 gaim_debug_error("gg", "login_handler: gg_watch_fd failed!\n"); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1255 gaim_connection_error(gc, _("Unable to read socket")); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1256 return; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1257 } |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1258 gaim_debug_info("gg", "login_handler: session->fd = %d\n", info->session->fd); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1259 gaim_debug_info("gg", "login_handler: session: check = %d; state = %d;\n", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1260 info->session->check, info->session->state); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1261 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1262 gaim_input_remove(gc->inpa); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1263 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1264 /** XXX I think that this shouldn't be done if ev->type is GG_EVENT_CONN_FAILED or GG_EVENT_CONN_SUCCESS -datallah */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1265 gc->inpa = gaim_input_add(info->session->fd, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1266 (info->session->check == 1) ? GAIM_INPUT_WRITE |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1267 : GAIM_INPUT_READ, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1268 ggp_async_login_handler, gc); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1269 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1270 switch (ev->type) { |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1271 case GG_EVENT_NONE: |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1272 /* Nothing happened. */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1273 gaim_debug_info("gg", "GG_EVENT_NONE\n"); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1274 break; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1275 case GG_EVENT_CONN_SUCCESS: |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1276 gaim_debug_info("gg", "GG_EVENT_CONN_SUCCESS\n"); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1277 gaim_input_remove(gc->inpa); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1278 gc->inpa = gaim_input_add(info->session->fd, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1279 GAIM_INPUT_READ, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1280 ggp_callback_recv, gc); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1281 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1282 /* gg_change_status(info->session, GG_STATUS_AVAIL); */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1283 gaim_connection_set_state(gc, GAIM_CONNECTED); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1284 ggp_buddylist_send(gc); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1285 break; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1286 case GG_EVENT_CONN_FAILED: |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1287 gaim_input_remove(gc->inpa); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1288 gc->inpa = 0; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1289 gaim_connection_error(gc, _("Connection failed.")); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1290 break; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1291 default: |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1292 gaim_debug_error("gg", "strange event: %d\n", ev->type); |
11414 | 1293 break; |
1294 } | |
1295 | |
1296 gg_free_event(ev); | |
1297 } | |
1298 /* }}} */ | |
1299 | |
1300 /* ---------------------------------------------------------------------- */ | |
11360 | 1301 /* ----- GaimPluginProtocolInfo ----------------------------------------- */ |
1302 /* ---------------------------------------------------------------------- */ | |
1303 | |
1304 /* static const char *ggp_list_icon(GaimAccount *account, GaimBuddy *buddy) {{{ */ | |
1305 static const char *ggp_list_icon(GaimAccount *account, GaimBuddy *buddy) | |
1306 { | |
1307 return "gadu-gadu"; | |
1308 } | |
1309 /* }}} */ | |
1310 | |
1311 /* static void ggp_list_emblems(GaimBuddy *b, const char **se, const char **sw, const char **nw, const char **ne) {{{ */ | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1312 static void ggp_list_emblems(GaimBuddy *b, const char **se, const char **sw, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1313 const char **nw, const char **ne) |
11360 | 1314 { |
1315 GaimPresence *presence = gaim_buddy_get_presence(b); | |
1316 | |
1317 /* | |
1318 * Note to myself: | |
1319 * The only valid status types are those defined | |
1320 * in prpl_info->status_types. | |
1321 * | |
1322 * Usable icons: away, blocked, dnd, extendedaway, | |
1323 * freeforchat, ignored, invisible, na, offline. | |
1324 */ | |
1325 | |
1326 if (!GAIM_BUDDY_IS_ONLINE(b)) { | |
1327 *se = "offline"; | |
1328 } else if (gaim_presence_is_status_active(presence, "away")) { | |
1329 *se = "away"; | |
11638 | 1330 } else if (gaim_presence_is_status_active(presence, "available")) { |
11360 | 1331 *se = "online"; |
1332 } else if (gaim_presence_is_status_active(presence, "offline")) { | |
1333 *se = "offline"; | |
1334 } else if (gaim_presence_is_status_active(presence, "blocked")) { | |
1335 *se = "blocked"; | |
1336 } else { | |
1337 *se = "offline"; | |
1338 gaim_debug_info("gg", "ggp_list_emblems: unknown status\n"); | |
1339 } | |
2393 | 1340 } |
11360 | 1341 /* }}} */ |
2393 | 1342 |
11360 | 1343 /* static char *ggp_status_text(GaimBuddy *b) {{{ */ |
1344 static char *ggp_status_text(GaimBuddy *b) | |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1345 { |
11360 | 1346 GaimStatus *status; |
1347 const char *msg; | |
1348 char *text; | |
1349 char *tmp; | |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1350 |
11360 | 1351 status = gaim_presence_get_active_status(gaim_buddy_get_presence(b)); |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1352 |
11360 | 1353 msg = gaim_status_get_attr_string(status, "message"); |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1354 |
11360 | 1355 if (msg != NULL) { |
1356 tmp = gaim_markup_strip_html(msg); | |
1357 text = g_markup_escape_text(tmp, -1); | |
1358 g_free(tmp); | |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1359 |
11360 | 1360 return text; |
1361 } else { | |
1362 tmp = g_strdup(gaim_status_get_name(status)); | |
1363 text = g_markup_escape_text(tmp, -1); | |
1364 g_free(tmp); | |
1365 | |
1366 return text; | |
8997 | 1367 } |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1368 } |
11360 | 1369 /* }}} */ |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1370 |
11360 | 1371 /* static char *ggp_tooltip_text(GaimBuddy *b) {{{ */ |
1372 static char *ggp_tooltip_text(GaimBuddy *b) | |
1373 { | |
1374 GaimStatus *status; | |
1375 char *text; | |
1376 gchar *ret; | |
1377 const char *msg, *name; | |
1378 | |
1379 status = gaim_presence_get_active_status(gaim_buddy_get_presence(b)); | |
1380 msg = gaim_status_get_attr_string(status, "message"); | |
1381 name = gaim_status_get_name(status); | |
1382 | |
1383 if (msg != NULL) { | |
1384 char *tmp = gaim_markup_strip_html(msg); | |
1385 text = g_markup_escape_text(tmp, -1); | |
1386 g_free(tmp); | |
1387 | |
1388 ret = g_strdup_printf("\n<b>%s:</b> %s: %s", | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1389 _("Status"), name, text); |
11360 | 1390 |
1391 g_free(text); | |
1392 } else { | |
1393 ret = g_strdup_printf("\n<b>%s:</b> %s", | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1394 _("Status"), name); |
11360 | 1395 } |
1396 | |
1397 return ret; | |
1398 } | |
1399 /* }}} */ | |
1400 | |
1401 /* static GList *ggp_status_types(GaimAccount *account) {{{ */ | |
1402 static GList *ggp_status_types(GaimAccount *account) | |
1403 { | |
1404 GaimStatusType *type; | |
1405 GList *types = NULL; | |
1406 | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1407 type = gaim_status_type_new_with_attrs(GAIM_STATUS_OFFLINE, "offline", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1408 _("Offline"), TRUE, TRUE, FALSE, "message", _("Message"), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1409 gaim_value_new(GAIM_TYPE_STRING), NULL); |
11360 | 1410 types = g_list_append(types, type); |
1411 | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1412 type = gaim_status_type_new_with_attrs(GAIM_STATUS_AVAILABLE, "available", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1413 _("Online"), TRUE, TRUE, FALSE, "message", _("Message"), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1414 gaim_value_new(GAIM_TYPE_STRING), NULL); |
11360 | 1415 types = g_list_append(types, type); |
1416 | |
1417 /* | |
11638 | 1418 * Without this selecting Invisible as own status doesn't |
11360 | 1419 * work. It's not used and not needed to show status of buddies. |
1420 */ | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1421 type = gaim_status_type_new_with_attrs(GAIM_STATUS_HIDDEN, "invisible", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1422 _("Invisible"), TRUE, TRUE, FALSE, "message", _("Message"), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1423 gaim_value_new(GAIM_TYPE_STRING), NULL); |
11360 | 1424 types = g_list_append(types, type); |
1425 | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1426 type = gaim_status_type_new_with_attrs(GAIM_STATUS_AWAY, "away", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1427 _("Busy"), TRUE, TRUE, FALSE, "message", _("Message"), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1428 gaim_value_new(GAIM_TYPE_STRING), NULL); |
11360 | 1429 types = g_list_append(types, type); |
1430 | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1431 type = gaim_status_type_new_with_attrs(GAIM_STATUS_HIDDEN, "blocked", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1432 _("Blocked"), TRUE, TRUE, FALSE, "message", _("Message"), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1433 gaim_value_new(GAIM_TYPE_STRING), NULL); |
11360 | 1434 types = g_list_append(types, type); |
1435 | |
1436 return types; | |
1437 } | |
1438 /* }}} */ | |
1439 | |
1440 /* static GList *ggp_blist_node_menu(GaimBlistNode *node) {{{ */ | |
1441 static GList *ggp_blist_node_menu(GaimBlistNode *node) | |
2393 | 1442 { |
11394 | 1443 GaimBlistNodeAction *act; |
2393 | 1444 GList *m = NULL; |
4333 | 1445 |
11360 | 1446 if (!GAIM_BLIST_NODE_IS_BUDDY(node)) |
1447 return NULL; | |
4333 | 1448 |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1449 act = gaim_blist_node_action_new(_("Add to chat"), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1450 ggp_bmenu_add_to_chat, NULL, NULL); |
11410 | 1451 m = g_list_append(m, act); |
1452 | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1453 if (gaim_blist_node_get_bool(node, "blocked")) { |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1454 act = gaim_blist_node_action_new(_("Unblock"), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1455 ggp_bmenu_block, NULL, NULL); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1456 } else { |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1457 act = gaim_blist_node_action_new(_("Block"), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1458 ggp_bmenu_block, NULL, NULL); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1459 } |
11394 | 1460 m = g_list_append(m, act); |
2393 | 1461 |
1462 return m; | |
1463 } | |
11360 | 1464 /* }}} */ |
2393 | 1465 |
11394 | 1466 /* static GList *ggp_chat_info(GaimConnection *gc) {{{ */ |
1467 static GList *ggp_chat_info(GaimConnection *gc) | |
1468 { | |
1469 GList *m = NULL; | |
1470 struct proto_chat_entry *pce; | |
1471 | |
1472 pce = g_new0(struct proto_chat_entry, 1); | |
1473 pce->label = _("Chat _name:"); | |
1474 pce->identifier = "name"; | |
1475 pce->required = TRUE; | |
1476 m = g_list_append(m, pce); | |
1477 | |
1478 return m; | |
1479 } | |
1480 /* }}} */ | |
1481 | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1482 /* static void ggp_login(GaimAccount *account) {{{ */ |
11837 | 1483 static void ggp_login(GaimAccount *account) |
2393 | 1484 { |
11360 | 1485 GaimConnection *gc = gaim_account_get_connection(account); |
1486 struct gg_login_params *glp = g_new0(struct gg_login_params, 1); | |
1487 GGPInfo *info = g_new0(GGPInfo, 1); | |
1488 | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1489 /* Probably this should be moved to *_new() function. */ |
11360 | 1490 info->session = NULL; |
1491 info->searchresults_window = NULL; | |
11394 | 1492 info->chats = NULL; |
1493 info->chats_count = 0; | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1494 info->token = NULL; |
11360 | 1495 |
1496 gc->proto_data = info; | |
1497 | |
1498 glp->uin = ggp_get_uin(account); | |
1499 glp->password = (char *)gaim_account_get_password(account); | |
1500 | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1501 glp->async = 1; |
11360 | 1502 glp->status = GG_STATUS_AVAIL; |
1503 glp->tls = 0; | |
1504 | |
1505 info->session = gg_login(glp); | |
1506 if (info->session == NULL) { | |
1507 gaim_connection_error(gc, _("Connection failed.")); | |
1508 g_free(glp); | |
1509 return; | |
1510 } | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1511 gc->inpa = gaim_input_add(info->session->fd, GAIM_INPUT_READ, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1512 ggp_async_login_handler, gc); |
11360 | 1513 } |
1514 /* }}} */ | |
1515 | |
1516 /* static void ggp_close(GaimConnection *gc) {{{ */ | |
1517 static void ggp_close(GaimConnection *gc) | |
1518 { | |
8997 | 1519 |
11360 | 1520 if (gc == NULL) { |
1521 gaim_debug_info("gg", "gc == NULL\n"); | |
1522 return; | |
1523 } | |
1524 | |
11538
5c6c2e893803
[gaim-migrate @ 13792]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11522
diff
changeset
|
1525 if (gc->proto_data) { |
5c6c2e893803
[gaim-migrate @ 13792]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11522
diff
changeset
|
1526 GGPInfo *info = gc->proto_data; |
5c6c2e893803
[gaim-migrate @ 13792]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11522
diff
changeset
|
1527 /* XXX: Any way to pass description here? */ |
5c6c2e893803
[gaim-migrate @ 13792]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11522
diff
changeset
|
1528 if (info->session != NULL) { |
5c6c2e893803
[gaim-migrate @ 13792]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11522
diff
changeset
|
1529 gg_change_status(info->session, GG_STATUS_NOT_AVAIL); |
5c6c2e893803
[gaim-migrate @ 13792]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11522
diff
changeset
|
1530 gg_logoff(info->session); |
5c6c2e893803
[gaim-migrate @ 13792]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11522
diff
changeset
|
1531 gg_free_session(info->session); |
5c6c2e893803
[gaim-migrate @ 13792]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11522
diff
changeset
|
1532 } |
11545
85abf1deac05
[gaim-migrate @ 13800]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11544
diff
changeset
|
1533 g_free(info); |
85abf1deac05
[gaim-migrate @ 13800]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11544
diff
changeset
|
1534 gc->proto_data = NULL; |
11538
5c6c2e893803
[gaim-migrate @ 13792]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11522
diff
changeset
|
1535 } |
11360 | 1536 |
1537 if (gc->inpa > 0) | |
1538 gaim_input_remove(gc->inpa); | |
1539 | |
1540 ggp_buddylist_offline(gc); | |
2393 | 1541 |
11360 | 1542 gaim_debug_info("gg", "Connection closed.\n"); |
1543 } | |
1544 /* }}} */ | |
1545 | |
12216 | 1546 /* static int ggp_send_im(GaimConnection *gc, const char *who, const char *msg, GaimMessageFlags flags) {{{ */ |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1547 static int ggp_send_im(GaimConnection *gc, const char *who, const char *msg, |
12216 | 1548 GaimMessageFlags flags) |
11360 | 1549 { |
1550 GGPInfo *info = gc->proto_data; | |
12216 | 1551 char *tmp, *plain; |
11360 | 1552 |
1553 if (strlen(msg) == 0) | |
1554 return 1; | |
1555 | |
12216 | 1556 plain = gaim_unescape_html(msg); |
11565 | 1557 gaim_debug_info("gg", "ggp_send_im: msg = %s\n", msg); |
12216 | 1558 tmp = charset_convert(plain, "UTF-8", "CP1250"); |
1559 g_free(plain); | |
2393 | 1560 |
11360 | 1561 if (tmp != NULL && strlen(tmp) > 0) { |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1562 if (gg_send_message(info->session, GG_CLASS_CHAT, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1563 ggp_str_to_uin(who), (unsigned char *)tmp) < 0) { |
11360 | 1564 return -1; |
1565 } | |
1566 } | |
11565 | 1567 g_free(tmp); |
11360 | 1568 |
1569 return 1; | |
1570 } | |
1571 /* }}} */ | |
1572 | |
1573 /* static void ggp_get_info(GaimConnection *gc, const char *name) { {{{ */ | |
1574 static void ggp_get_info(GaimConnection *gc, const char *name) | |
1575 { | |
1576 GGPInfo *info = gc->proto_data; | |
1577 GGPSearchForm *form; | |
2393 | 1578 |
12220
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
1579 if (info->search_form != NULL) { |
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
1580 gaim_notify_error(gc, NULL, |
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
1581 _("Unable to initiate a new search"), |
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
1582 _("You have a pending search. Please wait for it to finish.")); |
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
1583 return; |
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
1584 } |
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
1585 |
11414 | 1586 form = ggp_search_form_new(); |
11360 | 1587 info->search_form = form; |
1588 | |
1589 form->uin = g_strdup(name); | |
1590 form->offset = g_strdup("0"); | |
1591 form->last_uin = g_strdup("0"); | |
1592 | |
11414 | 1593 ggp_search_start(gc, form); |
11360 | 1594 } |
1595 /* }}} */ | |
1596 | |
1597 /* static void ggp_set_status(GaimAccount *account, GaimStatus *status) {{{ */ | |
1598 static void ggp_set_status(GaimAccount *account, GaimStatus *status) | |
1599 { | |
1600 GaimStatusPrimitive prim; | |
1601 GaimConnection *gc; | |
1602 GGPInfo *info; | |
11397 | 1603 const char *status_id, *msg; |
11360 | 1604 int new_status, new_status_descr; |
1605 | |
1606 prim = gaim_status_type_get_primitive(gaim_status_get_type(status)); | |
1607 | |
1608 if (!gaim_status_is_active(status)) | |
1609 return; | |
1610 | |
1611 gc = gaim_account_get_connection(account); | |
1612 info = gc->proto_data; | |
1613 | |
1614 status_id = gaim_status_get_id(status); | |
1615 | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1616 gaim_debug_info("gg", "ggp_set_status: Requested status = %s\n", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1617 status_id); |
2393 | 1618 |
11360 | 1619 if (strcmp(status_id, "available") == 0) { |
1620 new_status = GG_STATUS_AVAIL; | |
1621 new_status_descr = GG_STATUS_AVAIL_DESCR; | |
1622 } else if (strcmp(status_id, "away") == 0) { | |
1623 new_status = GG_STATUS_BUSY; | |
1624 new_status_descr = GG_STATUS_BUSY_DESCR; | |
1625 } else if (strcmp(status_id, "invisible") == 0) { | |
1626 new_status = GG_STATUS_INVISIBLE; | |
1627 new_status_descr = GG_STATUS_INVISIBLE_DESCR; | |
1628 } else { | |
1629 new_status = GG_STATUS_AVAIL; | |
1630 new_status_descr = GG_STATUS_AVAIL_DESCR; | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1631 gaim_debug_info("gg", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1632 "ggp_set_status: uknown status requested (status_id=%s)\n", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1633 status_id); |
11360 | 1634 } |
4916 | 1635 |
11397 | 1636 msg = gaim_status_get_attr_string(status, "message"); |
11360 | 1637 |
1638 if (msg == NULL) { | |
1639 gaim_debug_info("gg", "ggp_set_status: msg == NULL\n"); | |
1640 gg_change_status(info->session, new_status); | |
1641 } else { | |
1642 char *tmp = charset_convert(msg, "UTF-8", "CP1250"); | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1643 gaim_debug_info("gg", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1644 "ggp_set_status: msg != NULL. msg = %s\n", tmp); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1645 gaim_debug_info("gg", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1646 "ggp_set_status: gg_change_status_descr() = %d\n", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1647 gg_change_status_descr(info->session, new_status_descr, tmp)); |
11360 | 1648 g_free(tmp); |
1649 } | |
9944 | 1650 |
11360 | 1651 } |
1652 /* }}} */ | |
1653 | |
1654 /* static void ggp_add_buddy(GaimConnection *gc, GaimBuddy *buddy, GaimGroup *group) {{{ */ | |
1655 static void ggp_add_buddy(GaimConnection *gc, GaimBuddy *buddy, GaimGroup *group) | |
1656 { | |
1657 GGPInfo *info = gc->proto_data; | |
1658 | |
1659 gg_add_notify(info->session, ggp_str_to_uin(buddy->name)); | |
1660 } | |
1661 /* }}} */ | |
1662 | |
1663 /* static void ggp_remove_buddy(GaimConnection *gc, GaimBuddy *buddy, GaimGroup *group) {{{ */ | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1664 static void ggp_remove_buddy(GaimConnection *gc, GaimBuddy *buddy, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1665 GaimGroup *group) |
11360 | 1666 { |
1667 GGPInfo *info = gc->proto_data; | |
1668 | |
1669 gg_remove_notify(info->session, ggp_str_to_uin(buddy->name)); | |
1670 } | |
1671 /* }}} */ | |
1672 | |
11394 | 1673 /* static void ggp_join_chat(GaimConnection *gc, GHashTable *data) {{{ */ |
1674 static void ggp_join_chat(GaimConnection *gc, GHashTable *data) | |
1675 { | |
1676 GGPInfo *info = gc->proto_data; | |
1677 GGPChat *chat; | |
1678 char *chat_name; | |
1679 GList *l; | |
1680 | |
1681 chat_name = g_hash_table_lookup(data, "name"); | |
1682 | |
1683 if (chat_name == NULL) | |
1684 return; | |
1685 | |
1686 gaim_debug_info("gg", "joined %s chat\n", chat_name); | |
1687 | |
1688 for (l = info->chats; l != NULL; l = l->next) { | |
1689 chat = l->data; | |
1690 | |
1691 if (chat != NULL && g_utf8_collate(chat->name, chat_name) == 0) { | |
1692 gaim_notify_error(gc, _("Chat error"), | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1693 _("This chat name is already in use"), NULL); |
11394 | 1694 return; |
1695 } | |
1696 } | |
1697 | |
11414 | 1698 ggp_confer_add_new(gc, chat_name); |
11394 | 1699 serv_got_joined_chat(gc, info->chats_count, chat_name); |
1700 } | |
1701 /* }}} */ | |
1702 | |
1703 /* static char *ggp_get_chat_name(GHashTable *data) { {{{ */ | |
1704 static char *ggp_get_chat_name(GHashTable *data) { | |
1705 return g_strdup(g_hash_table_lookup(data, "name")); | |
1706 } | |
1707 /* }}} */ | |
1708 | |
12216 | 1709 /* static int ggp_chat_send(GaimConnection *gc, int id, const char *message, GaimMessageFlags flags) {{{ */ |
1710 static int ggp_chat_send(GaimConnection *gc, int id, const char *message, GaimMessageFlags flags) | |
11394 | 1711 { |
1712 GaimConversation *conv; | |
1713 GGPInfo *info = gc->proto_data; | |
1714 GGPChat *chat = NULL; | |
1715 GList *l; | |
12216 | 1716 char *msg, *plain; |
11394 | 1717 uin_t *uins; |
1718 int count = 0; | |
1719 | |
1720 if ((conv = gaim_find_chat(gc, id)) == NULL) | |
1721 return -EINVAL; | |
1722 | |
1723 for (l = info->chats; l != NULL; l = l->next) { | |
1724 chat = l->data; | |
1725 | |
1726 if (g_utf8_collate(chat->name, conv->name) == 0) { | |
1727 gaim_debug_info("gg", "found conv!\n"); | |
1728 break; | |
1729 } | |
1730 | |
1731 chat = NULL; | |
1732 } | |
1733 | |
1734 if (chat == NULL) { | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1735 gaim_debug_error("gg", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1736 "ggp_chat_send: Hm... that's strange. No such chat?\n"); |
11394 | 1737 return -EINVAL; |
1738 } | |
1739 | |
1740 uins = g_new0(uin_t, g_list_length(chat->participants)); | |
1741 for (l = chat->participants; l != NULL; l = l->next) { | |
1742 gchar *name = l->data; | |
1743 uin_t uin; | |
1744 | |
1745 if ((uin = ggp_str_to_uin(name)) != 0) | |
1746 uins[count++] = uin; | |
1747 } | |
1748 | |
12216 | 1749 plain = gaim_unescape_html(message); |
1750 msg = charset_convert(plain, "UTF-8", "CP1250"); | |
1751 g_free(plain); | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1752 gg_send_message_confer(info->session, GG_CLASS_CHAT, count, uins, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1753 (unsigned char *)msg); |
11394 | 1754 g_free(msg); |
1755 g_free(uins); | |
1756 | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1757 serv_got_chat_in(gc, id, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1758 gaim_account_get_username(gaim_connection_get_account(gc)), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1759 0, message, time(NULL)); |
11394 | 1760 |
1761 return 0; | |
1762 } | |
1763 /* }}} */ | |
1764 | |
11360 | 1765 /* static void ggp_keepalive(GaimConnection *gc) {{{ */ |
1766 static void ggp_keepalive(GaimConnection *gc) | |
1767 { | |
1768 GGPInfo *info = gc->proto_data; | |
1769 | |
1770 /* gaim_debug_info("gg", "Keeping connection alive....\n"); */ | |
1771 | |
1772 if (gg_ping(info->session) < 0) { | |
1773 gaim_debug_info("gg", "Not connected to the server " | |
1774 "or gg_session is not correct\n"); | |
1775 gaim_connection_error(gc, _("Not connected to the server.")); | |
4916 | 1776 } |
2393 | 1777 } |
11360 | 1778 /* }}} */ |
1779 | |
1780 /* static void ggp_register_user(GaimAccount *account) {{{ */ | |
1781 static void ggp_register_user(GaimAccount *account) | |
1782 { | |
11542
cda814bad7f8
[gaim-migrate @ 13797]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11541
diff
changeset
|
1783 GaimConnection *gc = gaim_account_get_connection(account); |
11360 | 1784 GGPInfo *info; |
1785 | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1786 info = gc->proto_data = g_new0(GGPInfo, 1); |
11360 | 1787 |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1788 ggp_token_request(gc, ggp_register_user_dialog); |
2393 | 1789 } |
11360 | 1790 /* }}} */ |
2393 | 1791 |
11360 | 1792 /* static GList *ggp_actions(GaimPlugin *plugin, gpointer context) {{{ */ |
1793 static GList *ggp_actions(GaimPlugin *plugin, gpointer context) | |
8775 | 1794 { |
11360 | 1795 GList *m = NULL; |
1796 GaimPluginAction *act; | |
1797 | |
12220
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
1798 act = gaim_plugin_action_new(_("Find buddies..."), |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1799 ggp_find_buddies); |
11360 | 1800 m = g_list_append(m, act); |
1801 | |
1802 m = g_list_append(m, NULL); | |
1803 | |
12220
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
1804 act = gaim_plugin_action_new(_("Change password..."), |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1805 ggp_change_passwd); |
11360 | 1806 m = g_list_append(m, act); |
1807 | |
1808 m = g_list_append(m, NULL); | |
1809 | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1810 act = gaim_plugin_action_new(_("Upload buddylist to Server"), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1811 ggp_action_buddylist_put); |
11360 | 1812 m = g_list_append(m, act); |
8775 | 1813 |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1814 act = gaim_plugin_action_new(_("Download buddylist from Server"), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1815 ggp_action_buddylist_get); |
11360 | 1816 m = g_list_append(m, act); |
1817 | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1818 act = gaim_plugin_action_new(_("Delete buddylist from Server"), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1819 ggp_action_buddylist_delete); |
11360 | 1820 m = g_list_append(m, act); |
1821 | |
12220
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
1822 act = gaim_plugin_action_new(_("Save buddylist to file..."), |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1823 ggp_action_buddylist_save); |
11360 | 1824 m = g_list_append(m, act); |
8775 | 1825 |
12220
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
1826 act = gaim_plugin_action_new(_("Load buddylist from file..."), |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1827 ggp_action_buddylist_load); |
11360 | 1828 m = g_list_append(m, act); |
1829 | |
1830 return m; | |
8775 | 1831 } |
11360 | 1832 /* }}} */ |
8775 | 1833 |
11360 | 1834 /* prpl_info setup {{{ */ |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
1835 static GaimPluginProtocolInfo prpl_info = |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
1836 { |
11360 | 1837 OPT_PROTO_REGISTER_NOSCREENNAME, |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1838 NULL, /* user_splits */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1839 NULL, /* protocol_options */ |
9950 | 1840 NO_BUDDY_ICONS, /* icon_spec */ |
11360 | 1841 ggp_list_icon, /* list_icon */ |
1842 ggp_list_emblems, /* list_emblems */ | |
1843 ggp_status_text, /* status_text */ | |
1844 ggp_tooltip_text, /* tooltip_text */ | |
1845 ggp_status_types, /* status_types */ | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1846 ggp_blist_node_menu, /* blist_node_menu */ |
11394 | 1847 ggp_chat_info, /* chat_info */ |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1848 NULL, /* chat_info_defaults */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1849 ggp_login, /* login */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1850 ggp_close, /* close */ |
11360 | 1851 ggp_send_im, /* send_im */ |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1852 NULL, /* set_info */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1853 NULL, /* send_typing */ |
11360 | 1854 ggp_get_info, /* get_info */ |
1855 ggp_set_status, /* set_away */ | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1856 NULL, /* set_idle */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1857 NULL, /* change_passwd */ |
11360 | 1858 ggp_add_buddy, /* add_buddy */ |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1859 NULL, /* add_buddies */ |
11360 | 1860 ggp_remove_buddy, /* remove_buddy */ |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1861 NULL, /* remove_buddies */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1862 NULL, /* add_permit */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1863 NULL, /* add_deny */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1864 NULL, /* rem_permit */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1865 NULL, /* rem_deny */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1866 NULL, /* set_permit_deny */ |
11394 | 1867 ggp_join_chat, /* join_chat */ |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1868 NULL, /* reject_chat */ |
11394 | 1869 ggp_get_chat_name, /* get_chat_name */ |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1870 NULL, /* chat_invite */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1871 NULL, /* chat_leave */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1872 NULL, /* chat_whisper */ |
11394 | 1873 ggp_chat_send, /* chat_send */ |
11360 | 1874 ggp_keepalive, /* keepalive */ |
1875 ggp_register_user, /* register_user */ | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1876 NULL, /* get_cb_info */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1877 NULL, /* get_cb_away */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1878 NULL, /* alias_buddy */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1879 NULL, /* group_buddy */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1880 NULL, /* rename_group */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1881 NULL, /* buddy_free */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1882 NULL, /* convo_closed */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1883 NULL, /* normalize */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1884 NULL, /* set_buddy_icon */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1885 NULL, /* remove_group */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1886 NULL, /* get_cb_real_name */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1887 NULL, /* set_chat_topic */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1888 NULL, /* find_blist_chat */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1889 NULL, /* roomlist_get_list */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1890 NULL, /* roomlist_cancel */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1891 NULL, /* roomlist_expand_category */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1892 NULL, /* can_receive_file */ |
12143
cbebda5f019c
[gaim-migrate @ 14444]
Richard Laager <rlaager@wiktel.com>
parents:
12007
diff
changeset
|
1893 NULL, /* send_file */ |
cbebda5f019c
[gaim-migrate @ 14444]
Richard Laager <rlaager@wiktel.com>
parents:
12007
diff
changeset
|
1894 NULL /* new_xfer */ |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
1895 }; |
11360 | 1896 /* }}} */ |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
1897 |
11360 | 1898 /* GaimPluginInfo setup {{{ */ |
1899 static GaimPluginInfo info = { | |
1900 GAIM_PLUGIN_MAGIC, /* magic */ | |
1901 GAIM_MAJOR_VERSION, /* major_version */ | |
1902 GAIM_MINOR_VERSION, /* minor_version */ | |
1903 GAIM_PLUGIN_PROTOCOL, /* plugin type */ | |
1904 NULL, /* ui_requirement */ | |
1905 0, /* flags */ | |
1906 NULL, /* dependencies */ | |
1907 GAIM_PRIORITY_DEFAULT, /* priority */ | |
1908 | |
1909 "prpl-gg", /* id */ | |
1910 "Gadu-Gadu", /* name */ | |
1911 VERSION, /* version */ | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
1912 |
11360 | 1913 N_("Gadu-Gadu Protocol Plugin"), /* summary */ |
1914 N_("Polish popular IM"), /* description */ | |
1915 "boler@sourceforge.net", /* author */ | |
1916 GAIM_WEBSITE, /* homepage */ | |
1917 | |
1918 NULL, /* load */ | |
1919 NULL, /* unload */ | |
1920 NULL, /* destroy */ | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
1921 |
11360 | 1922 NULL, /* ui_info */ |
1923 &prpl_info, /* extra_info */ | |
1924 NULL, /* prefs_info */ | |
1925 ggp_actions /* actions */ | |
1926 }; | |
1927 /* }}} */ | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
1928 |
11565 | 1929 /* static void gaim_gg_debug_handler(int level, const char * format, va_list args) {{{ */ |
11541
5fc015909164
[gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11538
diff
changeset
|
1930 static void gaim_gg_debug_handler(int level, const char * format, va_list args) { |
5fc015909164
[gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11538
diff
changeset
|
1931 GaimDebugLevel gaim_level; |
5fc015909164
[gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11538
diff
changeset
|
1932 char *msg = g_strdup_vprintf(format, args); |
5fc015909164
[gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11538
diff
changeset
|
1933 |
5fc015909164
[gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11538
diff
changeset
|
1934 /* This is pretty pointless since the GG_DEBUG levels don't correspond to |
5fc015909164
[gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11538
diff
changeset
|
1935 * the gaim ones */ |
5fc015909164
[gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11538
diff
changeset
|
1936 switch (level) { |
5fc015909164
[gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11538
diff
changeset
|
1937 case GG_DEBUG_FUNCTION: |
5fc015909164
[gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11538
diff
changeset
|
1938 gaim_level = GAIM_DEBUG_INFO; |
5fc015909164
[gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11538
diff
changeset
|
1939 break; |
5fc015909164
[gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11538
diff
changeset
|
1940 case GG_DEBUG_MISC: |
5fc015909164
[gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11538
diff
changeset
|
1941 case GG_DEBUG_NET: |
5fc015909164
[gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11538
diff
changeset
|
1942 case GG_DEBUG_DUMP: |
5fc015909164
[gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11538
diff
changeset
|
1943 case GG_DEBUG_TRAFFIC: |
5fc015909164
[gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11538
diff
changeset
|
1944 default: |
5fc015909164
[gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11538
diff
changeset
|
1945 gaim_level = GAIM_DEBUG_MISC; |
5fc015909164
[gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11538
diff
changeset
|
1946 break; |
5fc015909164
[gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11538
diff
changeset
|
1947 } |
5fc015909164
[gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11538
diff
changeset
|
1948 |
5fc015909164
[gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11538
diff
changeset
|
1949 gaim_debug(gaim_level, "gg", msg); |
5fc015909164
[gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11538
diff
changeset
|
1950 g_free(msg); |
5fc015909164
[gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11538
diff
changeset
|
1951 } |
11565 | 1952 /* }}} */ |
11541
5fc015909164
[gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11538
diff
changeset
|
1953 |
11360 | 1954 /* |
1955 */ | |
1956 /* static void init_plugin(GaimPlugin *plugin) {{{ */ | |
1957 static void init_plugin(GaimPlugin *plugin) | |
2393 | 1958 { |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5618
diff
changeset
|
1959 GaimAccountOption *option; |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
1960 |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1961 option = gaim_account_option_string_new(_("Nickname"), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1962 "nick", _("Gadu-Gadu User")); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1963 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1964 option); |
3572 | 1965 |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
1966 my_protocol = plugin; |
11541
5fc015909164
[gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11538
diff
changeset
|
1967 |
5fc015909164
[gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11538
diff
changeset
|
1968 gg_debug_handler = gaim_gg_debug_handler; |
2393 | 1969 } |
11360 | 1970 /* }}} */ |
2393 | 1971 |
11909
1b029c5898af
[gaim-migrate @ 14200]
Richard Laager <rlaager@wiktel.com>
parents:
11837
diff
changeset
|
1972 GAIM_INIT_PLUGIN(gg, init_plugin, info); |
11360 | 1973 |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1974 /* vim: set ts=8 sts=0 sw=8 noet: */ |