libpurple/protocols/gg/pubdir-prpl.c

Thu, 23 Feb 2023 22:42:20 -0600

author
Gary Kramlich <grim@reaperworld.com>
date
Thu, 23 Feb 2023 22:42:20 -0600
changeset 42085
a76f1668564c
parent 41979
31c32b8d4bef
child 42127
18acb99a0fa6
permissions
-rw-r--r--

Make the gadu gadu protocol plugin clean for warning level 2

Testing Done:
Touched all of the files, built, and verifed the warnings were gone.

Reviewed at https://reviews.imfreedom.org/r/2262/

33348
2394cd23ce8f Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33347
diff changeset
1 /* purple
2394cd23ce8f Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33347
diff changeset
2 *
2394cd23ce8f Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33347
diff changeset
3 * Purple is the legal property of its developers, whose names are too numerous
2394cd23ce8f Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33347
diff changeset
4 * to list here. Please refer to the COPYRIGHT file distributed with this
2394cd23ce8f Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33347
diff changeset
5 * source distribution.
2394cd23ce8f Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33347
diff changeset
6 *
2394cd23ce8f Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33347
diff changeset
7 * Rewritten from scratch during Google Summer of Code 2012
2394cd23ce8f Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33347
diff changeset
8 * by Tomek Wasilczyk (http://www.wasilczyk.pl).
2394cd23ce8f Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33347
diff changeset
9 *
2394cd23ce8f Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33347
diff changeset
10 * Previously implemented by:
2394cd23ce8f Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33347
diff changeset
11 * - Arkadiusz Miskiewicz <misiek@pld.org.pl> - first implementation (2001);
2394cd23ce8f Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33347
diff changeset
12 * - Bartosz Oler <bartosz@bzimage.us> - reimplemented during GSoC 2005;
2394cd23ce8f Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33347
diff changeset
13 * - Krzysztof Klinikowski <grommasher@gmail.com> - some parts (2009-2011).
2394cd23ce8f Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33347
diff changeset
14 *
2394cd23ce8f Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33347
diff changeset
15 * This program is free software; you can redistribute it and/or modify
2394cd23ce8f Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33347
diff changeset
16 * it under the terms of the GNU General Public License as published by
2394cd23ce8f Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33347
diff changeset
17 * the Free Software Foundation; either version 2 of the License, or
2394cd23ce8f Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33347
diff changeset
18 * (at your option) any later version.
2394cd23ce8f Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33347
diff changeset
19 *
2394cd23ce8f Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33347
diff changeset
20 * This program is distributed in the hope that it will be useful,
2394cd23ce8f Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33347
diff changeset
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
2394cd23ce8f Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33347
diff changeset
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2394cd23ce8f Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33347
diff changeset
23 * GNU General Public License for more details.
2394cd23ce8f Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33347
diff changeset
24 *
2394cd23ce8f Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33347
diff changeset
25 * You should have received a copy of the GNU General Public License
2394cd23ce8f Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33347
diff changeset
26 * along with this program; if not, write to the Free Software
2394cd23ce8f Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33347
diff changeset
27 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
2394cd23ce8f Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33347
diff changeset
28 */
2394cd23ce8f Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33347
diff changeset
29
40439
e9838d634d5e Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents: 40358
diff changeset
30 #include <glib/gi18n-lib.h>
e9838d634d5e Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents: 40358
diff changeset
31
40474
1341be8e3402 Make it so only libpurple can directly include libpurple header files.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
32 #include <purple.h>
1341be8e3402 Make it so only libpurple can directly include libpurple header files.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
33
33343
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
34 #include "pubdir-prpl.h"
40020
76afb08714b4 Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40010
diff changeset
35 #include "gg.h"
33343
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
36
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
37 #include "oauth/oauth-purple.h"
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
38 #include "xml.h"
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
39 #include "utils.h"
33344
2a2560bb1445 Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33343
diff changeset
40 #include "status.h"
33343
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
41
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
42 typedef struct
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
43 {
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
44 PurpleConnection *gc;
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
45 ggp_pubdir_request_cb cb;
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
46 void *user_data;
33346
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
47 enum
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
48 {
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
49 GGP_PUBDIR_REQUEST_TYPE_INFO,
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
50 GGP_PUBDIR_REQUEST_TYPE_SEARCH,
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
51 } type;
33343
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
52 union
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
53 {
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
54 struct
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
55 {
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
56 uin_t uin;
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
57 } user_info;
33346
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
58 ggp_pubdir_search_form *search_form;
33343
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
59 } params;
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
60 } ggp_pubdir_request;
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
61
35356
3a71df246d07 Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35355
diff changeset
62 /* Searching for buddies. */
33346
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
63
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
64 #define GGP_PUBDIR_SEARCH_TITLE _("Gadu-Gadu Public Directory")
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
65 #define GGP_PUBDIR_SEARCH_PER_PAGE 20
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
66
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
67 struct _ggp_pubdir_search_form
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
68 {
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
69 gchar *nick, *city;
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
70 ggp_pubdir_gender gender;
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
71 int offset;
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
72 int limit;
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
73
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
74 void *display_handle;
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
75 };
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
76
40010
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
77 /* For ggp_pubdir_search_results_next, which is called by this. */
33346
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
78 static void ggp_pubdir_search_results_display(PurpleConnection *gc,
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
79 int records_count, const ggp_pubdir_record *records, int next_offset,
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
80 void *user_data);
33347
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
81
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
82 /******************************************************************************/
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
83
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
84 static const gchar *ggp_pubdir_provinces[] =
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
85 {
34338
c652670afac5 Request API refactoring: custom PURPLE_REQUEST_CHOICE values, instead of indexes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34332
diff changeset
86 N_("Not specified"),
33347
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
87 "dolnośląskie",
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
88 "kujawsko-pomorskie",
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
89 "lubelskie",
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
90 "lubuskie",
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
91 "łódzkie",
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
92 "małopolskie",
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
93 "mazowieckie",
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
94 "opolskie",
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
95 "podkarpackie",
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
96 "podlaskie",
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
97 "pomorskie",
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
98 "śląskie",
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
99 "świętokrzyskie",
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
100 "warmińsko-mazurskie",
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
101 "wielkopolskie",
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
102 "zachodniopomorskie",
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
103 };
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
104
34304
faf0414a8b51 Fix most of libpurple warnings about -Wsign-compare
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34287
diff changeset
105 static gsize ggp_pubdir_provinces_count = sizeof(ggp_pubdir_provinces)/sizeof(gchar*);
33347
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
106
33343
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
107 /******************************************************************************/
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
108
40010
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
109 static void
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
110 ggp_pubdir_record_free(ggp_pubdir_record *records, int count)
33343
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
111 {
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
112 int i;
35361
efdbd45604f1 Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35356
diff changeset
113 for (i = 0; i < count; i++) {
33343
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
114 g_free(records[i].label);
33347
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
115 g_free(records[i].nickname);
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
116 g_free(records[i].first_name);
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
117 g_free(records[i].last_name);
33343
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
118 g_free(records[i].city);
40512
05663def7b82 Fix some easy compiler warnings
Gary Kramlich <grim@reaperworld.com>
parents: 40474
diff changeset
119 g_date_time_unref(records[i].birth);
33343
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
120 }
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
121 g_free(records);
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
122 }
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
123
40010
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
124 static void
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
125 ggp_pubdir_search_form_free(ggp_pubdir_search_form *form)
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
126 {
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
127 g_free(form->nick);
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
128 g_free(form->city);
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
129 g_free(form);
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
130 }
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
131
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
132 static void
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
133 ggp_pubdir_request_free(ggp_pubdir_request *request)
33343
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
134 {
33346
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
135 if (request->type == GGP_PUBDIR_REQUEST_TYPE_SEARCH)
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
136 ggp_pubdir_search_form_free(request->params.search_form);
33343
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
137 g_free(request);
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
138 }
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
139
40020
76afb08714b4 Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40010
diff changeset
140 static void
41878
64e455cfb6b4 Port some of gg to libsoup3
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41700
diff changeset
141 ggp_pubdir_got_data(GObject *source, GAsyncResult *result, gpointer data) {
64e455cfb6b4 Port some of gg to libsoup3
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41700
diff changeset
142 ggp_pubdir_request *request = data;
33343
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
143 PurpleConnection *gc = request->gc;
41878
64e455cfb6b4 Port some of gg to libsoup3
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41700
diff changeset
144 GBytes *response_body = NULL;
33343
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
145 gboolean succ = TRUE;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
146 PurpleXmlNode *xml;
41878
64e455cfb6b4 Port some of gg to libsoup3
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41700
diff changeset
147 const char *xml_raw = NULL;
64e455cfb6b4 Port some of gg to libsoup3
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41700
diff changeset
148 gsize xml_size = 0;
33346
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
149 unsigned int status, next_offset;
33343
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
150 int record_count, i;
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
151 ggp_pubdir_record *records;
41878
64e455cfb6b4 Port some of gg to libsoup3
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41700
diff changeset
152 GError *error = NULL;
33343
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
153
41878
64e455cfb6b4 Port some of gg to libsoup3
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41700
diff changeset
154 response_body = soup_session_send_and_read_finish(SOUP_SESSION(source),
64e455cfb6b4 Port some of gg to libsoup3
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41700
diff changeset
155 result, &error);
64e455cfb6b4 Port some of gg to libsoup3
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41700
diff changeset
156 if (response_body == NULL) {
64e455cfb6b4 Port some of gg to libsoup3
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41700
diff changeset
157 purple_debug_error("gg", "ggp_pubdir_got_data: %s", error->message);
64e455cfb6b4 Port some of gg to libsoup3
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41700
diff changeset
158 request->cb(gc, -1, NULL, 0, request->user_data);
64e455cfb6b4 Port some of gg to libsoup3
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41700
diff changeset
159 ggp_pubdir_request_free(request);
64e455cfb6b4 Port some of gg to libsoup3
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41700
diff changeset
160 g_error_free(error);
64e455cfb6b4 Port some of gg to libsoup3
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41700
diff changeset
161 return;
64e455cfb6b4 Port some of gg to libsoup3
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41700
diff changeset
162 }
64e455cfb6b4 Port some of gg to libsoup3
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41700
diff changeset
163
64e455cfb6b4 Port some of gg to libsoup3
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41700
diff changeset
164 xml_raw = g_bytes_unref_to_data(response_body, &xml_size);
33343
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
165
34232
a5517f235e0f HTTP: migrate purple_util_fetch_url_request to new API for GG prpl
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33865
diff changeset
166 if (purple_debug_is_verbose() && purple_debug_is_unsafe()) {
41883
c67c45d70006 Fix string size specifier in debug prints
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41878
diff changeset
167 purple_debug_misc("gg", "ggp_pubdir_got_data: xml=[%.*s]",
41878
64e455cfb6b4 Port some of gg to libsoup3
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41700
diff changeset
168 (int)xml_size, xml_raw);
34232
a5517f235e0f HTTP: migrate purple_util_fetch_url_request to new API for GG prpl
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33865
diff changeset
169 }
a5517f235e0f HTTP: migrate purple_util_fetch_url_request to new API for GG prpl
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33865
diff changeset
170
41878
64e455cfb6b4 Port some of gg to libsoup3
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41700
diff changeset
171 xml = purple_xmlnode_from_str(xml_raw, xml_size);
35361
efdbd45604f1 Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35356
diff changeset
172 if (xml == NULL) {
33346
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
173 purple_debug_error("gg", "ggp_pubdir_got_data: "
33343
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
174 "invalid xml\n");
33346
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
175 request->cb(gc, -1, NULL, 0, request->user_data);
33343
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
176 ggp_pubdir_request_free(request);
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
177 return;
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
178 }
35355
3be5d45ba972 Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35158
diff changeset
179
33343
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
180 succ &= ggp_xml_get_uint(xml, "status", &status);
33346
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
181 if (!ggp_xml_get_uint(xml, "nextOffset", &next_offset))
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
182 next_offset = 0;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
183 xml = purple_xmlnode_get_child(xml, "users");
35361
efdbd45604f1 Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35356
diff changeset
184 if (!succ || status != 0 || !xml) {
33346
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
185 purple_debug_error("gg", "ggp_pubdir_got_data: "
33343
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
186 "invalid reply\n");
33346
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
187 request->cb(gc, -1, NULL, 0, request->user_data);
33343
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
188 ggp_pubdir_request_free(request);
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
189 return;
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
190 }
35355
3be5d45ba972 Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35158
diff changeset
191
33343
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
192 record_count = ggp_xml_child_count(xml, "user");
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
193 records = g_new0(ggp_pubdir_record, record_count);
35355
3be5d45ba972 Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35158
diff changeset
194
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
195 xml = purple_xmlnode_get_child(xml, "user");
33343
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
196 i = 0;
35361
efdbd45604f1 Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35356
diff changeset
197 while (xml) {
33343
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
198 ggp_pubdir_record *record = &records[i++];
33347
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
199 gchar *city = NULL, *birth_s = NULL;
33343
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
200 unsigned int gender = 0;
33347
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
201 const gchar *uin_s;
35355
3be5d45ba972 Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35158
diff changeset
202
33343
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
203 g_assert(i <= record_count);
35355
3be5d45ba972 Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35158
diff changeset
204
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
205 record->uin = ggp_str_to_uin(purple_xmlnode_get_attrib(xml, "uin"));
33346
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
206 if (record->uin == 0)
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
207 ggp_xml_get_uint(xml, "uin", &record->uin);
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
208 if (record->uin == 0)
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
209 purple_debug_error("gg", "ggp_pubdir_got_data:"
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
210 " invalid uin\n");
33347
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
211 uin_s = ggp_uin_to_str(record->uin);
35355
3be5d45ba972 Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35158
diff changeset
212
33347
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
213 ggp_xml_get_string(xml, "label", &record->label);
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
214 ggp_xml_get_string(xml, "nick", &record->nickname);
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
215 ggp_xml_get_string(xml, "name", &record->first_name);
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
216 ggp_xml_get_string(xml, "surname", &record->last_name);
33343
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
217 ggp_xml_get_string(xml, "city", &city);
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
218 ggp_xml_get_string(xml, "birth", &birth_s);
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
219 ggp_xml_get_uint(xml, "gender", &gender);
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
220 ggp_xml_get_uint(xml, "age", &record->age);
33347
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
221 ggp_xml_get_uint(xml, "province", &record->province);
35355
3be5d45ba972 Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35158
diff changeset
222
33347
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
223 record->label = ggp_free_if_equal(record->label, uin_s);
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
224 record->label = ggp_free_if_equal(record->label, "");
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
225 record->nickname = ggp_free_if_equal(record->nickname, uin_s);
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
226 record->nickname = ggp_free_if_equal(record->nickname, "");
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
227 record->first_name = ggp_free_if_equal(record->first_name, "");
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
228 record->last_name = ggp_free_if_equal(record->last_name, "");
40512
05663def7b82 Fix some easy compiler warnings
Gary Kramlich <grim@reaperworld.com>
parents: 40474
diff changeset
229 g_clear_pointer(&record->birth, g_date_time_unref);
35355
3be5d45ba972 Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35158
diff changeset
230
33347
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
231 if (record->label) {}
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
232 else if (record->nickname)
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
233 record->label = g_strdup(record->nickname);
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
234 else if (record->first_name && record->last_name)
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
235 record->label = g_strdup_printf("%s %s",
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
236 record->first_name, record->last_name);
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
237 else if (record->first_name)
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
238 record->label = g_strdup(record->first_name);
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
239 else if (record->last_name)
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
240 record->label = g_strdup(record->last_name);
33346
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
241 if (record->label)
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
242 g_strstrip(record->label);
33347
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
243 if (record->nickname)
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
244 g_strstrip(record->nickname);
35355
3be5d45ba972 Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35158
diff changeset
245
33343
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
246 if (gender == 1)
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
247 record->gender = GGP_PUBDIR_GENDER_FEMALE;
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
248 else if (gender == 2)
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
249 record->gender = GGP_PUBDIR_GENDER_MALE;
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
250 else
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
251 record->gender = GGP_PUBDIR_GENDER_UNSPECIFIED;
35355
3be5d45ba972 Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35158
diff changeset
252
33343
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
253 if (city && city[0] != '\0')
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
254 record->city = g_strdup(city);
33346
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
255 if (record->city)
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
256 g_strstrip(record->city);
35361
efdbd45604f1 Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35356
diff changeset
257 if (!record->city) {
33346
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
258 g_free(record->city);
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
259 record->city = NULL;
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
260 }
35355
3be5d45ba972 Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35158
diff changeset
261
40512
05663def7b82 Fix some easy compiler warnings
Gary Kramlich <grim@reaperworld.com>
parents: 40474
diff changeset
262 record->birth = g_date_time_new_from_iso8601(birth_s, NULL);
35356
3a71df246d07 Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35355
diff changeset
263 /*TODO: calculate age from birth */
35355
3be5d45ba972 Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35158
diff changeset
264
35356
3a71df246d07 Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35355
diff changeset
265 if (purple_debug_is_verbose()) {
3a71df246d07 Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35355
diff changeset
266 purple_debug_misc("gg", "ggp_pubdir_got_data: [uin:%d] "
3a71df246d07 Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35355
diff changeset
267 "[label:%s] [nick:%s] [first name:%s] "
3a71df246d07 Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35355
diff changeset
268 "[last name:%s] [city:%s] [gender:%d] [age:%d] "
3a71df246d07 Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35355
diff changeset
269 "[birth:%lu]\n", record->uin, record->label,
3a71df246d07 Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35355
diff changeset
270 record->nickname, record->first_name,
3a71df246d07 Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35355
diff changeset
271 record->last_name, record->city, record->gender,
40512
05663def7b82 Fix some easy compiler warnings
Gary Kramlich <grim@reaperworld.com>
parents: 40474
diff changeset
272 record->age, g_date_time_to_unix(record->birth));
35356
3a71df246d07 Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35355
diff changeset
273 }
35355
3be5d45ba972 Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35158
diff changeset
274
40520
eae11ccb1bef Fix some ggp_xml stuff
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40514
diff changeset
275 g_clear_pointer(&city, g_free);
eae11ccb1bef Fix some ggp_xml stuff
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40514
diff changeset
276 g_clear_pointer(&birth_s, g_free);
35355
3be5d45ba972 Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35158
diff changeset
277
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34889
diff changeset
278 xml = purple_xmlnode_get_next_twin(xml);
33343
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
279 }
35355
3be5d45ba972 Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35158
diff changeset
280
33346
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
281 request->cb(gc, record_count, records, next_offset, request->user_data);
35355
3be5d45ba972 Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35158
diff changeset
282
33343
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
283 ggp_pubdir_request_free(request);
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
284 ggp_pubdir_record_free(records, record_count);
09f740724036 Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
285 }
33344
2a2560bb1445 Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33343
diff changeset
286
40010
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
287 static void
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
288 ggp_pubdir_get_info_got_token(PurpleConnection *gc, const gchar *token,
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
289 gpointer _request)
33344
2a2560bb1445 Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33343
diff changeset
290 {
40020
76afb08714b4 Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40010
diff changeset
291 GGPInfo *info = NULL;
76afb08714b4 Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40010
diff changeset
292 gchar *url;
76afb08714b4 Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40010
diff changeset
293 SoupMessage *msg;
40010
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
294 ggp_pubdir_request *request = _request;
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
295
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
296 PURPLE_ASSERT_CONNECTION_IS_VALID(gc);
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
297
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
298 if (!token) {
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
299 request->cb(gc, -1, NULL, 0, request->user_data);
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
300 ggp_pubdir_request_free(request);
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
301 return;
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
302 }
33351
bd15903d0d89 Gadu-Gadu: fix compilation on 64bit targets
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33348
diff changeset
303
40020
76afb08714b4 Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40010
diff changeset
304 info = purple_connection_get_protocol_data(gc);
76afb08714b4 Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40010
diff changeset
305
76afb08714b4 Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40010
diff changeset
306 url = g_strdup_printf("http://api.gadu-gadu.pl/users/%u",
76afb08714b4 Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40010
diff changeset
307 request->params.user_info.uin);
76afb08714b4 Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40010
diff changeset
308 msg = soup_message_new("GET", url);
76afb08714b4 Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40010
diff changeset
309 g_free(url);
41214
b0b7d118475f Use accessor for SoupMessage->request_headers
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 41212
diff changeset
310 soup_message_headers_replace(soup_message_get_request_headers(msg),
b0b7d118475f Use accessor for SoupMessage->request_headers
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 41212
diff changeset
311 "Authorization", token);
41878
64e455cfb6b4 Port some of gg to libsoup3
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41700
diff changeset
312 soup_session_send_and_read_async(info->http, msg, G_PRIORITY_DEFAULT, NULL,
64e455cfb6b4 Port some of gg to libsoup3
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41700
diff changeset
313 ggp_pubdir_got_data, request);
64e455cfb6b4 Port some of gg to libsoup3
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41700
diff changeset
314 g_object_unref(msg);
40010
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
315 }
33344
2a2560bb1445 Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33343
diff changeset
316
40010
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
317 void
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
318 ggp_pubdir_get_info(PurpleConnection *gc, uin_t uin, ggp_pubdir_request_cb cb,
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
319 void *user_data)
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
320 {
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
321 ggp_pubdir_request *request = g_new0(ggp_pubdir_request, 1);
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
322 gchar *url;
33344
2a2560bb1445 Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33343
diff changeset
323
40010
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
324 request->type = GGP_PUBDIR_REQUEST_TYPE_INFO;
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
325 request->gc = gc;
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
326 request->cb = cb;
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
327 request->user_data = user_data;
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
328 request->params.user_info.uin = uin;
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
329
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
330 url = g_strdup_printf("http://api.gadu-gadu.pl/users/%u", uin);
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
331 ggp_oauth_request(gc, ggp_pubdir_get_info_got_token, request, "GET", url);
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
332 g_free(url);
33344
2a2560bb1445 Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33343
diff changeset
333 }
2a2560bb1445 Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33343
diff changeset
334
42085
a76f1668564c Make the gadu gadu protocol plugin clean for warning level 2
Gary Kramlich <grim@reaperworld.com>
parents: 41979
diff changeset
335 static void
a76f1668564c Make the gadu gadu protocol plugin clean for warning level 2
Gary Kramlich <grim@reaperworld.com>
parents: 41979
diff changeset
336 ggp_pubdir_get_info_protocol_got(PurpleConnection *gc, int records_count,
a76f1668564c Make the gadu gadu protocol plugin clean for warning level 2
Gary Kramlich <grim@reaperworld.com>
parents: 41979
diff changeset
337 const ggp_pubdir_record *records,
a76f1668564c Make the gadu gadu protocol plugin clean for warning level 2
Gary Kramlich <grim@reaperworld.com>
parents: 41979
diff changeset
338 G_GNUC_UNUSED int next_offset, void *_uin_p)
33344
2a2560bb1445 Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33343
diff changeset
339 {
33351
bd15903d0d89 Gadu-Gadu: fix compilation on 64bit targets
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33348
diff changeset
340 uin_t uin = *((uin_t*)_uin_p);
33344
2a2560bb1445 Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33343
diff changeset
341 PurpleNotifyUserInfo *info = purple_notify_user_info_new();
2a2560bb1445 Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33343
diff changeset
342 const ggp_pubdir_record *record = &records[0];
2a2560bb1445 Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33343
diff changeset
343 PurpleBuddy *buddy;
35355
3be5d45ba972 Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35158
diff changeset
344
33351
bd15903d0d89 Gadu-Gadu: fix compilation on 64bit targets
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33348
diff changeset
345 g_free(_uin_p);
35355
3be5d45ba972 Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35158
diff changeset
346
35361
efdbd45604f1 Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35356
diff changeset
347 if (records_count < 1) {
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
348 purple_debug_error("gg", "ggp_pubdir_get_info_protocol_got: "
33344
2a2560bb1445 Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33343
diff changeset
349 "couldn't get info for %u\n", uin);
2a2560bb1445 Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33343
diff changeset
350 purple_notify_user_info_add_pair_plaintext(info, NULL,
2a2560bb1445 Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33343
diff changeset
351 _("Cannot get user information"));
2a2560bb1445 Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33343
diff changeset
352 purple_notify_userinfo(gc, ggp_uin_to_str(uin), info,
2a2560bb1445 Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33343
diff changeset
353 NULL, NULL);
2a2560bb1445 Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33343
diff changeset
354 purple_notify_user_info_destroy(info);
2a2560bb1445 Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33343
diff changeset
355 return;
2a2560bb1445 Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33343
diff changeset
356 }
35355
3be5d45ba972 Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35158
diff changeset
357
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
358 purple_debug_info("gg", "ggp_pubdir_get_info_protocol_got: %u\n", uin);
33344
2a2560bb1445 Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33343
diff changeset
359 g_assert(uin == record->uin);
33346
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
360 g_assert(records_count == 1);
35355
3be5d45ba972 Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35158
diff changeset
361
34728
8efd73063ecf Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents: 34701
diff changeset
362 buddy = purple_blist_find_buddy(purple_connection_get_account(gc),
33344
2a2560bb1445 Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33343
diff changeset
363 ggp_uin_to_str(uin));
35361
efdbd45604f1 Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35356
diff changeset
364 if (buddy) {
33344
2a2560bb1445 Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33343
diff changeset
365 const char *alias;
2a2560bb1445 Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33343
diff changeset
366 PurpleStatus *status;
2a2560bb1445 Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33343
diff changeset
367 gchar *status_message;
35355
3be5d45ba972 Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35158
diff changeset
368
33344
2a2560bb1445 Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33343
diff changeset
369 alias = purple_buddy_get_alias_only(buddy);
2a2560bb1445 Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33343
diff changeset
370 if (alias)
2a2560bb1445 Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33343
diff changeset
371 purple_notify_user_info_add_pair_plaintext(info,
2a2560bb1445 Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33343
diff changeset
372 _("Alias"), alias);
35355
3be5d45ba972 Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35158
diff changeset
373
33344
2a2560bb1445 Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33343
diff changeset
374 status = purple_presence_get_active_status(
2a2560bb1445 Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33343
diff changeset
375 purple_buddy_get_presence(buddy));
2a2560bb1445 Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33343
diff changeset
376 ggp_status_from_purplestatus(status, &status_message);
2a2560bb1445 Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33343
diff changeset
377 purple_notify_user_info_add_pair_plaintext(info, _("Status"),
2a2560bb1445 Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33343
diff changeset
378 purple_status_get_name(status));
35361
efdbd45604f1 Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35356
diff changeset
379 if (status_message) {
33344
2a2560bb1445 Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33343
diff changeset
380 purple_notify_user_info_add_pair_plaintext(info,
2a2560bb1445 Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33343
diff changeset
381 _("Message"), status_message);
35361
efdbd45604f1 Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35356
diff changeset
382 }
33344
2a2560bb1445 Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33343
diff changeset
383 }
35355
3be5d45ba972 Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35158
diff changeset
384
35361
efdbd45604f1 Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35356
diff changeset
385 if (record->nickname) {
33347
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
386 purple_notify_user_info_add_pair_plaintext(info,
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
387 _("Nickname"), record->nickname);
35361
efdbd45604f1 Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35356
diff changeset
388 }
efdbd45604f1 Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35356
diff changeset
389 if (record->first_name) {
33347
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
390 purple_notify_user_info_add_pair_plaintext(info,
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
391 _("First name"), record->first_name);
35361
efdbd45604f1 Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35356
diff changeset
392 }
efdbd45604f1 Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35356
diff changeset
393 if (record->last_name) {
33347
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
394 purple_notify_user_info_add_pair_plaintext(info,
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
395 _("Last name"), record->last_name);
35361
efdbd45604f1 Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35356
diff changeset
396 }
efdbd45604f1 Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35356
diff changeset
397 if (record->gender != GGP_PUBDIR_GENDER_UNSPECIFIED) {
33344
2a2560bb1445 Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33343
diff changeset
398 purple_notify_user_info_add_pair_plaintext(info, _("Gender"),
2a2560bb1445 Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33343
diff changeset
399 record->gender == GGP_PUBDIR_GENDER_FEMALE ?
2a2560bb1445 Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33343
diff changeset
400 _("Female") : _("Male"));
35361
efdbd45604f1 Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35356
diff changeset
401 }
efdbd45604f1 Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35356
diff changeset
402 if (record->city) {
33344
2a2560bb1445 Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33343
diff changeset
403 purple_notify_user_info_add_pair_plaintext(info, _("City"),
2a2560bb1445 Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33343
diff changeset
404 record->city);
35361
efdbd45604f1 Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35356
diff changeset
405 }
efdbd45604f1 Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35356
diff changeset
406 if (record->birth) {
40512
05663def7b82 Fix some easy compiler warnings
Gary Kramlich <grim@reaperworld.com>
parents: 40474
diff changeset
407 gchar *bday = g_date_time_format(record->birth, "%Y-%m-%d");
05663def7b82 Fix some easy compiler warnings
Gary Kramlich <grim@reaperworld.com>
parents: 40474
diff changeset
408
05663def7b82 Fix some easy compiler warnings
Gary Kramlich <grim@reaperworld.com>
parents: 40474
diff changeset
409 purple_notify_user_info_add_pair_plaintext(info, _("Birthday"), bday);
05663def7b82 Fix some easy compiler warnings
Gary Kramlich <grim@reaperworld.com>
parents: 40474
diff changeset
410
05663def7b82 Fix some easy compiler warnings
Gary Kramlich <grim@reaperworld.com>
parents: 40474
diff changeset
411 g_free(bday);
35361
efdbd45604f1 Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35356
diff changeset
412 } else if (record->age) {
33344
2a2560bb1445 Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33343
diff changeset
413 gchar *age_s = g_strdup_printf("%d", record->age);
2a2560bb1445 Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33343
diff changeset
414 purple_notify_user_info_add_pair_plaintext(info, _("Age"),
2a2560bb1445 Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33343
diff changeset
415 age_s);
2a2560bb1445 Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33343
diff changeset
416 g_free(age_s);
2a2560bb1445 Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33343
diff changeset
417 }
35355
3be5d45ba972 Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35158
diff changeset
418
33344
2a2560bb1445 Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33343
diff changeset
419 purple_notify_userinfo(gc, ggp_uin_to_str(uin), info, NULL, NULL);
2a2560bb1445 Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33343
diff changeset
420 purple_notify_user_info_destroy(info);
2a2560bb1445 Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33343
diff changeset
421 }
33345
740174b22496 Gadu-Gadu: retrieve buddy public alias after adding to blist. Fixes #2188
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33344
diff changeset
422
40010
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
423 void
42085
a76f1668564c Make the gadu gadu protocol plugin clean for warning level 2
Gary Kramlich <grim@reaperworld.com>
parents: 41979
diff changeset
424 ggp_pubdir_get_info_protocol(G_GNUC_UNUSED PurpleProtocolServer *protocol_server,
40708
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40520
diff changeset
425 PurpleConnection *gc, const gchar *name)
33345
740174b22496 Gadu-Gadu: retrieve buddy public alias after adding to blist. Fixes #2188
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33344
diff changeset
426 {
40010
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
427 uin_t uin = ggp_str_to_uin(name);
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
428 uin_t *uin_p = g_new0(uin_t, 1);
33345
740174b22496 Gadu-Gadu: retrieve buddy public alias after adding to blist. Fixes #2188
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33344
diff changeset
429
40010
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
430 *uin_p = uin;
33345
740174b22496 Gadu-Gadu: retrieve buddy public alias after adding to blist. Fixes #2188
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33344
diff changeset
431
40010
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
432 purple_debug_info("gg", "ggp_pubdir_get_info_protocol: %u", uin);
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
433
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
434 ggp_pubdir_get_info(gc, uin, ggp_pubdir_get_info_protocol_got, uin_p);
33345
740174b22496 Gadu-Gadu: retrieve buddy public alias after adding to blist. Fixes #2188
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33344
diff changeset
435 }
740174b22496 Gadu-Gadu: retrieve buddy public alias after adding to blist. Fixes #2188
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33344
diff changeset
436
42085
a76f1668564c Make the gadu gadu protocol plugin clean for warning level 2
Gary Kramlich <grim@reaperworld.com>
parents: 41979
diff changeset
437 static void
a76f1668564c Make the gadu gadu protocol plugin clean for warning level 2
Gary Kramlich <grim@reaperworld.com>
parents: 41979
diff changeset
438 ggp_pubdir_request_buddy_alias_got(PurpleConnection *gc, int records_count,
a76f1668564c Make the gadu gadu protocol plugin clean for warning level 2
Gary Kramlich <grim@reaperworld.com>
parents: 41979
diff changeset
439 const ggp_pubdir_record *records,
a76f1668564c Make the gadu gadu protocol plugin clean for warning level 2
Gary Kramlich <grim@reaperworld.com>
parents: 41979
diff changeset
440 G_GNUC_UNUSED int next_offset,
a76f1668564c Make the gadu gadu protocol plugin clean for warning level 2
Gary Kramlich <grim@reaperworld.com>
parents: 41979
diff changeset
441 G_GNUC_UNUSED gpointer data)
33345
740174b22496 Gadu-Gadu: retrieve buddy public alias after adding to blist. Fixes #2188
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33344
diff changeset
442 {
33351
bd15903d0d89 Gadu-Gadu: fix compilation on 64bit targets
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33348
diff changeset
443 uin_t uin;
33345
740174b22496 Gadu-Gadu: retrieve buddy public alias after adding to blist. Fixes #2188
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33344
diff changeset
444 const gchar *alias;
35355
3be5d45ba972 Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35158
diff changeset
445
35361
efdbd45604f1 Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35356
diff changeset
446 if (records_count < 0) {
33345
740174b22496 Gadu-Gadu: retrieve buddy public alias after adding to blist. Fixes #2188
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33344
diff changeset
447 purple_debug_error("gg", "ggp_pubdir_request_buddy_alias_got: "
33351
bd15903d0d89 Gadu-Gadu: fix compilation on 64bit targets
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33348
diff changeset
448 "couldn't get info for user\n");
33345
740174b22496 Gadu-Gadu: retrieve buddy public alias after adding to blist. Fixes #2188
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33344
diff changeset
449 return;
740174b22496 Gadu-Gadu: retrieve buddy public alias after adding to blist. Fixes #2188
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33344
diff changeset
450 }
33351
bd15903d0d89 Gadu-Gadu: fix compilation on 64bit targets
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33348
diff changeset
451 uin = records[0].uin;
35355
3be5d45ba972 Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35158
diff changeset
452
33345
740174b22496 Gadu-Gadu: retrieve buddy public alias after adding to blist. Fixes #2188
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33344
diff changeset
453 alias = records[0].label;
35361
efdbd45604f1 Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35356
diff changeset
454 if (!alias) {
33345
740174b22496 Gadu-Gadu: retrieve buddy public alias after adding to blist. Fixes #2188
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33344
diff changeset
455 purple_debug_info("gg", "ggp_pubdir_request_buddy_alias_got: "
740174b22496 Gadu-Gadu: retrieve buddy public alias after adding to blist. Fixes #2188
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33344
diff changeset
456 "public alias for %u is not available\n", uin);
740174b22496 Gadu-Gadu: retrieve buddy public alias after adding to blist. Fixes #2188
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33344
diff changeset
457 return;
740174b22496 Gadu-Gadu: retrieve buddy public alias after adding to blist. Fixes #2188
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33344
diff changeset
458 }
740174b22496 Gadu-Gadu: retrieve buddy public alias after adding to blist. Fixes #2188
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33344
diff changeset
459
740174b22496 Gadu-Gadu: retrieve buddy public alias after adding to blist. Fixes #2188
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33344
diff changeset
460 purple_debug_info("gg", "ggp_pubdir_request_buddy_alias_got: "
740174b22496 Gadu-Gadu: retrieve buddy public alias after adding to blist. Fixes #2188
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33344
diff changeset
461 "public alias for %u is \"%s\"\n", uin, alias);
35355
3be5d45ba972 Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35158
diff changeset
462
35499
c4c5e0a670b1 Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents: 35361
diff changeset
463 purple_serv_got_alias(gc, ggp_uin_to_str(uin), alias);
33345
740174b22496 Gadu-Gadu: retrieve buddy public alias after adding to blist. Fixes #2188
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33344
diff changeset
464 }
33346
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
465
40010
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
466 void
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
467 ggp_pubdir_request_buddy_alias(PurpleConnection *gc, PurpleBuddy *buddy)
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
468 {
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
469 uin_t uin = ggp_str_to_uin(purple_buddy_get_name(buddy));
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
470
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
471 purple_debug_info("gg", "ggp_pubdir_request_buddy_alias: %u", uin);
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
472
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
473 ggp_pubdir_get_info(gc, uin, ggp_pubdir_request_buddy_alias_got, NULL);
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
474 }
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
475
33346
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
476 /*******************************************************************************
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
477 * Searching for buddies.
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
478 ******************************************************************************/
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
479
40010
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
480 static ggp_pubdir_search_form *
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
481 ggp_pubdir_search_form_clone(const ggp_pubdir_search_form *form)
33346
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
482 {
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
483 ggp_pubdir_search_form *dup = g_new(ggp_pubdir_search_form, 1);
35355
3be5d45ba972 Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35158
diff changeset
484
33346
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
485 dup->nick = g_strdup(form->nick);
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
486 dup->city = g_strdup(form->city);
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
487 dup->gender = form->gender;
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
488 dup->offset = form->offset;
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
489 dup->limit = form->limit;
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
490
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
491 dup->display_handle = form->display_handle;
35355
3be5d45ba972 Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35158
diff changeset
492
33346
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
493 return dup;
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
494 }
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
495
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
496 static gchar * ggp_pubdir_search_make_query(const ggp_pubdir_search_form *form)
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
497 {
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
498 gchar *nick, *city, *gender;
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
499 gchar *query;
35355
3be5d45ba972 Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35158
diff changeset
500
35361
efdbd45604f1 Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35356
diff changeset
501 if (form->nick && form->nick[0] != '\0') {
33346
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
502 gchar *nick_e = g_uri_escape_string(form->nick, NULL, FALSE);
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
503 nick = g_strdup_printf("&nick=%s", nick_e);
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
504 g_free(nick_e);
35361
efdbd45604f1 Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35356
diff changeset
505 } else
33346
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
506 nick = g_strdup("");
35355
3be5d45ba972 Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35158
diff changeset
507
35361
efdbd45604f1 Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35356
diff changeset
508 if (form->city && form->city[0] != '\0') {
33346
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
509 gchar *city_e = g_uri_escape_string(form->city, NULL, FALSE);
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
510 city = g_strdup_printf("&city=%s", city_e);
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
511 g_free(city_e);
35361
efdbd45604f1 Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35356
diff changeset
512 } else
33346
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
513 city = g_strdup("");
35355
3be5d45ba972 Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35158
diff changeset
514
35361
efdbd45604f1 Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35356
diff changeset
515 if (form->gender != GGP_PUBDIR_GENDER_UNSPECIFIED) {
33346
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
516 gender = g_strdup_printf("&gender=%d",
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
517 form->gender == GGP_PUBDIR_GENDER_MALE ? 2 : 1);
35361
efdbd45604f1 Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35356
diff changeset
518 } else
33346
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
519 gender = g_strdup("");
35355
3be5d45ba972 Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35158
diff changeset
520
33346
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
521 query = g_strdup_printf("/users.xml?offset=%d&limit=%d%s%s%s",
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
522 form->offset, form->limit, nick, city, gender);
35355
3be5d45ba972 Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35158
diff changeset
523
33346
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
524 g_free(nick);
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
525 g_free(city);
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
526 g_free(gender);
35355
3be5d45ba972 Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35158
diff changeset
527
33346
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
528 return query;
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
529 }
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
530
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
531 static void ggp_pubdir_search_got_token(PurpleConnection *gc,
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
532 const gchar *token, gpointer _request)
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
533 {
40020
76afb08714b4 Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40010
diff changeset
534 GGPInfo *info = NULL;
76afb08714b4 Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40010
diff changeset
535 gchar *url;
76afb08714b4 Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40010
diff changeset
536 SoupMessage *msg;
33346
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
537 ggp_pubdir_request *request = _request;
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
538 gchar *query;
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
539
36068
e9b9320a985a Drop PURPLE_CONNECTION_IS_VALID in favor of (temporary) PURPLE_ASSERT_CONNECTION_IS_VALID
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35499
diff changeset
540 PURPLE_ASSERT_CONNECTION_IS_VALID(gc);
e9b9320a985a Drop PURPLE_CONNECTION_IS_VALID in favor of (temporary) PURPLE_ASSERT_CONNECTION_IS_VALID
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35499
diff changeset
541
e9b9320a985a Drop PURPLE_CONNECTION_IS_VALID in favor of (temporary) PURPLE_ASSERT_CONNECTION_IS_VALID
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35499
diff changeset
542 if (!token) {
33346
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
543 request->cb(gc, -1, NULL, 0, request->user_data);
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
544 ggp_pubdir_request_free(request);
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
545 return;
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
546 }
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
547
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
548 purple_debug_misc("gg", "ggp_pubdir_search_got_token\n");
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
549
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
550 query = ggp_pubdir_search_make_query(request->params.search_form);
34232
a5517f235e0f HTTP: migrate purple_util_fetch_url_request to new API for GG prpl
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33865
diff changeset
551
40020
76afb08714b4 Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40010
diff changeset
552 info = purple_connection_get_protocol_data(gc);
34232
a5517f235e0f HTTP: migrate purple_util_fetch_url_request to new API for GG prpl
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33865
diff changeset
553
40020
76afb08714b4 Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40010
diff changeset
554 url = g_strdup_printf("http://api.gadu-gadu.pl%s", query);
76afb08714b4 Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40010
diff changeset
555 msg = soup_message_new("GET", url);
41214
b0b7d118475f Use accessor for SoupMessage->request_headers
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 41212
diff changeset
556 soup_message_headers_replace(soup_message_get_request_headers(msg),
b0b7d118475f Use accessor for SoupMessage->request_headers
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 41212
diff changeset
557 "Authorization", token);
41878
64e455cfb6b4 Port some of gg to libsoup3
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41700
diff changeset
558 soup_session_send_and_read_async(info->http, msg, G_PRIORITY_DEFAULT, NULL,
64e455cfb6b4 Port some of gg to libsoup3
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41700
diff changeset
559 ggp_pubdir_got_data, request);
40020
76afb08714b4 Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40010
diff changeset
560
41878
64e455cfb6b4 Port some of gg to libsoup3
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41700
diff changeset
561 g_object_unref(msg);
40020
76afb08714b4 Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40010
diff changeset
562 g_free(url);
33346
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
563 g_free(query);
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
564 }
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
565
40010
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
566 static void
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
567 ggp_pubdir_search_execute(PurpleConnection *gc,
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
568 const ggp_pubdir_search_form *form,
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
569 ggp_pubdir_request_cb cb, void *user_data)
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
570 {
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
571 ggp_pubdir_request *request = g_new0(ggp_pubdir_request, 1);
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
572 gchar *url;
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
573 ggp_pubdir_search_form *local_form = ggp_pubdir_search_form_clone(form);
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
574 gchar *query;
33346
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
575
40010
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
576 request->type = GGP_PUBDIR_REQUEST_TYPE_SEARCH;
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
577 request->gc = gc;
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
578 request->cb = cb;
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
579 request->user_data = user_data;
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
580 request->params.search_form = local_form;
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
581
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
582 query = ggp_pubdir_search_make_query(form);
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
583 purple_debug_misc("gg", "ggp_pubdir_search_execute: %s", query);
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
584 url = g_strdup_printf("http://api.gadu-gadu.pl%s", query);
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
585 ggp_oauth_request(gc, ggp_pubdir_search_got_token, request, "GET", url);
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
586 g_free(query);
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
587 g_free(url);
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
588 }
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
589
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
590 static void
42085
a76f1668564c Make the gadu gadu protocol plugin clean for warning level 2
Gary Kramlich <grim@reaperworld.com>
parents: 41979
diff changeset
591 ggp_pubdir_search_results_new(PurpleConnection *gc, G_GNUC_UNUSED GList *row,
a76f1668564c Make the gadu gadu protocol plugin clean for warning level 2
Gary Kramlich <grim@reaperworld.com>
parents: 41979
diff changeset
592 gpointer _form)
40010
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
593 {
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
594 ggp_pubdir_search_form *form = _form;
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
595 ggp_pubdir_search(gc, form);
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
596 }
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
597
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
598 static void
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
599 ggp_pubdir_search_results_close(gpointer _form)
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
600 {
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
601 ggp_pubdir_search_form *form = _form;
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
602 ggp_pubdir_search_form_free(form);
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
603 }
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
604
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
605 static void
42085
a76f1668564c Make the gadu gadu protocol plugin clean for warning level 2
Gary Kramlich <grim@reaperworld.com>
parents: 41979
diff changeset
606 ggp_pubdir_search_results_next(PurpleConnection *gc, G_GNUC_UNUSED GList *row,
a76f1668564c Make the gadu gadu protocol plugin clean for warning level 2
Gary Kramlich <grim@reaperworld.com>
parents: 41979
diff changeset
607 gpointer _form)
40010
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
608 {
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
609 ggp_pubdir_search_form *form = _form;
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
610 ggp_pubdir_search_execute(gc, form, ggp_pubdir_search_results_display,
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
611 form);
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
612 }
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
613
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
614 static void
42085
a76f1668564c Make the gadu gadu protocol plugin clean for warning level 2
Gary Kramlich <grim@reaperworld.com>
parents: 41979
diff changeset
615 ggp_pubdir_search_results_add(PurpleConnection *gc, GList *row,
a76f1668564c Make the gadu gadu protocol plugin clean for warning level 2
Gary Kramlich <grim@reaperworld.com>
parents: 41979
diff changeset
616 G_GNUC_UNUSED gpointer form)
40010
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
617 {
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
618 purple_blist_request_add_buddy(purple_connection_get_account(gc),
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
619 g_list_nth_data(row, 0), NULL,
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
620 g_list_nth_data(row, 1));
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
621 }
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
622
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
623 static void
42085
a76f1668564c Make the gadu gadu protocol plugin clean for warning level 2
Gary Kramlich <grim@reaperworld.com>
parents: 41979
diff changeset
624 ggp_pubdir_search_results_im(PurpleConnection *gc, GList *row,
a76f1668564c Make the gadu gadu protocol plugin clean for warning level 2
Gary Kramlich <grim@reaperworld.com>
parents: 41979
diff changeset
625 G_GNUC_UNUSED gpointer form)
40010
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
626 {
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
627 purple_conversation_present(PURPLE_CONVERSATION(purple_im_conversation_new(
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
628 purple_connection_get_account(gc), g_list_nth_data(row, 0))));
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
629 }
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
630
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
631 static void
42085
a76f1668564c Make the gadu gadu protocol plugin clean for warning level 2
Gary Kramlich <grim@reaperworld.com>
parents: 41979
diff changeset
632 ggp_pubdir_search_results_info(PurpleConnection *gc, GList *row,
a76f1668564c Make the gadu gadu protocol plugin clean for warning level 2
Gary Kramlich <grim@reaperworld.com>
parents: 41979
diff changeset
633 G_GNUC_UNUSED gpointer form)
40010
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
634 {
40708
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40520
diff changeset
635 ggp_pubdir_get_info_protocol(NULL, gc, g_list_nth_data(row, 0));
40010
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
636 }
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
637
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
638 static void
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
639 ggp_pubdir_search_results_display(PurpleConnection *gc, int records_count,
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
640 const ggp_pubdir_record *records,
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
641 int next_offset, void *_form)
33346
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
642 {
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
643 ggp_pubdir_search_form *form = _form;
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
644 PurpleNotifySearchResults *results;
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
645 int i;
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
646
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
647 purple_debug_info("gg", "ggp_pubdir_search_results_display: "
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
648 "got %d records (next offset: %d)\n",
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
649 records_count, next_offset);
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
650
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
651 if (records_count < 0 ||
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
652 (records_count == 0 && form->offset != 0))
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
653 {
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
654 purple_notify_error(gc, GGP_PUBDIR_SEARCH_TITLE,
34449
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34338
diff changeset
655 _("Error while searching for buddies"), NULL,
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34338
diff changeset
656 purple_request_cpar_from_connection(gc));
33346
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
657 ggp_pubdir_search_form_free(form);
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
658 return;
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
659 }
35355
3be5d45ba972 Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35158
diff changeset
660
35361
efdbd45604f1 Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35356
diff changeset
661 if (records_count == 0) {
33346
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
662 purple_notify_info(gc, GGP_PUBDIR_SEARCH_TITLE,
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
663 _("No matching users found"),
34449
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34338
diff changeset
664 _("There are no users matching your search criteria."),
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34338
diff changeset
665 purple_request_cpar_from_connection(gc));
33346
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
666 ggp_pubdir_search_form_free(form);
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
667 return;
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
668 }
35355
3be5d45ba972 Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35158
diff changeset
669
33346
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
670 form->offset = next_offset;
35355
3be5d45ba972 Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35158
diff changeset
671
33346
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
672 results = purple_notify_searchresults_new();
35355
3be5d45ba972 Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35158
diff changeset
673
33346
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
674 purple_notify_searchresults_column_add(results,
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
675 purple_notify_searchresults_column_new(_("GG Number")));
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
676 purple_notify_searchresults_column_add(results,
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
677 purple_notify_searchresults_column_new(_("Name")));
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
678 purple_notify_searchresults_column_add(results,
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
679 purple_notify_searchresults_column_new(_("City")));
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
680 purple_notify_searchresults_column_add(results,
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
681 purple_notify_searchresults_column_new(_("Gender")));
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
682 purple_notify_searchresults_column_add(results,
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
683 purple_notify_searchresults_column_new(_("Age")));
35355
3be5d45ba972 Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35158
diff changeset
684
35361
efdbd45604f1 Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35356
diff changeset
685 for (i = 0; i < records_count; i++) {
33346
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
686 GList *row = NULL;
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
687 const ggp_pubdir_record *record = &records[i];
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
688 gchar *gender = NULL, *age = NULL;
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
689
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
690 if (record->gender == GGP_PUBDIR_GENDER_MALE)
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
691 gender = g_strdup("male");
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
692 else if (record->gender == GGP_PUBDIR_GENDER_FEMALE)
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
693 gender = g_strdup("female");
35355
3be5d45ba972 Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35158
diff changeset
694
33346
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
695 if (record->age)
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
696 age = g_strdup_printf("%d", record->age);
35355
3be5d45ba972 Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35158
diff changeset
697
33346
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
698 row = g_list_append(row, g_strdup(ggp_uin_to_str(record->uin)));
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
699 row = g_list_append(row, g_strdup(record->label));
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
700 row = g_list_append(row, g_strdup(record->city));
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
701 row = g_list_append(row, gender);
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
702 row = g_list_append(row, age);
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
703 purple_notify_searchresults_row_add(results, row);
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
704 }
35355
3be5d45ba972 Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35158
diff changeset
705
33346
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
706 purple_notify_searchresults_button_add(results,
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
707 PURPLE_NOTIFY_BUTTON_ADD, ggp_pubdir_search_results_add);
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
708 purple_notify_searchresults_button_add(results,
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
709 PURPLE_NOTIFY_BUTTON_IM, ggp_pubdir_search_results_im);
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
710 purple_notify_searchresults_button_add(results,
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
711 PURPLE_NOTIFY_BUTTON_INFO, ggp_pubdir_search_results_info);
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
712 purple_notify_searchresults_button_add_labeled(results, _("New search"),
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
713 ggp_pubdir_search_results_new);
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
714 if (next_offset != 0)
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
715 purple_notify_searchresults_button_add(results,
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
716 PURPLE_NOTIFY_BUTTON_CONTINUE,
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
717 ggp_pubdir_search_results_next);
35355
3be5d45ba972 Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35158
diff changeset
718
33346
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
719 if (!form->display_handle)
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
720 form->display_handle = purple_notify_searchresults(gc,
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
721 GGP_PUBDIR_SEARCH_TITLE, _("Search results"), NULL,
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
722 results, ggp_pubdir_search_results_close, form);
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
723 else
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
724 purple_notify_searchresults_new_rows(gc, results,
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
725 form->display_handle);
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
726 g_assert(form->display_handle);
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
727 }
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
728
40010
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
729 static void
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
730 ggp_pubdir_search_request(PurpleConnection *gc, PurpleRequestFields *fields)
33346
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
731 {
40010
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
732 ggp_pubdir_search_form *form = g_new0(ggp_pubdir_search_form, 1);
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
733
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
734 purple_debug_info("gg", "ggp_pubdir_search_request");
33346
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
735
40010
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
736 form->nick = g_strdup(purple_request_fields_get_string(fields, "name"));
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
737 form->city = g_strdup(purple_request_fields_get_string(fields, "city"));
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
738 form->gender =
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
739 GPOINTER_TO_INT(purple_request_fields_get_choice(fields, "gender"));
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
740 form->offset = 0;
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
741 form->limit = GGP_PUBDIR_SEARCH_PER_PAGE;
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
742
33346
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
743 ggp_pubdir_search_execute(gc, form, ggp_pubdir_search_results_display,
40010
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
744 form);
33346
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
745 }
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
746
40010
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
747 void
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
748 ggp_pubdir_search(PurpleConnection *gc, const ggp_pubdir_search_form *form)
33346
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
749 {
40010
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
750 PurpleRequestFields *fields;
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
751 PurpleRequestFieldGroup *group;
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
752 PurpleRequestField *field;
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
753
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
754 purple_debug_info("gg", "ggp_pubdir_search");
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
755
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
756 fields = purple_request_fields_new();
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
757 group = purple_request_field_group_new(NULL);
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
758 purple_request_fields_add_group(fields, group);
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
759
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
760 field = purple_request_field_string_new("name", _("Name"),
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
761 form ? form->nick : NULL, FALSE);
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
762 purple_request_field_group_add_field(group, field);
33346
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
763
40010
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
764 field = purple_request_field_string_new("city", _("City"),
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
765 form ? form->city : NULL, FALSE);
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
766 purple_request_field_group_add_field(group, field);
33346
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
767
40010
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
768 field = purple_request_field_choice_new(
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
769 "gender", _("Gender"), form ? GINT_TO_POINTER(form->gender) : NULL);
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
770 purple_request_field_choice_add(field, _("Male or female"), NULL);
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
771 purple_request_field_choice_add(field, _("Male"),
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
772 GINT_TO_POINTER(GGP_PUBDIR_GENDER_MALE));
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
773 purple_request_field_choice_add(field, _("Female"),
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
774 GINT_TO_POINTER(GGP_PUBDIR_GENDER_FEMALE));
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
775 purple_request_field_group_add_field(group, field);
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
776
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
777 purple_request_fields(gc, _("Find buddies"), _("Find buddies"),
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
778 _("Please, enter your search criteria below"), fields,
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
779 _("OK"), G_CALLBACK(ggp_pubdir_search_request),
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
780 _("Cancel"), NULL,
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
781 purple_request_cpar_from_connection(gc), gc);
33346
3b4cbb0e10d6 Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33345
diff changeset
782 }
33347
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
783
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
784 /*******************************************************************************
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
785 * Own profile.
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
786 ******************************************************************************/
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
787
40010
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
788 static void
41878
64e455cfb6b4 Port some of gg to libsoup3
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41700
diff changeset
789 ggp_pubdir_set_info_got_response(GObject *source, GAsyncResult *result,
64e455cfb6b4 Port some of gg to libsoup3
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41700
diff changeset
790 gpointer data)
33347
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
791 {
41878
64e455cfb6b4 Port some of gg to libsoup3
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41700
diff changeset
792 SoupMessage *msg = data;
64e455cfb6b4 Port some of gg to libsoup3
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41700
diff changeset
793 GBytes *response_body = NULL;
64e455cfb6b4 Port some of gg to libsoup3
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41700
diff changeset
794 const char *buffer = NULL;
64e455cfb6b4 Port some of gg to libsoup3
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41700
diff changeset
795 gsize size = 0;
64e455cfb6b4 Port some of gg to libsoup3
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41700
diff changeset
796 GError *error = NULL;
64e455cfb6b4 Port some of gg to libsoup3
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41700
diff changeset
797
41212
9f0f4c23132e Use accessor for SoupMessage->status_code
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40708
diff changeset
798 if (!SOUP_STATUS_IS_SUCCESSFUL(soup_message_get_status(msg))) {
40010
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
799 purple_debug_error("gg", "ggp_pubdir_set_info_got_response: failed");
41878
64e455cfb6b4 Port some of gg to libsoup3
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41700
diff changeset
800 g_object_unref(msg);
64e455cfb6b4 Port some of gg to libsoup3
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41700
diff changeset
801 return;
64e455cfb6b4 Port some of gg to libsoup3
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41700
diff changeset
802 }
64e455cfb6b4 Port some of gg to libsoup3
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41700
diff changeset
803 g_clear_object(&msg);
64e455cfb6b4 Port some of gg to libsoup3
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41700
diff changeset
804
64e455cfb6b4 Port some of gg to libsoup3
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41700
diff changeset
805 response_body = soup_session_send_and_read_finish(SOUP_SESSION(source),
64e455cfb6b4 Port some of gg to libsoup3
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41700
diff changeset
806 result, &error);
64e455cfb6b4 Port some of gg to libsoup3
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41700
diff changeset
807 if (response_body == NULL) {
64e455cfb6b4 Port some of gg to libsoup3
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41700
diff changeset
808 purple_debug_error("gg",
64e455cfb6b4 Port some of gg to libsoup3
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41700
diff changeset
809 "ggp_pubdir_set_info_got_response: failed: %s",
64e455cfb6b4 Port some of gg to libsoup3
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41700
diff changeset
810 error->message);
64e455cfb6b4 Port some of gg to libsoup3
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41700
diff changeset
811 g_error_free(error);
40010
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
812 return;
33347
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
813 }
35355
3be5d45ba972 Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35158
diff changeset
814
41878
64e455cfb6b4 Port some of gg to libsoup3
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41700
diff changeset
815 buffer = g_bytes_get_data(response_body, &size);
41883
c67c45d70006 Fix string size specifier in debug prints
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41878
diff changeset
816 purple_debug_info("gg", "ggp_pubdir_set_info_got_response: [%.*s]",
41878
64e455cfb6b4 Port some of gg to libsoup3
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41700
diff changeset
817 (int)size, buffer);
40010
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
818 /* <result><status>0</status></result> */
33347
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
819
40010
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
820 /* TODO: notify about failure */
41878
64e455cfb6b4 Port some of gg to libsoup3
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41700
diff changeset
821
64e455cfb6b4 Port some of gg to libsoup3
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41700
diff changeset
822 g_bytes_unref(response_body);
33347
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
823 }
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
824
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
825 static void ggp_pubdir_set_info_got_token(PurpleConnection *gc,
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
826 const gchar *token, gpointer _record)
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
827 {
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
828 ggp_pubdir_record *record = _record;
40020
76afb08714b4 Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40010
diff changeset
829 GGPInfo *info = NULL;
76afb08714b4 Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40010
diff changeset
830 SoupMessage *msg;
41700
9f6a2c90800e Convert soup_message_set_request to soup_message_set_request_body_from_bytes
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41214
diff changeset
831 GBytes *body = NULL;
40020
76afb08714b4 Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40010
diff changeset
832 gchar *url;
34232
a5517f235e0f HTTP: migrate purple_util_fetch_url_request to new API for GG prpl
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33865
diff changeset
833 gchar *request_data;
33347
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
834 gchar *name, *surname, *city;
40512
05663def7b82 Fix some easy compiler warnings
Gary Kramlich <grim@reaperworld.com>
parents: 40474
diff changeset
835 gchar *bday;
33347
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
836 uin_t uin = record->uin;
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
837
36068
e9b9320a985a Drop PURPLE_CONNECTION_IS_VALID in favor of (temporary) PURPLE_ASSERT_CONNECTION_IS_VALID
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35499
diff changeset
838 PURPLE_ASSERT_CONNECTION_IS_VALID(gc);
e9b9320a985a Drop PURPLE_CONNECTION_IS_VALID in favor of (temporary) PURPLE_ASSERT_CONNECTION_IS_VALID
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35499
diff changeset
839
e9b9320a985a Drop PURPLE_CONNECTION_IS_VALID in favor of (temporary) PURPLE_ASSERT_CONNECTION_IS_VALID
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35499
diff changeset
840 if (!token) {
35356
3a71df246d07 Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35355
diff changeset
841 /* TODO: notify about failure */
33347
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
842 ggp_pubdir_record_free(record, 1);
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
843 return;
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
844 }
35355
3be5d45ba972 Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35158
diff changeset
845
40020
76afb08714b4 Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40010
diff changeset
846 info = purple_connection_get_protocol_data(gc);
76afb08714b4 Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40010
diff changeset
847
33347
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
848 name = g_uri_escape_string(record->first_name, NULL, FALSE);
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
849 surname = g_uri_escape_string(record->last_name, NULL, FALSE);
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
850 city = g_uri_escape_string(record->city, NULL, FALSE);
40512
05663def7b82 Fix some easy compiler warnings
Gary Kramlich <grim@reaperworld.com>
parents: 40474
diff changeset
851 bday = g_date_time_format(record->birth, "%Y-%m-%d");
05663def7b82 Fix some easy compiler warnings
Gary Kramlich <grim@reaperworld.com>
parents: 40474
diff changeset
852
33347
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
853 request_data = g_strdup_printf(
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
854 "name=%s&"
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
855 "surname=%s&"
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
856 "birth=%sT10:00:00%%2B00:00&"
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
857 "birth_priv=2&"
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
858 "gender=%d&"
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
859 "gender_priv=2&"
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
860 "city=%s&"
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
861 "province=%d",
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
862 name, surname,
40512
05663def7b82 Fix some easy compiler warnings
Gary Kramlich <grim@reaperworld.com>
parents: 40474
diff changeset
863 bday,
33347
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
864 record->gender,
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
865 city,
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
866 record->province);
34232
a5517f235e0f HTTP: migrate purple_util_fetch_url_request to new API for GG prpl
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33865
diff changeset
867
40514
30d9cbf04922 Fix some leaks.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40512
diff changeset
868 g_free(name);
30d9cbf04922 Fix some leaks.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40512
diff changeset
869 g_free(surname);
30d9cbf04922 Fix some leaks.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40512
diff changeset
870 g_free(city);
40512
05663def7b82 Fix some easy compiler warnings
Gary Kramlich <grim@reaperworld.com>
parents: 40474
diff changeset
871 g_free(bday);
05663def7b82 Fix some easy compiler warnings
Gary Kramlich <grim@reaperworld.com>
parents: 40474
diff changeset
872
34232
a5517f235e0f HTTP: migrate purple_util_fetch_url_request to new API for GG prpl
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33865
diff changeset
873 if (purple_debug_is_verbose() && purple_debug_is_unsafe()) {
a5517f235e0f HTTP: migrate purple_util_fetch_url_request to new API for GG prpl
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33865
diff changeset
874 purple_debug_misc("gg", "ggp_pubdir_set_info_got_token: "
a5517f235e0f HTTP: migrate purple_util_fetch_url_request to new API for GG prpl
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33865
diff changeset
875 "query [%s]\n", request_data);
a5517f235e0f HTTP: migrate purple_util_fetch_url_request to new API for GG prpl
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33865
diff changeset
876 }
33347
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
877
40020
76afb08714b4 Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40010
diff changeset
878 url = g_strdup_printf("http://api.gadu-gadu.pl/users/%u.xml", uin);
76afb08714b4 Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40010
diff changeset
879 msg = soup_message_new("PUT", url);
41214
b0b7d118475f Use accessor for SoupMessage->request_headers
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 41212
diff changeset
880 soup_message_headers_replace(soup_message_get_request_headers(msg),
b0b7d118475f Use accessor for SoupMessage->request_headers
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 41212
diff changeset
881 "Authorization", token);
41700
9f6a2c90800e Convert soup_message_set_request to soup_message_set_request_body_from_bytes
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41214
diff changeset
882 body = g_bytes_new_take(request_data, strlen(request_data));
9f6a2c90800e Convert soup_message_set_request to soup_message_set_request_body_from_bytes
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41214
diff changeset
883 soup_message_set_request_body_from_bytes(msg,
9f6a2c90800e Convert soup_message_set_request to soup_message_set_request_body_from_bytes
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41214
diff changeset
884 "application/x-www-form-urlencoded",
9f6a2c90800e Convert soup_message_set_request to soup_message_set_request_body_from_bytes
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41214
diff changeset
885 body);
9f6a2c90800e Convert soup_message_set_request to soup_message_set_request_body_from_bytes
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41214
diff changeset
886 g_bytes_unref(body);
41878
64e455cfb6b4 Port some of gg to libsoup3
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41700
diff changeset
887 soup_session_send_and_read_async(info->http, msg, G_PRIORITY_DEFAULT, NULL,
64e455cfb6b4 Port some of gg to libsoup3
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41700
diff changeset
888 ggp_pubdir_set_info_got_response, msg);
33347
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
889
40020
76afb08714b4 Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40010
diff changeset
890 g_free(url);
33347
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
891 ggp_pubdir_record_free(record, 1);
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
892 }
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
893
40010
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
894 static void
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
895 ggp_pubdir_set_info_request(PurpleConnection *gc, PurpleRequestFields *fields)
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
896 {
41979
31c32b8d4bef Replace all of the deprecated account api in Gadu Gadu
Gary Kramlich <grim@reaperworld.com>
parents: 41921
diff changeset
897 PurpleAccount *account = purple_connection_get_account(gc);
31c32b8d4bef Replace all of the deprecated account api in Gadu Gadu
Gary Kramlich <grim@reaperworld.com>
parents: 41921
diff changeset
898 PurpleContactInfo *info = PURPLE_CONTACT_INFO(account);
40010
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
899 gchar *url;
41979
31c32b8d4bef Replace all of the deprecated account api in Gadu Gadu
Gary Kramlich <grim@reaperworld.com>
parents: 41921
diff changeset
900 uin_t uin = ggp_str_to_uin(purple_contact_info_get_username(info));
40010
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
901 ggp_pubdir_record *record = g_new0(ggp_pubdir_record, 1);
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
902 gchar *birth_s;
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
903
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
904 purple_debug_info("gg", "ggp_pubdir_set_info_request");
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
905
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
906 record->uin = uin;
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
907 record->first_name =
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
908 g_strdup(purple_request_fields_get_string(fields, "first_name"));
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
909 record->last_name =
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
910 g_strdup(purple_request_fields_get_string(fields, "last_name"));
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
911 record->gender =
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
912 GPOINTER_TO_INT(purple_request_fields_get_choice(fields, "gender"));
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
913 record->city = g_strdup(purple_request_fields_get_string(fields, "city"));
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
914 record->province = GPOINTER_TO_INT(
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
915 purple_request_fields_get_choice(fields, "province"));
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
916
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
917 birth_s = g_strdup_printf(
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
918 "%sT10:00:00+00:00",
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
919 purple_request_fields_get_string(fields, "birth_date"));
40512
05663def7b82 Fix some easy compiler warnings
Gary Kramlich <grim@reaperworld.com>
parents: 40474
diff changeset
920 record->birth = g_date_time_new_from_iso8601(birth_s, NULL);
40010
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
921 g_free(birth_s);
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
922 purple_debug_info("gg", "ggp_pubdir_set_info_request: birth [%lu][%s]",
40512
05663def7b82 Fix some easy compiler warnings
Gary Kramlich <grim@reaperworld.com>
parents: 40474
diff changeset
923 g_date_time_to_unix(record->birth),
40010
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
924 purple_request_fields_get_string(fields, "birth_date"));
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
925
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
926 url = g_strdup_printf("http://api.gadu-gadu.pl/users/%u.xml", uin);
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
927 ggp_oauth_request(gc, ggp_pubdir_set_info_got_token, record, "PUT", url);
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
928 g_free(url);
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
929 }
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
930
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
931 static void
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
932 ggp_pubdir_set_info_dialog(PurpleConnection *gc, int records_count,
42085
a76f1668564c Make the gadu gadu protocol plugin clean for warning level 2
Gary Kramlich <grim@reaperworld.com>
parents: 41979
diff changeset
933 const ggp_pubdir_record *records,
a76f1668564c Make the gadu gadu protocol plugin clean for warning level 2
Gary Kramlich <grim@reaperworld.com>
parents: 41979
diff changeset
934 G_GNUC_UNUSED int next_offset,
a76f1668564c Make the gadu gadu protocol plugin clean for warning level 2
Gary Kramlich <grim@reaperworld.com>
parents: 41979
diff changeset
935 G_GNUC_UNUSED gpointer data)
33347
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
936 {
40010
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
937 PurpleRequestFields *fields;
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
938 PurpleRequestFieldGroup *group;
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
939 PurpleRequestField *field;
40512
05663def7b82 Fix some easy compiler warnings
Gary Kramlich <grim@reaperworld.com>
parents: 40474
diff changeset
940 gchar *bday = NULL;
40010
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
941 gsize i;
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
942 const ggp_pubdir_record *record;
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
943
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
944 purple_debug_info("gg", "ggp_pubdir_set_info_dialog (record: %d)",
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
945 records_count);
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
946
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
947 record = (records_count == 1 ? &records[0] : NULL);
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
948
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
949 fields = purple_request_fields_new();
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
950 group = purple_request_field_group_new(NULL);
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
951 purple_request_fields_add_group(fields, group);
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
952
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
953 field = purple_request_field_string_new("first_name", _("First name"),
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
954 record ? record->first_name : NULL,
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
955 FALSE);
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
956 purple_request_field_group_add_field(group, field);
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
957
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
958 field = purple_request_field_string_new("last_name", _("Last name"),
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
959 record ? record->last_name : NULL,
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
960 FALSE);
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
961 purple_request_field_group_add_field(group, field);
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
962
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
963 field = purple_request_field_choice_new(
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
964 "gender", _("Gender"),
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
965 record ? GINT_TO_POINTER(record->gender)
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
966 : GGP_PUBDIR_GENDER_UNSPECIFIED);
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
967 purple_request_field_set_required(field, TRUE);
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
968 purple_request_field_choice_add(field, _("Male"),
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
969 GINT_TO_POINTER(GGP_PUBDIR_GENDER_MALE));
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
970 purple_request_field_choice_add(field, _("Female"),
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
971 GINT_TO_POINTER(GGP_PUBDIR_GENDER_FEMALE));
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
972 purple_request_field_group_add_field(group, field);
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
973
40512
05663def7b82 Fix some easy compiler warnings
Gary Kramlich <grim@reaperworld.com>
parents: 40474
diff changeset
974 if(record != NULL && record->birth != NULL) {
05663def7b82 Fix some easy compiler warnings
Gary Kramlich <grim@reaperworld.com>
parents: 40474
diff changeset
975 bday = g_date_time_format(record->birth, "%Y-%m-%d");
05663def7b82 Fix some easy compiler warnings
Gary Kramlich <grim@reaperworld.com>
parents: 40474
diff changeset
976 }
05663def7b82 Fix some easy compiler warnings
Gary Kramlich <grim@reaperworld.com>
parents: 40474
diff changeset
977
40010
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
978 field = purple_request_field_string_new(
40512
05663def7b82 Fix some easy compiler warnings
Gary Kramlich <grim@reaperworld.com>
parents: 40474
diff changeset
979 "birth_date", _("Birth Day"), bday,
40010
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
980 FALSE);
40512
05663def7b82 Fix some easy compiler warnings
Gary Kramlich <grim@reaperworld.com>
parents: 40474
diff changeset
981 g_free(bday);
40010
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
982 purple_request_field_set_required(field, TRUE);
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
983 purple_request_field_group_add_field(group, field);
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
984
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
985 field = purple_request_field_string_new(
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
986 "city", _("City"), record ? record->city : NULL, FALSE);
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
987 purple_request_field_group_add_field(group, field);
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
988
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
989 /* Translators: This word is basically used to describe a Polish
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
990 province. Gadu-Gadu users outside of Poland might choose to enter some
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
991 equivalent value for themselves. For example, users in the USA might
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
992 use their state (e.g. New York). If there is an equivalent term for
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
993 your language, feel free to use it. Otherwise it's probably acceptable
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
994 to leave it changed or transliterate it into your alphabet. */
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
995 field = purple_request_field_choice_new("province", _("Voivodeship"), 0);
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
996 purple_request_field_group_add_field(group, field);
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
997 for (i = 0; i < ggp_pubdir_provinces_count; i++) {
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
998 purple_request_field_choice_add(field, ggp_pubdir_provinces[i],
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
999 GINT_TO_POINTER(i));
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
1000 if (record && i == record->province) {
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
1001 purple_request_field_choice_set_value(field, GINT_TO_POINTER(i));
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
1002 purple_request_field_choice_set_default_value(field,
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
1003 GINT_TO_POINTER(i));
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
1004 }
34232
a5517f235e0f HTTP: migrate purple_util_fetch_url_request to new API for GG prpl
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33865
diff changeset
1005 }
a5517f235e0f HTTP: migrate purple_util_fetch_url_request to new API for GG prpl
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33865
diff changeset
1006
40010
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
1007 purple_request_fields(gc, _("Set User Info"), _("Set User Info"), NULL,
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
1008 fields, _("OK"),
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
1009 G_CALLBACK(ggp_pubdir_set_info_request), _("Cancel"),
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
1010 NULL, purple_request_cpar_from_connection(gc), gc);
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
1011 }
34232
a5517f235e0f HTTP: migrate purple_util_fetch_url_request to new API for GG prpl
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33865
diff changeset
1012
40010
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
1013 void
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
1014 ggp_pubdir_set_info(PurpleConnection *gc)
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
1015 {
41979
31c32b8d4bef Replace all of the deprecated account api in Gadu Gadu
Gary Kramlich <grim@reaperworld.com>
parents: 41921
diff changeset
1016 PurpleAccount *account = purple_connection_get_account(gc);
31c32b8d4bef Replace all of the deprecated account api in Gadu Gadu
Gary Kramlich <grim@reaperworld.com>
parents: 41921
diff changeset
1017 PurpleContactInfo *info = PURPLE_CONTACT_INFO(account);
31c32b8d4bef Replace all of the deprecated account api in Gadu Gadu
Gary Kramlich <grim@reaperworld.com>
parents: 41921
diff changeset
1018
40010
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
1019 ggp_pubdir_get_info(gc,
41979
31c32b8d4bef Replace all of the deprecated account api in Gadu Gadu
Gary Kramlich <grim@reaperworld.com>
parents: 41921
diff changeset
1020 ggp_str_to_uin(purple_contact_info_get_username(info)),
40010
a72915f6fb1d Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37155
diff changeset
1021 ggp_pubdir_set_info_dialog, NULL);
33347
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33346
diff changeset
1022 }

mercurial