annotate src/protocols/gg/gg.c @ 12277:739e3aca067a

[gaim-migrate @ 14581] Readding the error checking that I took out in the last commit. I thought about this more today and just confirmed.... It ensures correct behavior if the UI doesn't implement this part of the notify API (and it's not required to). Bartosz Oler agreed that I was right when presented with this case. I'm sorry for the indecision on this. committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Thu, 01 Dec 2005 00:36:19 +0000
parents 2b61f681ff99
children 508512caa22e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11394
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1 /**
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2 * @file gg.c Gadu-Gadu protocol plugin
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
3 *
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
4 * gaim
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
5 *
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
6 * Copyright (C) 2005 Bartosz Oler <bartosz@bzimage.us>
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
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
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
9 * of this plugin written by Arkadiusz Miskiewicz <misiek@pld.org.pl>
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
10 *
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
11 * Thanks to Google's Summer of Code Program.
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
12 *
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
13 * This program is free software; you can redistribute it and/or modify
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
14 * it under the terms of the GNU General Public License as published by
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
15 * the Free Software Foundation; either version 2 of the License, or
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
16 * (at your option) any later version.
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
17 *
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
18 * This program is distributed in the hope that it will be useful,
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
21 * GNU General Public License for more details.
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
22 *
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
23 * You should have received a copy of the GNU General Public License
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
24 * along with this program; if not, write to the Free Software
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
26 */
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
27
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
28
2393
a7ecfd3f7714 [gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
29 /*
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
30 * NOTES
2393
a7ecfd3f7714 [gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
31 *
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
32 * I don't like automatic updates of the buddylist stored on the server, so not
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
33 * going to implement this. Maybe some kind of option to enable/disable this
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
34 * feature.
2393
a7ecfd3f7714 [gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
35 */
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
36
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
37 #include "internal.h"
2393
a7ecfd3f7714 [gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
38
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
39 #include "plugin.h"
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
40 #include "version.h"
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
41 #include "notify.h"
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
42 #include "status.h"
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
43 #include "blist.h"
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
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
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
47 #include "request.h"
2393
a7ecfd3f7714 [gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
48
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
49 #include "lib/libgadu.h"
5603
ea09a005a10d [gaim-migrate @ 6007]
Nathan Walp <nwalp@pidgin.im>
parents: 5597
diff changeset
50
11414
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
51 #include "gg.h"
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
52 #include "confer.h"
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
53 #include "search.h"
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
54 #include "buddylist.h"
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
55 #include "utils.h"
11394
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
56
11414
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
57 static GaimPlugin *my_protocol = NULL;
11394
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
58
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
59 /* ---------------------------------------------------------------------- */
11414
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
60 /* ----- EXTERNAL CALLBACKS --------------------------------------------- */
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
61 /* ---------------------------------------------------------------------- */
9950
ba085944efee [gaim-migrate @ 10846]
Tim Ringenbach <marv@pidgin.im>
parents: 9944
diff changeset
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
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
162 /**
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
163 * Request buddylist from the server.
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
164 * Buddylist is received in the ggp_callback_recv().
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
165 *
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
166 * @param Current action handler.
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
167 */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
168 /* static void ggp_action_buddylist_get(GaimPluginAction *action) {{{ */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
169 static void ggp_action_buddylist_get(GaimPluginAction *action)
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
170 {
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
171 GaimConnection *gc = (GaimConnection *)action->context;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
172 GGPInfo *info = gc->proto_data;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
173
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
174 gaim_debug_info("gg", "Downloading...\n");
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
175
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
176 gg_userlist_request(info->session, GG_USERLIST_GET, NULL);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
177 }
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
178 /* }}} */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
179
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
180 /**
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
181 * Upload the buddylist to the server.
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
182 *
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
183 * @param action Current action handler.
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
184 */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
185 /* static void ggp_action_buddylist_put(GaimPluginAction *action) {{{ */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
186 static void ggp_action_buddylist_put(GaimPluginAction *action)
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
187 {
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
188 GaimConnection *gc = (GaimConnection *)action->context;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
189 GGPInfo *info = gc->proto_data;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
190
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
191 char *buddylist = ggp_buddylist_dump(gaim_connection_get_account(gc));
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
192
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
193 gaim_debug_info("gg", "Uploading...\n");
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
194
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
195 if (buddylist == NULL)
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
196 return;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
197
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
198 gg_userlist_request(info->session, GG_USERLIST_PUT, buddylist);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
199 g_free(buddylist);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
200 }
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
201 /* }}} */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
202
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
203 /**
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
204 * Delete buddylist from the server.
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
205 *
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
206 * @param action Current action handler.
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
207 */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
208 /* static void ggp_action_buddylist_delete(GaimPluginAction *action) {{{ */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
209 static void ggp_action_buddylist_delete(GaimPluginAction *action)
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
210 {
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
211 GaimConnection *gc = (GaimConnection *)action->context;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
212 GGPInfo *info = gc->proto_data;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
213
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
214 gaim_debug_info("gg", "Deleting...\n");
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
215
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
216 gg_userlist_request(info->session, GG_USERLIST_PUT, NULL);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
217 }
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
218 /* }}} */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
219
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
220 /*
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
221 */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
222 /* static void ggp_callback_buddylist_save_ok(GaimConnection *gc, gchar *file) {{{ */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
223 static void ggp_callback_buddylist_save_ok(GaimConnection *gc, gchar *file)
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
224 {
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
225 GaimAccount *account = gaim_connection_get_account(gc);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
226
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
227 FILE *fh;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
228 char *buddylist = ggp_buddylist_dump(account);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
229 gchar *msg;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
230
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
231 gaim_debug_info("gg", "Saving...\n");
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
232 gaim_debug_info("gg", "file = %s\n", file);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
233
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
234 if (buddylist == NULL) {
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
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
a7ecfd3f7714 [gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
240
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
241 if ((fh = g_fopen(file, "wb")) == NULL) {
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
242 msg = g_strconcat(_("Couldn't open file"), ": ", file, "\n", NULL);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
243 gaim_debug_error("gg", "Could not open file: %s\n", file);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
244 gaim_notify_error(account, _("Couldn't open file"), msg, NULL);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
245 g_free(msg);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
246 g_free(file);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
247 return;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
248 }
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
249
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
250 fwrite(buddylist, sizeof(char), g_utf8_strlen(buddylist, -1), fh);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
251 fclose(fh);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
252 g_free(buddylist);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
253
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
254 gaim_notify_info(account, _("Save Buddylist..."),
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
255 _("Buddylist saved successfully!"), NULL);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
256 }
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
257 /* }}} */
2806
1ffac7cf4e94 [gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2792
diff changeset
258
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
259 /*
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
260 */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
261 /* static void ggp_callback_buddylist_load_ok(GaimConnection *gc, gchar *file) {{{ */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
262 static void ggp_callback_buddylist_load_ok(GaimConnection *gc, gchar *file)
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
263 {
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
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
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
268
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
269 gaim_debug_info("gg", "file_name = %s\n", file);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
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
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
285
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
286 ggp_buddylist_load(gc, buddylist);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
287 g_free(buddylist);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
288
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
289 gaim_notify_info(account,
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
290 _("Load Buddylist..."),
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
291 _("Buddylist loaded successfully!"), NULL);
2806
1ffac7cf4e94 [gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2792
diff changeset
292 }
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
293 /* }}} */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
294
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
295 /*
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
296 */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
297 /* static void ggp_action_buddylist_save(GaimPluginAction *action) {{{ */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
298 static void ggp_action_buddylist_save(GaimPluginAction *action)
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
299 {
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
300 GaimConnection *gc = (GaimConnection *)action->context;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
301
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
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
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
304 }
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
305 /* }}} */
2806
1ffac7cf4e94 [gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2792
diff changeset
306
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
307 /*
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
308 */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
309 /* static void ggp_action_buddylist_load(GaimPluginAction *action) {{{ */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
310 static void ggp_action_buddylist_load(GaimPluginAction *action)
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
311 {
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
312 GaimConnection *gc = (GaimConnection *)action->context;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
313
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
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
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
316 }
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
317 /* }}} */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
318
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
319 /*
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
320 */
11414
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
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
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
324 {
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
325 GaimAccount *account;
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
326 GGPInfo *info = gc->proto_data;
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
327 struct gg_http *h = NULL;
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
328 struct gg_pubdir *s;
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
329 uin_t uin;
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
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
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
332
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
333 email = charset_convert(gaim_request_fields_get_string(fields, "email"),
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
334 "UTF-8", "CP1250");
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
335 p1 = charset_convert(gaim_request_fields_get_string(fields, "password1"),
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
336 "UTF-8", "CP1250");
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
337 p2 = charset_convert(gaim_request_fields_get_string(fields, "password2"),
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
338 "UTF-8", "CP1250");
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
339 t = charset_convert(gaim_request_fields_get_string(fields, "token"),
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
340 "UTF-8", "CP1250");
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
341
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
342 account = gaim_connection_get_account(gc);
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
343
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
344 if (email == NULL || p1 == NULL || p2 == NULL || t == NULL ||
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
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
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
347 goto exit_err;
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
348 }
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
349
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
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
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
352 goto exit_err;
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
353 }
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
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
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
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
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
361 goto exit_err;
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
362 }
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
363
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
364 uin = s->uin;
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
365 gaim_debug_info("gg", "registered uin: %d\n", uin);
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
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
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
373 gaim_notify_info(NULL, _("New Gadu-Gadu Account Registered"),
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
374 _("Registration completed successfully!"), NULL);
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
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
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
384 exit_err:
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
385 gg_register_free(h);
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
386 g_free(email);
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
387 g_free(p1);
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
388 g_free(p2);
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
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
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
392 }
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
393 /* }}} */
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
394
11565
2aa7d8dd61d7 [gaim-migrate @ 13831]
Bartoz Oler <bartosz@pidgin.im>
parents: 11545
diff changeset
395 /*
2aa7d8dd61d7 [gaim-migrate @ 13831]
Bartoz Oler <bartosz@pidgin.im>
parents: 11545
diff changeset
396 */
2aa7d8dd61d7 [gaim-migrate @ 13831]
Bartoz Oler <bartosz@pidgin.im>
parents: 11545
diff changeset
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
2aa7d8dd61d7 [gaim-migrate @ 13831]
Bartoz Oler <bartosz@pidgin.im>
parents: 11545
diff changeset
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
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
469 /* ----- PUBLIC DIRECTORY SEARCH ---------------------------------------- */
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
470
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
471 /*
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
472 */
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
473 /* static void ggp_callback_show_next(GaimConnection *gc, GList *row) {{{ */
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
474 static void ggp_callback_show_next(GaimConnection *gc, GList *row)
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
475 {
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
476 GGPInfo *info = gc->proto_data;
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
477
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
478 g_free(info->search_form->offset);
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
479 info->search_form->offset = g_strdup(info->search_form->last_uin);
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
480 ggp_search_start(gc, info->search_form);
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
481 }
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
482 /* }}} */
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
483
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
484 /*
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
485 */
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
486 /* static void ggp_callback_add_buddy(GaimConnection *gc, GList *row) {{{ */
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
487 static void ggp_callback_add_buddy(GaimConnection *gc, GList *row)
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
488 {
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
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
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
491 }
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
492 /* }}} */
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
493
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
494 /*
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
495 */
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
496 /* static void ggp_callback_find_buddies(GaimConnection *gc, GaimRequestFields *fields) {{{ */
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
497 static void ggp_callback_find_buddies(GaimConnection *gc, GaimRequestFields *fields)
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
498 {
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
499 GGPInfo *info = gc->proto_data;
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
500 GGPSearchForm *form;
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
501
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
502 form = ggp_search_form_new();
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
503 info->search_form = form;
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
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
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
520
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
521 switch (gaim_request_fields_get_choice(fields, "gender")) {
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
522 case 1:
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
523 form->gender = g_strdup(GG_PUBDIR50_GENDER_MALE);
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
524 break;
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
525 case 2:
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
526 form->gender = g_strdup(GG_PUBDIR50_GENDER_FEMALE);
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
527 break;
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
528 default:
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
529 form->gender = NULL;
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
530 break;
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
531 }
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
532
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
533 form->active = gaim_request_fields_get_bool(fields, "active")
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
534 ? g_strdup(GG_PUBDIR50_ACTIVE_TRUE) : NULL;
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
535
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
536 form->offset = g_strdup("0");
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
537
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
538 ggp_search_start(gc, form);
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
539 }
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
540 /* }}} */
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
541
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
542 /*
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
543 */
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
544 /* static void ggp_find_buddies(GaimPluginAction *action) {{{ */
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
545 static void ggp_find_buddies(GaimPluginAction *action)
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
546 {
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
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
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
549
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
550 GaimRequestFields *fields;
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
551 GaimRequestFieldGroup *group;
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
552 GaimRequestField *field;
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
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
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
561 fields = gaim_request_fields_new();
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
562 group = gaim_request_field_group_new(NULL);
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
563 gaim_request_fields_add_group(fields, group);
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
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
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
567 gaim_request_field_string_set_masked(field, FALSE);
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
568 gaim_request_field_group_add_field(group, field);
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
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
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
572 gaim_request_field_string_set_masked(field, FALSE);
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
573 gaim_request_field_group_add_field(group, field);
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
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
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
577 gaim_request_field_string_set_masked(field, FALSE);
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
578 gaim_request_field_group_add_field(group, field);
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
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
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
582 gaim_request_field_string_set_masked(field, FALSE);
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
583 gaim_request_field_group_add_field(group, field);
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
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
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
587 gaim_request_field_group_add_field(group, field);
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
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
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
593 gaim_request_field_group_add_field(group, field);
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
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
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
597 gaim_request_field_group_add_field(group, field);
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
598
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
599 gaim_request_fields(gc,
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
600 _("Find buddies"),
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
601 _("Find buddies"),
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
602 _("Please, enter your search criteria below"),
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
603 fields,
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
604 _("OK"), G_CALLBACK(ggp_callback_find_buddies),
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
605 _("Cancel"), NULL,
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
606 gc);
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
607 }
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
608 /* }}} */
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
609
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
610 /* ----- CHANGE PASSWORD ------------------------------------------------ */
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
611
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
612 /*
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
613 */
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
614 /* static void ggp_callback_change_passwd_ok(GaimConnection *gc, GaimRequestFields *fields) {{{ */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
615 static void ggp_callback_change_passwd_ok(GaimConnection *gc, GaimRequestFields *fields)
2393
a7ecfd3f7714 [gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
616 {
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
617 GaimAccount *account;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
618 GGPInfo *info = gc->proto_data;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
619 struct gg_http *h;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
620 gchar *cur, *p1, *p2, *t;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
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
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
634
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
635 account = gaim_connection_get_account(gc);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
636
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
637 if (cur == NULL || p1 == NULL || p2 == NULL || t == NULL ||
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
638 *cur == '\0' || *p1 == '\0' || *p2 == '\0' || *t == '\0') {
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
639 gaim_notify_error(account, NULL, _("Fill in the fields."), NULL);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
640 goto exit_err;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
641 }
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
642
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
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
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
646 goto exit_err;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
647 }
2393
a7ecfd3f7714 [gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
648
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
649 if (g_utf8_collate(cur, gaim_account_get_password(account)) != 0) {
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
650 gaim_notify_error(account, NULL,
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
651 _("Your current password is different from the one that you specified."),
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
652 NULL);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
653 goto exit_err;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
654 }
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
655
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
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
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
658
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
659 /* XXX: this e-mail should be a pref... */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
660 h = gg_change_passwd4(ggp_get_uin(account),
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
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
a7ecfd3f7714 [gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
663
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
664 if (h == NULL) {
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
665 gaim_notify_error(account, NULL,
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
666 _("Unable to change password. Error occured.\n"),
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
667 NULL);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
668 goto exit_err;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
669 }
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
670
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
671 gaim_account_set_password(account, p1);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
672
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
673 gg_change_passwd_free(h);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
674
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
675 gaim_notify_info(account, _("Change password for the Gadu-Gadu account"),
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
676 _("Password was changed successfully!"), NULL);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
677
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
678 exit_err:
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
679 g_free(cur);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
680 g_free(p1);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
681 g_free(p2);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
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
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
745 }
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
746 /* }}} */
2393
a7ecfd3f7714 [gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
747
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
748 /*
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
749 */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
750 /* static void ggp_change_passwd(GaimPluginAction *action) {{{ */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
751 static void ggp_change_passwd(GaimPluginAction *action)
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
752 {
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
753 GaimConnection *gc = (GaimConnection *)action->context;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
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
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
756 }
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
757 /* }}} */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
758
11414
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
759 /* ----- CONFERENCES ---------------------------------------------------- */
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
760
11394
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
761 /*
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
762 */
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
763 /* static void ggp_callback_add_to_chat_ok(GaimConnection *gc, GaimRequestFields *fields) {{{ */
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
764 static void ggp_callback_add_to_chat_ok(GaimConnection *gc, GaimRequestFields *fields)
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
765 {
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
766 GGPInfo *info = gc->proto_data;
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
767 GaimRequestField *field;
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
768 const GList *sel, *l;
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
769
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
770 field = gaim_request_fields_get_field(fields, "name");
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
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
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
774
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
775 for (l = info->chats; l != NULL; l = l->next) {
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
776 GGPChat *chat = l->data;
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
777
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
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
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
781 break;
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
782 }
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
783 }
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
784 }
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
785 /* }}} */
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
786
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
787 /*
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
788 */
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
789 /* static void ggp_bmenu_add_to_chat(GaimBlistNode *node, gpointer ignored) {{{ */
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
790 static void ggp_bmenu_add_to_chat(GaimBlistNode *node, gpointer ignored)
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
791 {
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
792 GaimBuddy *buddy;
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
793 GaimConnection *gc;
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
794 GGPInfo *info;
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
795
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
796 GaimRequestFields *fields;
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
797 GaimRequestFieldGroup *group;
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
798 GaimRequestField *field;
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
799
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
800 GList *l;
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
801 gchar *msg;
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
802
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
803 buddy = (GaimBuddy *)node;
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
804 gc = gaim_account_get_connection(gaim_buddy_get_account(buddy));
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
805 info = gc->proto_data;
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
806
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
807 /* TODO: It tmp_buddy != NULL then stop! */
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
808 info->tmp_buddy = g_strdup(gaim_buddy_get_name(buddy));
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
809
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
810 fields = gaim_request_fields_new();
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
811 group = gaim_request_field_group_new(NULL);
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
812 gaim_request_fields_add_group(fields, group);
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
813
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
814 field = gaim_request_field_list_new("name", "Chat name");
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
815 for (l = info->chats; l != NULL; l = l->next) {
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
816 GGPChat *chat = l->data;
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
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
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
820 }
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
821 gaim_request_field_group_add_field(group, field);
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
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
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
825 gaim_request_fields(gc,
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
826 _("Add to chat..."),
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
827 _("Add to chat..."),
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
828 msg,
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
829 fields,
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
830 _("Add"), G_CALLBACK(ggp_callback_add_to_chat_ok),
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
831 _("Cancel"), NULL, gc);
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
832 g_free(msg);
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
833 }
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
834 /* }}} */
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
835
11414
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
836 /* ----- BLOCK BUDDIES -------------------------------------------------- */
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
837
11410
bc374facaeb2 [gaim-migrate @ 13647]
Bartoz Oler <bartosz@pidgin.im>
parents: 11397
diff changeset
838 /*
bc374facaeb2 [gaim-migrate @ 13647]
Bartoz Oler <bartosz@pidgin.im>
parents: 11397
diff changeset
839 */
bc374facaeb2 [gaim-migrate @ 13647]
Bartoz Oler <bartosz@pidgin.im>
parents: 11397
diff changeset
840 /* static void ggp_bmenu_block(GaimBlistNode *node, gpointer ignored) {{{ */
bc374facaeb2 [gaim-migrate @ 13647]
Bartoz Oler <bartosz@pidgin.im>
parents: 11397
diff changeset
841 static void ggp_bmenu_block(GaimBlistNode *node, gpointer ignored)
bc374facaeb2 [gaim-migrate @ 13647]
Bartoz Oler <bartosz@pidgin.im>
parents: 11397
diff changeset
842 {
bc374facaeb2 [gaim-migrate @ 13647]
Bartoz Oler <bartosz@pidgin.im>
parents: 11397
diff changeset
843 GaimConnection *gc;
bc374facaeb2 [gaim-migrate @ 13647]
Bartoz Oler <bartosz@pidgin.im>
parents: 11397
diff changeset
844 GaimBuddy *buddy;
bc374facaeb2 [gaim-migrate @ 13647]
Bartoz Oler <bartosz@pidgin.im>
parents: 11397
diff changeset
845 GGPInfo *info;
bc374facaeb2 [gaim-migrate @ 13647]
Bartoz Oler <bartosz@pidgin.im>
parents: 11397
diff changeset
846 uin_t uin;
bc374facaeb2 [gaim-migrate @ 13647]
Bartoz Oler <bartosz@pidgin.im>
parents: 11397
diff changeset
847
bc374facaeb2 [gaim-migrate @ 13647]
Bartoz Oler <bartosz@pidgin.im>
parents: 11397
diff changeset
848 buddy = (GaimBuddy *)node;
bc374facaeb2 [gaim-migrate @ 13647]
Bartoz Oler <bartosz@pidgin.im>
parents: 11397
diff changeset
849 gc = gaim_account_get_connection(gaim_buddy_get_account(buddy));
bc374facaeb2 [gaim-migrate @ 13647]
Bartoz Oler <bartosz@pidgin.im>
parents: 11397
diff changeset
850 info = gc->proto_data;
bc374facaeb2 [gaim-migrate @ 13647]
Bartoz Oler <bartosz@pidgin.im>
parents: 11397
diff changeset
851
bc374facaeb2 [gaim-migrate @ 13647]
Bartoz Oler <bartosz@pidgin.im>
parents: 11397
diff changeset
852 uin = ggp_str_to_uin(gaim_buddy_get_name(buddy));
bc374facaeb2 [gaim-migrate @ 13647]
Bartoz Oler <bartosz@pidgin.im>
parents: 11397
diff changeset
853
bc374facaeb2 [gaim-migrate @ 13647]
Bartoz Oler <bartosz@pidgin.im>
parents: 11397
diff changeset
854 if (gaim_blist_node_get_bool(node, "blocked")) {
bc374facaeb2 [gaim-migrate @ 13647]
Bartoz Oler <bartosz@pidgin.im>
parents: 11397
diff changeset
855 gaim_blist_node_set_bool(node, "blocked", FALSE);
bc374facaeb2 [gaim-migrate @ 13647]
Bartoz Oler <bartosz@pidgin.im>
parents: 11397
diff changeset
856 gg_remove_notify_ex(info->session, uin, GG_USER_BLOCKED);
bc374facaeb2 [gaim-migrate @ 13647]
Bartoz Oler <bartosz@pidgin.im>
parents: 11397
diff changeset
857 gg_add_notify_ex(info->session, uin, GG_USER_NORMAL);
bc374facaeb2 [gaim-migrate @ 13647]
Bartoz Oler <bartosz@pidgin.im>
parents: 11397
diff changeset
858 gaim_debug_info("gg", "send: uin=%d; mode=NORMAL\n", uin);
bc374facaeb2 [gaim-migrate @ 13647]
Bartoz Oler <bartosz@pidgin.im>
parents: 11397
diff changeset
859 } else {
bc374facaeb2 [gaim-migrate @ 13647]
Bartoz Oler <bartosz@pidgin.im>
parents: 11397
diff changeset
860 gaim_blist_node_set_bool(node, "blocked", TRUE);
bc374facaeb2 [gaim-migrate @ 13647]
Bartoz Oler <bartosz@pidgin.im>
parents: 11397
diff changeset
861 gg_remove_notify_ex(info->session, uin, GG_USER_NORMAL);
bc374facaeb2 [gaim-migrate @ 13647]
Bartoz Oler <bartosz@pidgin.im>
parents: 11397
diff changeset
862 gg_add_notify_ex(info->session, uin, GG_USER_BLOCKED);
bc374facaeb2 [gaim-migrate @ 13647]
Bartoz Oler <bartosz@pidgin.im>
parents: 11397
diff changeset
863 gaim_debug_info("gg", "send: uin=%d; mode=BLOCKED\n", uin);
bc374facaeb2 [gaim-migrate @ 13647]
Bartoz Oler <bartosz@pidgin.im>
parents: 11397
diff changeset
864 }
bc374facaeb2 [gaim-migrate @ 13647]
Bartoz Oler <bartosz@pidgin.im>
parents: 11397
diff changeset
865 }
bc374facaeb2 [gaim-migrate @ 13647]
Bartoz Oler <bartosz@pidgin.im>
parents: 11397
diff changeset
866 /* }}} */
bc374facaeb2 [gaim-migrate @ 13647]
Bartoz Oler <bartosz@pidgin.im>
parents: 11397
diff changeset
867
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
868 /* ---------------------------------------------------------------------- */
11414
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
869 /* ----- INTERNAL CALLBACKS --------------------------------------------- */
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
870 /* ---------------------------------------------------------------------- */
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
871
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
872 /**
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
873 * Handle change of the status of the buddy.
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
874 *
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
875 * @param gc GaimConnection
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
876 * @param uin UIN of the buddy.
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
877 * @param status ID of the status.
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
878 * @param descr Description.
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
879 */
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
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
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
883 {
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
884 gchar *from;
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
885 const char *st;
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
886 gchar *msg;
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
887
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
888 from = g_strdup_printf("%ld", (unsigned long int)uin);
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
889 switch (status) {
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
890 case GG_STATUS_NOT_AVAIL:
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
891 case GG_STATUS_NOT_AVAIL_DESCR:
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
892 st = "offline";
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
893 break;
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
894 case GG_STATUS_AVAIL:
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
895 case GG_STATUS_AVAIL_DESCR:
11638
3a05b53a589e [gaim-migrate @ 13914]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11565
diff changeset
896 st = "available";
11414
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
897 break;
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
898 case GG_STATUS_BUSY:
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
899 case GG_STATUS_BUSY_DESCR:
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
900 st = "away";
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
901 break;
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
902 case GG_STATUS_BLOCKED:
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
903 /* user is blocking us.... */
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
904 st = "blocked";
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
905 break;
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
906 default:
11638
3a05b53a589e [gaim-migrate @ 13914]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11565
diff changeset
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
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
910 break;
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
911 }
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
912
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
913 gaim_debug_info("gg", "st = %s\n", st);
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
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
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
917 g_free(from);
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
918 g_free(msg);
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
919 }
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
920 /* }}} */
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
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
12257
ca27de274225 [gaim-migrate @ 14559]
Richard Laager <rlaager@wiktel.com>
parents: 12220
diff changeset
974 if (results == NULL) {
ca27de274225 [gaim-migrate @ 14559]
Richard Laager <rlaager@wiktel.com>
parents: 12220
diff changeset
975 gaim_debug_error("gg", "ggp_pubdir_reply_handler: "
ca27de274225 [gaim-migrate @ 14559]
Richard Laager <rlaager@wiktel.com>
parents: 12220
diff changeset
976 "Unable to display the search results.\n");
ca27de274225 [gaim-migrate @ 14559]
Richard Laager <rlaager@wiktel.com>
parents: 12220
diff changeset
977 gaim_notify_error(gc, NULL,
ca27de274225 [gaim-migrate @ 14559]
Richard Laager <rlaager@wiktel.com>
parents: 12220
diff changeset
978 _("Unable to display the search results."),
ca27de274225 [gaim-migrate @ 14559]
Richard Laager <rlaager@wiktel.com>
parents: 12220
diff changeset
979 NULL);
ca27de274225 [gaim-migrate @ 14559]
Richard Laager <rlaager@wiktel.com>
parents: 12220
diff changeset
980 ggp_sr_close_cb(gaim_connection_get_account(gc));
ca27de274225 [gaim-migrate @ 14559]
Richard Laager <rlaager@wiktel.com>
parents: 12220
diff changeset
981 return;
ca27de274225 [gaim-migrate @ 14559]
Richard Laager <rlaager@wiktel.com>
parents: 12220
diff changeset
982 }
ca27de274225 [gaim-migrate @ 14559]
Richard Laager <rlaager@wiktel.com>
parents: 12220
diff changeset
983
12220
64254fbabc7b [gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents: 12216
diff changeset
984 column = gaim_notify_searchresults_column_new(_("UIN"));
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
985 gaim_notify_searchresults_column_add(results, column);
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
986
12220
64254fbabc7b [gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents: 12216
diff changeset
987 column = gaim_notify_searchresults_column_new(_("First name"));
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
988 gaim_notify_searchresults_column_add(results, column);
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
989
12220
64254fbabc7b [gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents: 12216
diff changeset
990 column = gaim_notify_searchresults_column_new(_("Nick name"));
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
991 gaim_notify_searchresults_column_add(results, column);
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
992
12220
64254fbabc7b [gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents: 12216
diff changeset
993 column = gaim_notify_searchresults_column_new(_("City"));
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
994 gaim_notify_searchresults_column_add(results, column);
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
995
12220
64254fbabc7b [gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents: 12216
diff changeset
996 column = gaim_notify_searchresults_column_new(_("Birth year"));
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
997 gaim_notify_searchresults_column_add(results, column);
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
998
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
999 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
1000
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1001 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
1002 gaim_debug_info("gg", "start = %d\n", start);
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1003
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1004 for (i = 0; i < res_count; i++) {
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1005 GList *row = NULL;
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1006 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
1007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1008 /* TODO: Status will be displayed as an icon. */
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1009 /* 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
1010 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
1011 GG_PUBDIR50_UIN));
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1012 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
1013 GG_PUBDIR50_FIRSTNAME));
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1014 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
1015 GG_PUBDIR50_NICKNAME));
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1016 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
1017 GG_PUBDIR50_CITY));
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1018 row = g_list_append(row,
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1019 (birth && strncmp(birth, "0", 1)) ? birth : g_strdup("-"));
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1020
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1021 gaim_notify_searchresults_row_add(results, row);
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1022
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1023 if (i == res_count - 1) {
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1024 g_free(info->search_form->last_uin);
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1025 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
1026 GG_PUBDIR50_UIN);
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1027 }
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1028 }
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1029
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1030 gaim_notify_searchresults_button_add(results, GAIM_NOTIFY_BUTTON_CONTINUE,
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1031 ggp_callback_show_next);
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1032 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
1033 ggp_callback_add_buddy);
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1034 if (info->searchresults_window == NULL) {
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1035 void *h = gaim_notify_searchresults(gc,
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1036 _("Gadu-Gadu Public Directory"),
12220
64254fbabc7b [gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents: 12216
diff changeset
1037 _("Search results"), NULL, results,
12257
ca27de274225 [gaim-migrate @ 14559]
Richard Laager <rlaager@wiktel.com>
parents: 12220
diff changeset
1038 (GaimNotifyCloseCallback)ggp_sr_close_cb,
12220
64254fbabc7b [gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents: 12216
diff changeset
1039 gaim_connection_get_account(gc));
12257
ca27de274225 [gaim-migrate @ 14559]
Richard Laager <rlaager@wiktel.com>
parents: 12220
diff changeset
1040
12277
739e3aca067a [gaim-migrate @ 14581]
Richard Laager <rlaager@wiktel.com>
parents: 12258
diff changeset
1041 if (h == NULL) {
739e3aca067a [gaim-migrate @ 14581]
Richard Laager <rlaager@wiktel.com>
parents: 12258
diff changeset
1042 gaim_debug_error("gg", "ggp_pubdir_reply_handler: "
739e3aca067a [gaim-migrate @ 14581]
Richard Laager <rlaager@wiktel.com>
parents: 12258
diff changeset
1043 "Unable to display the search results.\n");
739e3aca067a [gaim-migrate @ 14581]
Richard Laager <rlaager@wiktel.com>
parents: 12258
diff changeset
1044 gaim_notify_error(gc, NULL,
739e3aca067a [gaim-migrate @ 14581]
Richard Laager <rlaager@wiktel.com>
parents: 12258
diff changeset
1045 _("Unable to display the search results."),
739e3aca067a [gaim-migrate @ 14581]
Richard Laager <rlaager@wiktel.com>
parents: 12258
diff changeset
1046 NULL);
739e3aca067a [gaim-migrate @ 14581]
Richard Laager <rlaager@wiktel.com>
parents: 12258
diff changeset
1047 ggp_sr_close_cb(gaim_connection_get_account(gc));
739e3aca067a [gaim-migrate @ 14581]
Richard Laager <rlaager@wiktel.com>
parents: 12258
diff changeset
1048 return;
739e3aca067a [gaim-migrate @ 14581]
Richard Laager <rlaager@wiktel.com>
parents: 12258
diff changeset
1049 }
739e3aca067a [gaim-migrate @ 14581]
Richard Laager <rlaager@wiktel.com>
parents: 12258
diff changeset
1050
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1051 info->searchresults_window = h;
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1052 } else {
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1053 gaim_notify_searchresults_new_rows(gc, results,
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1054 info->searchresults_window, NULL);
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1055 }
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1056 }
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1057 /* }}} */
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1058
11414
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1059 /**
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1060 * Dispatch a message received from a buddy.
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1061 *
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1062 * @param gc GaimConnection.
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1063 * @param ev Gadu-Gadu event structure.
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1064 */
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1065 /* static void ggp_recv_message_handler(GaimConnection *gc, const struct gg_event *ev) {{{ */
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1066 static void ggp_recv_message_handler(GaimConnection *gc, const struct gg_event *ev)
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1067 {
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1068 GGPInfo *info = gc->proto_data;
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1069 GaimConversation *conv;
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1070 gchar *from;
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1071 gchar *msg;
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1072 gchar *tmp;
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1073 const char *chat_name;
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1074 int chat_id;
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1075
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1076 from = g_strdup_printf("%lu", (unsigned long int)ev->event.msg.sender);
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1077
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1078 msg = charset_convert((const char *)ev->event.msg.message,
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1079 "CP1250", "UTF-8");
11920
52f27ffe68a5 [gaim-migrate @ 14211]
Mark Doliner <mark@kingant.net>
parents: 11909
diff changeset
1080 gaim_str_strip_char(msg, '\r');
11414
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1081 tmp = g_markup_escape_text(msg, -1);
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1082
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1083 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
1084 from, tmp, ev->event.msg.msgclass,
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1085 ev->event.msg.recipients_count);
11414
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1086
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1087 if (ev->event.msg.recipients_count == 0) {
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1088 serv_got_im(gc, from, tmp, 0, ev->event.msg.time);
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1089 } else {
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1090 chat_name = ggp_confer_find_by_participants(gc,
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1091 ev->event.msg.recipients,
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1092 ev->event.msg.recipients_count);
11414
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1093 if (chat_name == NULL) {
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1094 chat_name = ggp_confer_add_new(gc, NULL);
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1095 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
1096
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1097 ggp_confer_participants_add_uin(gc, chat_name,
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1098 ev->event.msg.sender);
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1099
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1100 ggp_confer_participants_add(gc, chat_name,
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1101 ev->event.msg.recipients,
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1102 ev->event.msg.recipients_count);
11414
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1103 }
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1104 conv = ggp_confer_find_by_name(gc, chat_name);
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1105 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
1106 serv_got_chat_in(gc, chat_id,
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1107 ggp_buddy_get_name(gc, ev->event.msg.sender),
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1108 0, msg, ev->event.msg.time);
11414
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1109 }
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1110 g_free(msg);
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1111 g_free(tmp);
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1112 g_free(from);
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1113 }
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1114 /* }}} */
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1115
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1116 /*
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1117 */
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1118 /* static void ggp_callback_recv(gpointer _gc, gint fd, GaimInputCondition cond) {{{ */
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1119 static void ggp_callback_recv(gpointer _gc, gint fd, GaimInputCondition cond)
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1120 {
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1121 GaimConnection *gc = _gc;
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1122 GGPInfo *info = gc->proto_data;
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1123 struct gg_event *ev;
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1124 int i;
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1125
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1126 if (!(ev = gg_watch_fd(info->session))) {
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1127 gaim_debug_error("gg",
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1128 "ggp_callback_recv: gg_watch_fd failed -- CRITICAL!\n");
11414
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1129 gaim_connection_error(gc, _("Unable to read socket"));
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1130 return;
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1131 }
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1132
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1133 switch (ev->type) {
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1134 case GG_EVENT_NONE:
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1135 /* Nothing happened. */
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1136 break;
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1137 case GG_EVENT_MSG:
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1138 ggp_recv_message_handler(gc, ev);
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1139 break;
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1140 case GG_EVENT_ACK:
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1141 gaim_debug_info("gg",
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1142 "message sent to: %ld, delivery status=%d, seq=%d\n",
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1143 ev->event.ack.recipient, ev->event.ack.status,
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1144 ev->event.ack.seq);
11414
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1145 break;
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1146 case GG_EVENT_NOTIFY:
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1147 case GG_EVENT_NOTIFY_DESCR:
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1148 {
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1149 struct gg_notify_reply *n;
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1150 char *descr;
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1151
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1152 gaim_debug_info("gg", "notify_pre: (%d) status: %d\n",
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1153 ev->event.notify->uin,
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1154 ev->event.notify->status);
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1155
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1156 n = (ev->type == GG_EVENT_NOTIFY) ? ev->event.notify
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1157 : ev->event.notify_descr.notify;
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1158
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1159 for (; n->uin; n++) {
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1160 descr = (ev->type == GG_EVENT_NOTIFY) ? NULL
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1161 : ev->event.notify_descr.descr;
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1162
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1163 gaim_debug_info("gg",
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1164 "notify: (%d) status: %d; descr: %s\n",
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1165 n->uin, n->status, descr);
11414
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1166
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1167 ggp_generic_status_handler(gc,
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1168 n->uin, n->status, descr);
11414
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1169 }
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1170 }
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1171 break;
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1172 case GG_EVENT_NOTIFY60:
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1173 gaim_debug_info("gg",
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1174 "notify60_pre: (%d) status=%d; version=%d; descr=%s\n",
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1175 ev->event.notify60->uin, ev->event.notify60->status,
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1176 ev->event.notify60->version, ev->event.notify60->descr);
11414
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1177
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1178 for (i = 0; ev->event.notify60[i].uin; i++) {
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 "notify60: (%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.notify60[i].uin,
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1182 ev->event.notify60[i].status,
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1183 ev->event.notify60[i].version,
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1184 ev->event.notify60[i].descr);
11414
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1185
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1186 ggp_generic_status_handler(gc, ev->event.notify60[i].uin,
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1187 ev->event.notify60[i].status,
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1188 ev->event.notify60[i].descr);
11414
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1189 }
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1190 break;
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1191 case GG_EVENT_STATUS:
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1192 gaim_debug_info("gg", "status: (%d) status=%d; descr=%s\n",
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1193 ev->event.status.uin, ev->event.status.status,
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1194 ev->event.status.descr);
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1195
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1196 ggp_generic_status_handler(gc, ev->event.status.uin,
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1197 ev->event.status.status, ev->event.status.descr);
11414
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1198 break;
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1199 case GG_EVENT_STATUS60:
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1200 gaim_debug_info("gg",
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1201 "status60: (%d) status=%d; version=%d; descr=%s\n",
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1202 ev->event.status60.uin, ev->event.status60.status,
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1203 ev->event.status60.version, ev->event.status60.descr);
11414
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1204
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1205 ggp_generic_status_handler(gc, ev->event.status60.uin,
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1206 ev->event.status60.status, ev->event.status60.descr);
11414
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1207 break;
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1208 case GG_EVENT_USERLIST:
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1209 if (ev->event.userlist.type == GG_USERLIST_GET_REPLY) {
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1210 gaim_debug_info("gg", "GG_USERLIST_GET_REPLY\n");
12220
64254fbabc7b [gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents: 12216
diff changeset
1211 gaim_notify_info(gc, NULL,
64254fbabc7b [gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents: 12216
diff changeset
1212 _("Buddy list downloaded"),
64254fbabc7b [gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents: 12216
diff changeset
1213 _("Your buddy list was downloaded from the server."));
11414
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1214 if (ev->event.userlist.reply != NULL) {
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1215 ggp_buddylist_load(gc, ev->event.userlist.reply);
11414
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1216 }
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1217 } else {
12220
64254fbabc7b [gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents: 12216
diff changeset
1218 gaim_debug_info("gg", "GG_USERLIST_PUT_REPLY\n");
64254fbabc7b [gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents: 12216
diff changeset
1219 gaim_notify_info(gc, NULL,
64254fbabc7b [gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents: 12216
diff changeset
1220 _("Buddy list uploaded"),
64254fbabc7b [gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents: 12216
diff changeset
1221 _("Your buddy list was stored on the server."));
11414
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1222 }
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1223 break;
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1224 case GG_EVENT_PUBDIR50_SEARCH_REPLY:
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1225 ggp_pubdir_reply_handler(gc, ev->event.pubdir50);
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1226 break;
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1227 default:
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1228 gaim_debug_error("gg",
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1229 "unsupported event type=%d\n", ev->type);
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1230 break;
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1231 }
11414
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1232
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1233 gg_free_event(ev);
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1234 }
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1235 /* }}} */
11414
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1236
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1237 /*
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1238 */
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1239 /* 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
1240 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
1241 {
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1242 GaimConnection *gc = _gc;
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1243 GGPInfo *info = gc->proto_data;
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1244 struct gg_event *ev;
11414
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1245
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1246 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
1247 info->session->check, info->session->state);
11414
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1248
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1249 switch (info->session->state) {
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1250 case GG_STATE_RESOLVING:
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1251 gaim_debug_info("gg", "GG_STATE_RESOLVING\n");
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1252 break;
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1253 case GG_STATE_CONNECTING_HUB:
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1254 gaim_debug_info("gg", "GG_STATE_CONNECTING_HUB\n");
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1255 break;
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1256 case GG_STATE_READING_DATA:
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1257 gaim_debug_info("gg", "GG_STATE_READING_DATA\n");
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1258 break;
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1259 case GG_STATE_CONNECTING_GG:
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1260 gaim_debug_info("gg", "GG_STATE_CONNECTING_GG\n");
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1261 break;
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1262 case GG_STATE_READING_KEY:
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1263 gaim_debug_info("gg", "GG_STATE_READING_KEY\n");
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1264 break;
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1265 case GG_STATE_READING_REPLY:
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1266 gaim_debug_info("gg", "GG_STATE_READING_REPLY\n");
11414
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1267 break;
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1268 default:
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1269 gaim_debug_error("gg", "unknown state = %d\n",
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1270 info->session->state);
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1271 break;
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1272 }
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1273
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1274 if (!(ev = gg_watch_fd(info->session))) {
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1275 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
1276 gaim_connection_error(gc, _("Unable to read socket"));
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1277 return;
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1278 }
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1279 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
1280 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
1281 info->session->check, info->session->state);
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1282
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1283 gaim_input_remove(gc->inpa);
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1284
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1285 /** 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
1286 gc->inpa = gaim_input_add(info->session->fd,
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1287 (info->session->check == 1) ? GAIM_INPUT_WRITE
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1288 : GAIM_INPUT_READ,
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1289 ggp_async_login_handler, gc);
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1290
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1291 switch (ev->type) {
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1292 case GG_EVENT_NONE:
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1293 /* Nothing happened. */
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1294 gaim_debug_info("gg", "GG_EVENT_NONE\n");
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1295 break;
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1296 case GG_EVENT_CONN_SUCCESS:
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1297 gaim_debug_info("gg", "GG_EVENT_CONN_SUCCESS\n");
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1298 gaim_input_remove(gc->inpa);
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1299 gc->inpa = gaim_input_add(info->session->fd,
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1300 GAIM_INPUT_READ,
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1301 ggp_callback_recv, gc);
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1302
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1303 /* gg_change_status(info->session, GG_STATUS_AVAIL); */
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1304 gaim_connection_set_state(gc, GAIM_CONNECTED);
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1305 ggp_buddylist_send(gc);
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1306 break;
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1307 case GG_EVENT_CONN_FAILED:
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1308 gaim_input_remove(gc->inpa);
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1309 gc->inpa = 0;
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1310 gaim_connection_error(gc, _("Connection failed."));
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1311 break;
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1312 default:
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1313 gaim_debug_error("gg", "strange event: %d\n", ev->type);
11414
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1314 break;
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1315 }
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1316
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1317 gg_free_event(ev);
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1318 }
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1319 /* }}} */
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1320
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1321 /* ---------------------------------------------------------------------- */
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1322 /* ----- GaimPluginProtocolInfo ----------------------------------------- */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1323 /* ---------------------------------------------------------------------- */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1324
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1325 /* static const char *ggp_list_icon(GaimAccount *account, GaimBuddy *buddy) {{{ */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1326 static const char *ggp_list_icon(GaimAccount *account, GaimBuddy *buddy)
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1327 {
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1328 return "gadu-gadu";
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1329 }
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1330 /* }}} */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1331
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1332 /* 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
1333 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
1334 const char **nw, const char **ne)
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1335 {
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1336 GaimPresence *presence = gaim_buddy_get_presence(b);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1337
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1338 /*
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1339 * Note to myself:
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1340 * The only valid status types are those defined
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1341 * in prpl_info->status_types.
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1342 *
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1343 * Usable icons: away, blocked, dnd, extendedaway,
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1344 * freeforchat, ignored, invisible, na, offline.
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1345 */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1346
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1347 if (!GAIM_BUDDY_IS_ONLINE(b)) {
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1348 *se = "offline";
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1349 } else if (gaim_presence_is_status_active(presence, "away")) {
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1350 *se = "away";
11638
3a05b53a589e [gaim-migrate @ 13914]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11565
diff changeset
1351 } else if (gaim_presence_is_status_active(presence, "available")) {
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1352 *se = "online";
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1353 } else if (gaim_presence_is_status_active(presence, "offline")) {
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1354 *se = "offline";
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1355 } else if (gaim_presence_is_status_active(presence, "blocked")) {
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1356 *se = "blocked";
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1357 } else {
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1358 *se = "offline";
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1359 gaim_debug_info("gg", "ggp_list_emblems: unknown status\n");
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1360 }
2393
a7ecfd3f7714 [gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1361 }
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1362 /* }}} */
2393
a7ecfd3f7714 [gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1363
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1364 /* static char *ggp_status_text(GaimBuddy *b) {{{ */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1365 static char *ggp_status_text(GaimBuddy *b)
2846
4b3f17ca66bf [gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2835
diff changeset
1366 {
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1367 GaimStatus *status;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1368 const char *msg;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1369 char *text;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1370 char *tmp;
2846
4b3f17ca66bf [gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2835
diff changeset
1371
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1372 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
1373
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1374 msg = gaim_status_get_attr_string(status, "message");
2846
4b3f17ca66bf [gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2835
diff changeset
1375
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1376 if (msg != NULL) {
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1377 tmp = gaim_markup_strip_html(msg);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1378 text = g_markup_escape_text(tmp, -1);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1379 g_free(tmp);
2846
4b3f17ca66bf [gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2835
diff changeset
1380
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1381 return text;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1382 } else {
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1383 tmp = g_strdup(gaim_status_get_name(status));
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1384 text = g_markup_escape_text(tmp, -1);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1385 g_free(tmp);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1386
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1387 return text;
8997
8bf2c6122bf1 [gaim-migrate @ 9772]
Luke Schierer <lschiere@pidgin.im>
parents: 8996
diff changeset
1388 }
2846
4b3f17ca66bf [gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2835
diff changeset
1389 }
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1390 /* }}} */
2846
4b3f17ca66bf [gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2835
diff changeset
1391
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1392 /* static char *ggp_tooltip_text(GaimBuddy *b) {{{ */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1393 static char *ggp_tooltip_text(GaimBuddy *b)
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1394 {
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1395 GaimStatus *status;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1396 char *text;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1397 gchar *ret;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1398 const char *msg, *name;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1399
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1400 status = gaim_presence_get_active_status(gaim_buddy_get_presence(b));
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1401 msg = gaim_status_get_attr_string(status, "message");
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1402 name = gaim_status_get_name(status);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1403
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1404 if (msg != NULL) {
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1405 char *tmp = gaim_markup_strip_html(msg);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1406 text = g_markup_escape_text(tmp, -1);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1407 g_free(tmp);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1408
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1409 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
1410 _("Status"), name, text);
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1411
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1412 g_free(text);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1413 } else {
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1414 ret = g_strdup_printf("\n<b>%s:</b> %s",
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1415 _("Status"), name);
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1416 }
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1417
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1418 return ret;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1419 }
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1420 /* }}} */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1421
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1422 /* static GList *ggp_status_types(GaimAccount *account) {{{ */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1423 static GList *ggp_status_types(GaimAccount *account)
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1424 {
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1425 GaimStatusType *type;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1426 GList *types = NULL;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1427
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1428 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
1429 _("Offline"), TRUE, TRUE, FALSE, "message", _("Message"),
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1430 gaim_value_new(GAIM_TYPE_STRING), NULL);
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1431 types = g_list_append(types, type);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1432
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1433 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
1434 _("Online"), TRUE, TRUE, FALSE, "message", _("Message"),
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1435 gaim_value_new(GAIM_TYPE_STRING), NULL);
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1436 types = g_list_append(types, type);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1437
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1438 /*
11638
3a05b53a589e [gaim-migrate @ 13914]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11565
diff changeset
1439 * Without this selecting Invisible as own status doesn't
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1440 * work. It's not used and not needed to show status of buddies.
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1441 */
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1442 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
1443 _("Invisible"), TRUE, TRUE, FALSE, "message", _("Message"),
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1444 gaim_value_new(GAIM_TYPE_STRING), NULL);
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1445 types = g_list_append(types, type);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1446
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1447 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
1448 _("Busy"), TRUE, TRUE, FALSE, "message", _("Message"),
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1449 gaim_value_new(GAIM_TYPE_STRING), NULL);
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1450 types = g_list_append(types, type);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1451
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1452 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
1453 _("Blocked"), TRUE, TRUE, FALSE, "message", _("Message"),
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1454 gaim_value_new(GAIM_TYPE_STRING), NULL);
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1455 types = g_list_append(types, type);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1456
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1457 return types;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1458 }
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1459 /* }}} */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1460
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1461 /* static GList *ggp_blist_node_menu(GaimBlistNode *node) {{{ */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1462 static GList *ggp_blist_node_menu(GaimBlistNode *node)
2393
a7ecfd3f7714 [gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1463 {
11394
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1464 GaimBlistNodeAction *act;
2393
a7ecfd3f7714 [gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1465 GList *m = NULL;
4333
cc2f780c0505 [gaim-migrate @ 4597]
Mark Doliner <mark@kingant.net>
parents: 4229
diff changeset
1466
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1467 if (!GAIM_BLIST_NODE_IS_BUDDY(node))
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1468 return NULL;
4333
cc2f780c0505 [gaim-migrate @ 4597]
Mark Doliner <mark@kingant.net>
parents: 4229
diff changeset
1469
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1470 act = gaim_blist_node_action_new(_("Add to chat"),
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1471 ggp_bmenu_add_to_chat, NULL, NULL);
11410
bc374facaeb2 [gaim-migrate @ 13647]
Bartoz Oler <bartosz@pidgin.im>
parents: 11397
diff changeset
1472 m = g_list_append(m, act);
bc374facaeb2 [gaim-migrate @ 13647]
Bartoz Oler <bartosz@pidgin.im>
parents: 11397
diff changeset
1473
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1474 if (gaim_blist_node_get_bool(node, "blocked")) {
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1475 act = gaim_blist_node_action_new(_("Unblock"),
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1476 ggp_bmenu_block, NULL, NULL);
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1477 } else {
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1478 act = gaim_blist_node_action_new(_("Block"),
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1479 ggp_bmenu_block, NULL, NULL);
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1480 }
11394
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1481 m = g_list_append(m, act);
2393
a7ecfd3f7714 [gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1482
a7ecfd3f7714 [gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1483 return m;
a7ecfd3f7714 [gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1484 }
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1485 /* }}} */
2393
a7ecfd3f7714 [gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1486
11394
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1487 /* static GList *ggp_chat_info(GaimConnection *gc) {{{ */
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1488 static GList *ggp_chat_info(GaimConnection *gc)
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1489 {
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1490 GList *m = NULL;
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1491 struct proto_chat_entry *pce;
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1492
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1493 pce = g_new0(struct proto_chat_entry, 1);
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1494 pce->label = _("Chat _name:");
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1495 pce->identifier = "name";
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1496 pce->required = TRUE;
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1497 m = g_list_append(m, pce);
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1498
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1499 return m;
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1500 }
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1501 /* }}} */
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1502
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1503 /* static void ggp_login(GaimAccount *account) {{{ */
11837
fa742ad8068c [gaim-migrate @ 14128]
Mark Doliner <mark@kingant.net>
parents: 11718
diff changeset
1504 static void ggp_login(GaimAccount *account)
2393
a7ecfd3f7714 [gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1505 {
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1506 GaimConnection *gc = gaim_account_get_connection(account);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1507 struct gg_login_params *glp = g_new0(struct gg_login_params, 1);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1508 GGPInfo *info = g_new0(GGPInfo, 1);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1509
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1510 /* Probably this should be moved to *_new() function. */
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1511 info->session = NULL;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1512 info->searchresults_window = NULL;
11394
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1513 info->chats = NULL;
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1514 info->chats_count = 0;
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1515 info->token = NULL;
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1516
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1517 gc->proto_data = info;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1518
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1519 glp->uin = ggp_get_uin(account);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1520 glp->password = (char *)gaim_account_get_password(account);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1521
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1522 glp->async = 1;
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1523 glp->status = GG_STATUS_AVAIL;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1524 glp->tls = 0;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1525
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1526 info->session = gg_login(glp);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1527 if (info->session == NULL) {
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1528 gaim_connection_error(gc, _("Connection failed."));
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1529 g_free(glp);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1530 return;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1531 }
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1532 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
1533 ggp_async_login_handler, gc);
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1534 }
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1535 /* }}} */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1536
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1537 /* static void ggp_close(GaimConnection *gc) {{{ */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1538 static void ggp_close(GaimConnection *gc)
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1539 {
8997
8bf2c6122bf1 [gaim-migrate @ 9772]
Luke Schierer <lschiere@pidgin.im>
parents: 8996
diff changeset
1540
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1541 if (gc == NULL) {
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1542 gaim_debug_info("gg", "gc == NULL\n");
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1543 return;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1544 }
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1545
11538
5c6c2e893803 [gaim-migrate @ 13792]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11522
diff changeset
1546 if (gc->proto_data) {
5c6c2e893803 [gaim-migrate @ 13792]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11522
diff changeset
1547 GGPInfo *info = gc->proto_data;
5c6c2e893803 [gaim-migrate @ 13792]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11522
diff changeset
1548 /* XXX: Any way to pass description here? */
5c6c2e893803 [gaim-migrate @ 13792]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11522
diff changeset
1549 if (info->session != NULL) {
5c6c2e893803 [gaim-migrate @ 13792]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11522
diff changeset
1550 gg_change_status(info->session, GG_STATUS_NOT_AVAIL);
5c6c2e893803 [gaim-migrate @ 13792]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11522
diff changeset
1551 gg_logoff(info->session);
5c6c2e893803 [gaim-migrate @ 13792]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11522
diff changeset
1552 gg_free_session(info->session);
5c6c2e893803 [gaim-migrate @ 13792]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11522
diff changeset
1553 }
11545
85abf1deac05 [gaim-migrate @ 13800]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11544
diff changeset
1554 g_free(info);
85abf1deac05 [gaim-migrate @ 13800]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11544
diff changeset
1555 gc->proto_data = NULL;
11538
5c6c2e893803 [gaim-migrate @ 13792]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11522
diff changeset
1556 }
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1557
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1558 if (gc->inpa > 0)
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1559 gaim_input_remove(gc->inpa);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1560
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1561 ggp_buddylist_offline(gc);
2393
a7ecfd3f7714 [gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1562
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1563 gaim_debug_info("gg", "Connection closed.\n");
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1564 }
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1565 /* }}} */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1566
12216
4d3119205a33 [gaim-migrate @ 14518]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12143
diff changeset
1567 /* 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
1568 static int ggp_send_im(GaimConnection *gc, const char *who, const char *msg,
12216
4d3119205a33 [gaim-migrate @ 14518]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12143
diff changeset
1569 GaimMessageFlags flags)
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1570 {
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1571 GGPInfo *info = gc->proto_data;
12216
4d3119205a33 [gaim-migrate @ 14518]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12143
diff changeset
1572 char *tmp, *plain;
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1573
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1574 if (strlen(msg) == 0)
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1575 return 1;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1576
12216
4d3119205a33 [gaim-migrate @ 14518]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12143
diff changeset
1577 plain = gaim_unescape_html(msg);
11565
2aa7d8dd61d7 [gaim-migrate @ 13831]
Bartoz Oler <bartosz@pidgin.im>
parents: 11545
diff changeset
1578 gaim_debug_info("gg", "ggp_send_im: msg = %s\n", msg);
12216
4d3119205a33 [gaim-migrate @ 14518]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12143
diff changeset
1579 tmp = charset_convert(plain, "UTF-8", "CP1250");
4d3119205a33 [gaim-migrate @ 14518]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12143
diff changeset
1580 g_free(plain);
2393
a7ecfd3f7714 [gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1581
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1582 if (tmp != NULL && strlen(tmp) > 0) {
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1583 if (gg_send_message(info->session, GG_CLASS_CHAT,
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1584 ggp_str_to_uin(who), (unsigned char *)tmp) < 0) {
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1585 return -1;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1586 }
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1587 }
11565
2aa7d8dd61d7 [gaim-migrate @ 13831]
Bartoz Oler <bartosz@pidgin.im>
parents: 11545
diff changeset
1588 g_free(tmp);
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1589
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1590 return 1;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1591 }
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1592 /* }}} */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1593
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1594 /* static void ggp_get_info(GaimConnection *gc, const char *name) { {{{ */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1595 static void ggp_get_info(GaimConnection *gc, const char *name)
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1596 {
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1597 GGPInfo *info = gc->proto_data;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1598 GGPSearchForm *form;
2393
a7ecfd3f7714 [gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1599
12220
64254fbabc7b [gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents: 12216
diff changeset
1600 if (info->search_form != NULL) {
64254fbabc7b [gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents: 12216
diff changeset
1601 gaim_notify_error(gc, NULL,
64254fbabc7b [gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents: 12216
diff changeset
1602 _("Unable to initiate a new search"),
64254fbabc7b [gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents: 12216
diff changeset
1603 _("You have a pending search. Please wait for it to finish."));
64254fbabc7b [gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents: 12216
diff changeset
1604 return;
64254fbabc7b [gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents: 12216
diff changeset
1605 }
64254fbabc7b [gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents: 12216
diff changeset
1606
11414
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1607 form = ggp_search_form_new();
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1608 info->search_form = form;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1609
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1610 form->uin = g_strdup(name);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1611 form->offset = g_strdup("0");
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1612 form->last_uin = g_strdup("0");
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1613
11414
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1614 ggp_search_start(gc, form);
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1615 }
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1616 /* }}} */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1617
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1618 /* static void ggp_set_status(GaimAccount *account, GaimStatus *status) {{{ */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1619 static void ggp_set_status(GaimAccount *account, GaimStatus *status)
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1620 {
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1621 GaimStatusPrimitive prim;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1622 GaimConnection *gc;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1623 GGPInfo *info;
11397
d530188f04b8 [gaim-migrate @ 13629]
Mark Doliner <mark@kingant.net>
parents: 11394
diff changeset
1624 const char *status_id, *msg;
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1625 int new_status, new_status_descr;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1626
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1627 prim = gaim_status_type_get_primitive(gaim_status_get_type(status));
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1628
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1629 if (!gaim_status_is_active(status))
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1630 return;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1631
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1632 gc = gaim_account_get_connection(account);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1633 info = gc->proto_data;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1634
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1635 status_id = gaim_status_get_id(status);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1636
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1637 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
1638 status_id);
2393
a7ecfd3f7714 [gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1639
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1640 if (strcmp(status_id, "available") == 0) {
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1641 new_status = GG_STATUS_AVAIL;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1642 new_status_descr = GG_STATUS_AVAIL_DESCR;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1643 } else if (strcmp(status_id, "away") == 0) {
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1644 new_status = GG_STATUS_BUSY;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1645 new_status_descr = GG_STATUS_BUSY_DESCR;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1646 } else if (strcmp(status_id, "invisible") == 0) {
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1647 new_status = GG_STATUS_INVISIBLE;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1648 new_status_descr = GG_STATUS_INVISIBLE_DESCR;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1649 } else {
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1650 new_status = GG_STATUS_AVAIL;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1651 new_status_descr = GG_STATUS_AVAIL_DESCR;
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1652 gaim_debug_info("gg",
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1653 "ggp_set_status: uknown status requested (status_id=%s)\n",
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1654 status_id);
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1655 }
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4793
diff changeset
1656
11397
d530188f04b8 [gaim-migrate @ 13629]
Mark Doliner <mark@kingant.net>
parents: 11394
diff changeset
1657 msg = gaim_status_get_attr_string(status, "message");
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1658
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1659 if (msg == NULL) {
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1660 gaim_debug_info("gg", "ggp_set_status: msg == NULL\n");
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1661 gg_change_status(info->session, new_status);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1662 } else {
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1663 char *tmp = charset_convert(msg, "UTF-8", "CP1250");
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1664 gaim_debug_info("gg",
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1665 "ggp_set_status: msg != NULL. msg = %s\n", tmp);
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1666 gaim_debug_info("gg",
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1667 "ggp_set_status: gg_change_status_descr() = %d\n",
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1668 gg_change_status_descr(info->session, new_status_descr, tmp));
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1669 g_free(tmp);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1670 }
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9943
diff changeset
1671
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1672 }
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1673 /* }}} */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1674
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1675 /* static void ggp_add_buddy(GaimConnection *gc, GaimBuddy *buddy, GaimGroup *group) {{{ */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1676 static void ggp_add_buddy(GaimConnection *gc, GaimBuddy *buddy, GaimGroup *group)
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1677 {
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1678 GGPInfo *info = gc->proto_data;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1679
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1680 gg_add_notify(info->session, ggp_str_to_uin(buddy->name));
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1681 }
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1682 /* }}} */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1683
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1684 /* 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
1685 static void ggp_remove_buddy(GaimConnection *gc, GaimBuddy *buddy,
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1686 GaimGroup *group)
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1687 {
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1688 GGPInfo *info = gc->proto_data;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1689
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1690 gg_remove_notify(info->session, ggp_str_to_uin(buddy->name));
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1691 }
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1692 /* }}} */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1693
11394
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1694 /* static void ggp_join_chat(GaimConnection *gc, GHashTable *data) {{{ */
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1695 static void ggp_join_chat(GaimConnection *gc, GHashTable *data)
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1696 {
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1697 GGPInfo *info = gc->proto_data;
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1698 GGPChat *chat;
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1699 char *chat_name;
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1700 GList *l;
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1701
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1702 chat_name = g_hash_table_lookup(data, "name");
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1703
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1704 if (chat_name == NULL)
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1705 return;
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1706
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1707 gaim_debug_info("gg", "joined %s chat\n", chat_name);
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1708
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1709 for (l = info->chats; l != NULL; l = l->next) {
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1710 chat = l->data;
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1711
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1712 if (chat != NULL && g_utf8_collate(chat->name, chat_name) == 0) {
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1713 gaim_notify_error(gc, _("Chat error"),
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1714 _("This chat name is already in use"), NULL);
11394
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1715 return;
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1716 }
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1717 }
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1718
11414
d5599677bf32 [gaim-migrate @ 13651]
Bartoz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1719 ggp_confer_add_new(gc, chat_name);
11394
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1720 serv_got_joined_chat(gc, info->chats_count, chat_name);
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1721 }
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1722 /* }}} */
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1723
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1724 /* static char *ggp_get_chat_name(GHashTable *data) { {{{ */
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1725 static char *ggp_get_chat_name(GHashTable *data) {
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1726 return g_strdup(g_hash_table_lookup(data, "name"));
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1727 }
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1728 /* }}} */
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1729
12216
4d3119205a33 [gaim-migrate @ 14518]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12143
diff changeset
1730 /* static int ggp_chat_send(GaimConnection *gc, int id, const char *message, GaimMessageFlags flags) {{{ */
4d3119205a33 [gaim-migrate @ 14518]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12143
diff changeset
1731 static int ggp_chat_send(GaimConnection *gc, int id, const char *message, GaimMessageFlags flags)
11394
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1732 {
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1733 GaimConversation *conv;
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1734 GGPInfo *info = gc->proto_data;
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1735 GGPChat *chat = NULL;
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1736 GList *l;
12216
4d3119205a33 [gaim-migrate @ 14518]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12143
diff changeset
1737 char *msg, *plain;
11394
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1738 uin_t *uins;
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1739 int count = 0;
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1740
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1741 if ((conv = gaim_find_chat(gc, id)) == NULL)
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1742 return -EINVAL;
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1743
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1744 for (l = info->chats; l != NULL; l = l->next) {
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1745 chat = l->data;
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1746
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1747 if (g_utf8_collate(chat->name, conv->name) == 0) {
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1748 gaim_debug_info("gg", "found conv!\n");
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1749 break;
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1750 }
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1751
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1752 chat = NULL;
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1753 }
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1754
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1755 if (chat == NULL) {
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1756 gaim_debug_error("gg",
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1757 "ggp_chat_send: Hm... that's strange. No such chat?\n");
11394
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1758 return -EINVAL;
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1759 }
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1760
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1761 uins = g_new0(uin_t, g_list_length(chat->participants));
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1762 for (l = chat->participants; l != NULL; l = l->next) {
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1763 gchar *name = l->data;
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1764 uin_t uin;
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1765
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1766 if ((uin = ggp_str_to_uin(name)) != 0)
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1767 uins[count++] = uin;
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1768 }
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1769
12216
4d3119205a33 [gaim-migrate @ 14518]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12143
diff changeset
1770 plain = gaim_unescape_html(message);
4d3119205a33 [gaim-migrate @ 14518]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12143
diff changeset
1771 msg = charset_convert(plain, "UTF-8", "CP1250");
4d3119205a33 [gaim-migrate @ 14518]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12143
diff changeset
1772 g_free(plain);
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1773 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
1774 (unsigned char *)msg);
11394
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1775 g_free(msg);
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1776 g_free(uins);
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1777
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1778 serv_got_chat_in(gc, id,
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1779 gaim_account_get_username(gaim_connection_get_account(gc)),
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1780 0, message, time(NULL));
11394
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1781
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1782 return 0;
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1783 }
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1784 /* }}} */
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1785
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1786 /* static void ggp_keepalive(GaimConnection *gc) {{{ */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1787 static void ggp_keepalive(GaimConnection *gc)
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1788 {
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1789 GGPInfo *info = gc->proto_data;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1790
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1791 /* gaim_debug_info("gg", "Keeping connection alive....\n"); */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1792
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1793 if (gg_ping(info->session) < 0) {
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1794 gaim_debug_info("gg", "Not connected to the server "
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1795 "or gg_session is not correct\n");
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1796 gaim_connection_error(gc, _("Not connected to the server."));
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4793
diff changeset
1797 }
2393
a7ecfd3f7714 [gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1798 }
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1799 /* }}} */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1800
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1801 /* static void ggp_register_user(GaimAccount *account) {{{ */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1802 static void ggp_register_user(GaimAccount *account)
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1803 {
11542
cda814bad7f8 [gaim-migrate @ 13797]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11541
diff changeset
1804 GaimConnection *gc = gaim_account_get_connection(account);
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1805 GGPInfo *info;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1806
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1807 info = gc->proto_data = g_new0(GGPInfo, 1);
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1808
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1809 ggp_token_request(gc, ggp_register_user_dialog);
2393
a7ecfd3f7714 [gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1810 }
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1811 /* }}} */
2393
a7ecfd3f7714 [gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1812
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1813 /* static GList *ggp_actions(GaimPlugin *plugin, gpointer context) {{{ */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1814 static GList *ggp_actions(GaimPlugin *plugin, gpointer context)
8775
ce90b119b103 [gaim-migrate @ 9537]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
1815 {
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1816 GList *m = NULL;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1817 GaimPluginAction *act;
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1818
12220
64254fbabc7b [gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents: 12216
diff changeset
1819 act = gaim_plugin_action_new(_("Find buddies..."),
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1820 ggp_find_buddies);
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1821 m = g_list_append(m, act);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1822
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1823 m = g_list_append(m, NULL);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1824
12220
64254fbabc7b [gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents: 12216
diff changeset
1825 act = gaim_plugin_action_new(_("Change password..."),
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1826 ggp_change_passwd);
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1827 m = g_list_append(m, act);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1828
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1829 m = g_list_append(m, NULL);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1830
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1831 act = gaim_plugin_action_new(_("Upload buddylist to Server"),
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1832 ggp_action_buddylist_put);
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1833 m = g_list_append(m, act);
8775
ce90b119b103 [gaim-migrate @ 9537]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
1834
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1835 act = gaim_plugin_action_new(_("Download buddylist from Server"),
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1836 ggp_action_buddylist_get);
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1837 m = g_list_append(m, act);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1838
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1839 act = gaim_plugin_action_new(_("Delete buddylist from Server"),
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1840 ggp_action_buddylist_delete);
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1841 m = g_list_append(m, act);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1842
12220
64254fbabc7b [gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents: 12216
diff changeset
1843 act = gaim_plugin_action_new(_("Save buddylist to file..."),
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1844 ggp_action_buddylist_save);
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1845 m = g_list_append(m, act);
8775
ce90b119b103 [gaim-migrate @ 9537]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
1846
12220
64254fbabc7b [gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents: 12216
diff changeset
1847 act = gaim_plugin_action_new(_("Load buddylist from file..."),
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1848 ggp_action_buddylist_load);
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1849 m = g_list_append(m, act);
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1850
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1851 return m;
8775
ce90b119b103 [gaim-migrate @ 9537]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
1852 }
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1853 /* }}} */
8775
ce90b119b103 [gaim-migrate @ 9537]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
1854
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1855 /* prpl_info setup {{{ */
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
1856 static GaimPluginProtocolInfo prpl_info =
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
1857 {
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1858 OPT_PROTO_REGISTER_NOSCREENNAME,
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1859 NULL, /* user_splits */
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1860 NULL, /* protocol_options */
9950
ba085944efee [gaim-migrate @ 10846]
Tim Ringenbach <marv@pidgin.im>
parents: 9944
diff changeset
1861 NO_BUDDY_ICONS, /* icon_spec */
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1862 ggp_list_icon, /* list_icon */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1863 ggp_list_emblems, /* list_emblems */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1864 ggp_status_text, /* status_text */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1865 ggp_tooltip_text, /* tooltip_text */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1866 ggp_status_types, /* status_types */
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1867 ggp_blist_node_menu, /* blist_node_menu */
11394
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1868 ggp_chat_info, /* chat_info */
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1869 NULL, /* chat_info_defaults */
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1870 ggp_login, /* login */
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1871 ggp_close, /* close */
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1872 ggp_send_im, /* send_im */
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1873 NULL, /* set_info */
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1874 NULL, /* send_typing */
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1875 ggp_get_info, /* get_info */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1876 ggp_set_status, /* set_away */
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1877 NULL, /* set_idle */
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1878 NULL, /* change_passwd */
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1879 ggp_add_buddy, /* add_buddy */
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1880 NULL, /* add_buddies */
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1881 ggp_remove_buddy, /* remove_buddy */
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1882 NULL, /* remove_buddies */
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1883 NULL, /* add_permit */
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1884 NULL, /* add_deny */
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1885 NULL, /* rem_permit */
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1886 NULL, /* rem_deny */
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1887 NULL, /* set_permit_deny */
11394
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1888 ggp_join_chat, /* join_chat */
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1889 NULL, /* reject_chat */
11394
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1890 ggp_get_chat_name, /* get_chat_name */
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1891 NULL, /* chat_invite */
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1892 NULL, /* chat_leave */
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1893 NULL, /* chat_whisper */
11394
54934c165625 [gaim-migrate @ 13625]
Bartoz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1894 ggp_chat_send, /* chat_send */
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1895 ggp_keepalive, /* keepalive */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1896 ggp_register_user, /* register_user */
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1897 NULL, /* get_cb_info */
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1898 NULL, /* get_cb_away */
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1899 NULL, /* alias_buddy */
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1900 NULL, /* group_buddy */
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1901 NULL, /* rename_group */
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1902 NULL, /* buddy_free */
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1903 NULL, /* convo_closed */
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1904 NULL, /* normalize */
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1905 NULL, /* set_buddy_icon */
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1906 NULL, /* remove_group */
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1907 NULL, /* get_cb_real_name */
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1908 NULL, /* set_chat_topic */
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1909 NULL, /* find_blist_chat */
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1910 NULL, /* roomlist_get_list */
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1911 NULL, /* roomlist_cancel */
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1912 NULL, /* roomlist_expand_category */
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1913 NULL, /* can_receive_file */
12143
cbebda5f019c [gaim-migrate @ 14444]
Richard Laager <rlaager@wiktel.com>
parents: 12007
diff changeset
1914 NULL, /* send_file */
cbebda5f019c [gaim-migrate @ 14444]
Richard Laager <rlaager@wiktel.com>
parents: 12007
diff changeset
1915 NULL /* new_xfer */
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
1916 };
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1917 /* }}} */
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
1918
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1919 /* GaimPluginInfo setup {{{ */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1920 static GaimPluginInfo info = {
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1921 GAIM_PLUGIN_MAGIC, /* magic */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1922 GAIM_MAJOR_VERSION, /* major_version */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1923 GAIM_MINOR_VERSION, /* minor_version */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1924 GAIM_PLUGIN_PROTOCOL, /* plugin type */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1925 NULL, /* ui_requirement */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1926 0, /* flags */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1927 NULL, /* dependencies */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1928 GAIM_PRIORITY_DEFAULT, /* priority */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1929
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1930 "prpl-gg", /* id */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1931 "Gadu-Gadu", /* name */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1932 VERSION, /* version */
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
1933
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1934 N_("Gadu-Gadu Protocol Plugin"), /* summary */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1935 N_("Polish popular IM"), /* description */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1936 "boler@sourceforge.net", /* author */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1937 GAIM_WEBSITE, /* homepage */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1938
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1939 NULL, /* load */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1940 NULL, /* unload */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1941 NULL, /* destroy */
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
1942
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1943 NULL, /* ui_info */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1944 &prpl_info, /* extra_info */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1945 NULL, /* prefs_info */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1946 ggp_actions /* actions */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1947 };
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1948 /* }}} */
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
1949
11565
2aa7d8dd61d7 [gaim-migrate @ 13831]
Bartoz Oler <bartosz@pidgin.im>
parents: 11545
diff changeset
1950 /* 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
1951 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
1952 GaimDebugLevel gaim_level;
5fc015909164 [gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11538
diff changeset
1953 char *msg = g_strdup_vprintf(format, args);
5fc015909164 [gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11538
diff changeset
1954
5fc015909164 [gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11538
diff changeset
1955 /* 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
1956 * the gaim ones */
5fc015909164 [gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11538
diff changeset
1957 switch (level) {
5fc015909164 [gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11538
diff changeset
1958 case GG_DEBUG_FUNCTION:
5fc015909164 [gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11538
diff changeset
1959 gaim_level = GAIM_DEBUG_INFO;
5fc015909164 [gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11538
diff changeset
1960 break;
5fc015909164 [gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11538
diff changeset
1961 case GG_DEBUG_MISC:
5fc015909164 [gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11538
diff changeset
1962 case GG_DEBUG_NET:
5fc015909164 [gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11538
diff changeset
1963 case GG_DEBUG_DUMP:
5fc015909164 [gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11538
diff changeset
1964 case GG_DEBUG_TRAFFIC:
5fc015909164 [gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11538
diff changeset
1965 default:
5fc015909164 [gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11538
diff changeset
1966 gaim_level = GAIM_DEBUG_MISC;
5fc015909164 [gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11538
diff changeset
1967 break;
5fc015909164 [gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11538
diff changeset
1968 }
5fc015909164 [gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11538
diff changeset
1969
5fc015909164 [gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11538
diff changeset
1970 gaim_debug(gaim_level, "gg", msg);
5fc015909164 [gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11538
diff changeset
1971 g_free(msg);
5fc015909164 [gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11538
diff changeset
1972 }
11565
2aa7d8dd61d7 [gaim-migrate @ 13831]
Bartoz Oler <bartosz@pidgin.im>
parents: 11545
diff changeset
1973 /* }}} */
11541
5fc015909164 [gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11538
diff changeset
1974
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1975 /*
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1976 */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1977 /* static void init_plugin(GaimPlugin *plugin) {{{ */
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1978 static void init_plugin(GaimPlugin *plugin)
2393
a7ecfd3f7714 [gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1979 {
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5618
diff changeset
1980 GaimAccountOption *option;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
1981
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1982 option = gaim_account_option_string_new(_("Nickname"),
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1983 "nick", _("Gadu-Gadu User"));
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1984 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
1985 option);
3572
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3466
diff changeset
1986
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
1987 my_protocol = plugin;
11541
5fc015909164 [gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11538
diff changeset
1988
5fc015909164 [gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11538
diff changeset
1989 gg_debug_handler = gaim_gg_debug_handler;
2393
a7ecfd3f7714 [gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1990 }
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1991 /* }}} */
2393
a7ecfd3f7714 [gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1992
11909
1b029c5898af [gaim-migrate @ 14200]
Richard Laager <rlaager@wiktel.com>
parents: 11837
diff changeset
1993 GAIM_INIT_PLUGIN(gg, init_plugin, info);
11360
cf15c1cdcfbd [gaim-migrate @ 13582]
Bartoz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
1994
12007
8724718d387f [gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11920
diff changeset
1995 /* vim: set ts=8 sts=0 sw=8 noet: */