Tue, 19 May 2020 10:29:23 +0000
Merged in default (pull request #697)
simple: Fix search for message headers
Approved-by: Gary Kramlich
|
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 | |
|
33343
09f740724036
Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
30 | #include "pubdir-prpl.h" |
|
40020
76afb08714b4
Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40010
diff
changeset
|
31 | #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
|
32 | |
|
09f740724036
Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
33 | #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
|
34 | #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
|
35 | #include "utils.h" |
|
33344
2a2560bb1445
Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33343
diff
changeset
|
36 | #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
|
37 | |
|
09f740724036
Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
38 | typedef struct |
|
09f740724036
Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
39 | { |
|
09f740724036
Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
40 | PurpleConnection *gc; |
|
09f740724036
Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
41 | 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
|
42 | void *user_data; |
|
33346
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
43 | enum |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
44 | { |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
45 | 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
|
46 | 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
|
47 | } type; |
|
33343
09f740724036
Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
48 | union |
|
09f740724036
Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
49 | { |
|
09f740724036
Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
50 | struct |
|
09f740724036
Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
51 | { |
|
09f740724036
Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
52 | 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
|
53 | } user_info; |
|
33346
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
54 | 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
|
55 | } params; |
|
09f740724036
Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
56 | } 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
|
57 | |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35355
diff
changeset
|
58 | /* Searching for buddies. */ |
|
33346
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
59 | |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
60 | #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
|
61 | #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
|
62 | |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
63 | 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
|
64 | { |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
65 | gchar *nick, *city; |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
66 | ggp_pubdir_gender gender; |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
67 | int offset; |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
68 | int limit; |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
69 | |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
70 | void *display_handle; |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
71 | }; |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
72 | |
|
40010
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
73 | /* 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
|
74 | 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
|
75 | 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
|
76 | void *user_data); |
|
33347
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
77 | |
|
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
78 | /******************************************************************************/ |
|
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
79 | |
|
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
80 | 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
|
81 | { |
|
34338
c652670afac5
Request API refactoring: custom PURPLE_REQUEST_CHOICE values, instead of indexes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34332
diff
changeset
|
82 | N_("Not specified"), |
|
33347
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
83 | "dolnośląskie", |
|
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
84 | "kujawsko-pomorskie", |
|
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
85 | "lubelskie", |
|
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
86 | "lubuskie", |
|
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
87 | "łódzkie", |
|
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
88 | "małopolskie", |
|
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
89 | "mazowieckie", |
|
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
90 | "opolskie", |
|
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
91 | "podkarpackie", |
|
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
92 | "podlaskie", |
|
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
93 | "pomorskie", |
|
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
94 | "śląskie", |
|
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
95 | "świętokrzyskie", |
|
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
96 | "warmińsko-mazurskie", |
|
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
97 | "wielkopolskie", |
|
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
98 | "zachodniopomorskie", |
|
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
99 | }; |
|
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
100 | |
|
34304
faf0414a8b51
Fix most of libpurple warnings about -Wsign-compare
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34287
diff
changeset
|
101 | 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
|
102 | |
|
33343
09f740724036
Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
103 | /******************************************************************************/ |
|
09f740724036
Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
104 | |
|
40010
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
105 | static void |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
106 | 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
|
107 | { |
|
09f740724036
Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
108 | int i; |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35356
diff
changeset
|
109 | 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
|
110 | 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
|
111 | g_free(records[i].nickname); |
|
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
112 | 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
|
113 | 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
|
114 | g_free(records[i].city); |
|
09f740724036
Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
115 | } |
|
09f740724036
Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
116 | 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
|
117 | } |
|
09f740724036
Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
118 | |
|
40010
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
119 | static void |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
120 | 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
|
121 | { |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
122 | 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
|
123 | 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
|
124 | g_free(form); |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
125 | } |
|
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 | static void |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
128 | 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
|
129 | { |
|
33346
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
130 | 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
|
131 | 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
|
132 | 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
|
133 | } |
|
09f740724036
Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
134 | |
|
40020
76afb08714b4
Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40010
diff
changeset
|
135 | static void |
|
76afb08714b4
Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40010
diff
changeset
|
136 | ggp_pubdir_got_data(G_GNUC_UNUSED SoupSession *session, SoupMessage *msg, |
|
76afb08714b4
Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40010
diff
changeset
|
137 | gpointer _request) |
|
33343
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 | ggp_pubdir_request *request = _request; |
|
09f740724036
Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
140 | PurpleConnection *gc = request->gc; |
|
09f740724036
Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
141 | 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
|
142 | PurpleXmlNode *xml; |
|
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
|
143 | const gchar *xml_raw; |
|
33346
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
144 | 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
|
145 | 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
|
146 | ggp_pubdir_record *records; |
|
09f740724036
Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
147 | |
|
40020
76afb08714b4
Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40010
diff
changeset
|
148 | xml_raw = msg->response_body->data; |
|
33343
09f740724036
Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
149 | |
|
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
|
150 | 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
|
151 | purple_debug_misc("gg", "ggp_pubdir_got_data: xml=[%s]\n", |
|
a5517f235e0f
HTTP: migrate purple_util_fetch_url_request to new API for GG prpl
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33865
diff
changeset
|
152 | xml_raw); |
|
a5517f235e0f
HTTP: migrate purple_util_fetch_url_request to new API for GG prpl
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33865
diff
changeset
|
153 | } |
|
a5517f235e0f
HTTP: migrate purple_util_fetch_url_request to new API for GG prpl
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33865
diff
changeset
|
154 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
155 | xml = purple_xmlnode_from_str(xml_raw, -1); |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35356
diff
changeset
|
156 | if (xml == NULL) { |
|
33346
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
157 | 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
|
158 | "invalid xml\n"); |
|
33346
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
159 | 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
|
160 | 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
|
161 | return; |
|
09f740724036
Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
162 | } |
|
35355
3be5d45ba972
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35158
diff
changeset
|
163 | |
|
33343
09f740724036
Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
164 | 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
|
165 | 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
|
166 | 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
|
167 | xml = purple_xmlnode_get_child(xml, "users"); |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35356
diff
changeset
|
168 | 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
|
169 | 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
|
170 | "invalid reply\n"); |
|
33346
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
171 | 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
|
172 | 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
|
173 | return; |
|
09f740724036
Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
174 | } |
|
35355
3be5d45ba972
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35158
diff
changeset
|
175 | |
|
33343
09f740724036
Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
176 | 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
|
177 | records = g_new0(ggp_pubdir_record, record_count); |
|
35355
3be5d45ba972
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35158
diff
changeset
|
178 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
179 | 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
|
180 | i = 0; |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35356
diff
changeset
|
181 | 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
|
182 | 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
|
183 | 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
|
184 | unsigned int gender = 0; |
|
33347
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
185 | const gchar *uin_s; |
|
35355
3be5d45ba972
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35158
diff
changeset
|
186 | |
|
33343
09f740724036
Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
187 | g_assert(i <= record_count); |
|
35355
3be5d45ba972
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35158
diff
changeset
|
188 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
189 | 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
|
190 | if (record->uin == 0) |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
191 | 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
|
192 | if (record->uin == 0) |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
193 | 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
|
194 | " invalid uin\n"); |
|
33347
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
195 | uin_s = ggp_uin_to_str(record->uin); |
|
35355
3be5d45ba972
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35158
diff
changeset
|
196 | |
|
33347
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
197 | 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
|
198 | 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
|
199 | 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
|
200 | 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
|
201 | 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
|
202 | 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
|
203 | 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
|
204 | 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
|
205 | ggp_xml_get_uint(xml, "province", &record->province); |
|
35355
3be5d45ba972
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35158
diff
changeset
|
206 | |
|
33347
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
207 | 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
|
208 | 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
|
209 | 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
|
210 | 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
|
211 | 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
|
212 | record->last_name = ggp_free_if_equal(record->last_name, ""); |
|
35355
3be5d45ba972
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35158
diff
changeset
|
213 | |
|
33347
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
214 | if (record->label) {} |
|
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
215 | else if (record->nickname) |
|
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
216 | 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
|
217 | 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
|
218 | 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
|
219 | 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
|
220 | else if (record->first_name) |
|
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
221 | 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
|
222 | else if (record->last_name) |
|
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
223 | 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
|
224 | if (record->label) |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
225 | g_strstrip(record->label); |
|
33347
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
226 | if (record->nickname) |
|
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
227 | g_strstrip(record->nickname); |
|
35355
3be5d45ba972
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35158
diff
changeset
|
228 | |
|
33343
09f740724036
Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
229 | 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
|
230 | 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
|
231 | 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
|
232 | 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
|
233 | else |
|
09f740724036
Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
234 | record->gender = GGP_PUBDIR_GENDER_UNSPECIFIED; |
|
35355
3be5d45ba972
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35158
diff
changeset
|
235 | |
|
33343
09f740724036
Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
236 | 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
|
237 | 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
|
238 | if (record->city) |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
239 | g_strstrip(record->city); |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35356
diff
changeset
|
240 | if (!record->city) { |
|
33346
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
241 | g_free(record->city); |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
242 | record->city = NULL; |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
243 | } |
|
35355
3be5d45ba972
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35158
diff
changeset
|
244 | |
|
33347
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
245 | record->birth = ggp_date_from_iso8601(birth_s); |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35355
diff
changeset
|
246 | /*TODO: calculate age from birth */ |
|
35355
3be5d45ba972
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35158
diff
changeset
|
247 | |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35355
diff
changeset
|
248 | if (purple_debug_is_verbose()) { |
|
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35355
diff
changeset
|
249 | purple_debug_misc("gg", "ggp_pubdir_got_data: [uin:%d] " |
|
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35355
diff
changeset
|
250 | "[label:%s] [nick:%s] [first name:%s] " |
|
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35355
diff
changeset
|
251 | "[last name:%s] [city:%s] [gender:%d] [age:%d] " |
|
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35355
diff
changeset
|
252 | "[birth:%lu]\n", record->uin, record->label, |
|
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35355
diff
changeset
|
253 | record->nickname, record->first_name, |
|
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35355
diff
changeset
|
254 | record->last_name, record->city, record->gender, |
|
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35355
diff
changeset
|
255 | record->age, record->birth); |
|
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35355
diff
changeset
|
256 | } |
|
35355
3be5d45ba972
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35158
diff
changeset
|
257 | |
|
33343
09f740724036
Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
258 | g_free(city); |
|
35355
3be5d45ba972
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35158
diff
changeset
|
259 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
260 | 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
|
261 | } |
|
35355
3be5d45ba972
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35158
diff
changeset
|
262 | |
|
33346
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
263 | 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
|
264 | |
|
33343
09f740724036
Gadu-Gadu: extended OAuth support, initial support for gg10.5 public directory
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
265 | 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
|
266 | 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
|
267 | } |
|
33344
2a2560bb1445
Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33343
diff
changeset
|
268 | |
|
40010
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
269 | static void |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
270 | 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
|
271 | gpointer _request) |
|
33344
2a2560bb1445
Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33343
diff
changeset
|
272 | { |
|
40020
76afb08714b4
Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40010
diff
changeset
|
273 | GGPInfo *info = NULL; |
|
76afb08714b4
Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40010
diff
changeset
|
274 | gchar *url; |
|
76afb08714b4
Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40010
diff
changeset
|
275 | SoupMessage *msg; |
|
40010
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
276 | 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
|
277 | |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
278 | 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
|
279 | |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
280 | if (!token) { |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
281 | 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
|
282 | 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
|
283 | return; |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
284 | } |
|
33351
bd15903d0d89
Gadu-Gadu: fix compilation on 64bit targets
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33348
diff
changeset
|
285 | |
|
40020
76afb08714b4
Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40010
diff
changeset
|
286 | info = purple_connection_get_protocol_data(gc); |
|
76afb08714b4
Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40010
diff
changeset
|
287 | |
|
76afb08714b4
Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40010
diff
changeset
|
288 | 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
|
289 | request->params.user_info.uin); |
|
76afb08714b4
Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40010
diff
changeset
|
290 | msg = soup_message_new("GET", url); |
|
76afb08714b4
Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40010
diff
changeset
|
291 | g_free(url); |
|
76afb08714b4
Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40010
diff
changeset
|
292 | soup_message_headers_replace(msg->request_headers, "Authorization", token); |
|
76afb08714b4
Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40010
diff
changeset
|
293 | soup_session_queue_message(info->http, msg, ggp_pubdir_got_data, request); |
|
40010
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
294 | } |
|
33344
2a2560bb1445
Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33343
diff
changeset
|
295 | |
|
40010
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
296 | void |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
297 | 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
|
298 | void *user_data) |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
299 | { |
|
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 *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
|
301 | gchar *url; |
|
33344
2a2560bb1445
Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33343
diff
changeset
|
302 | |
|
40010
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
303 | 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
|
304 | request->gc = gc; |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
305 | request->cb = cb; |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
306 | 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
|
307 | 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
|
308 | |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
309 | 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
|
310 | 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
|
311 | g_free(url); |
|
33344
2a2560bb1445
Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33343
diff
changeset
|
312 | } |
|
2a2560bb1445
Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33343
diff
changeset
|
313 | |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
34878
diff
changeset
|
314 | static void ggp_pubdir_get_info_protocol_got(PurpleConnection *gc, |
|
33346
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
315 | int records_count, const ggp_pubdir_record *records, int next_offset, |
|
33351
bd15903d0d89
Gadu-Gadu: fix compilation on 64bit targets
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33348
diff
changeset
|
316 | void *_uin_p) |
|
33344
2a2560bb1445
Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33343
diff
changeset
|
317 | { |
|
33351
bd15903d0d89
Gadu-Gadu: fix compilation on 64bit targets
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33348
diff
changeset
|
318 | 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
|
319 | 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
|
320 | 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
|
321 | PurpleBuddy *buddy; |
|
35355
3be5d45ba972
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35158
diff
changeset
|
322 | |
|
33351
bd15903d0d89
Gadu-Gadu: fix compilation on 64bit targets
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33348
diff
changeset
|
323 | g_free(_uin_p); |
|
35355
3be5d45ba972
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35158
diff
changeset
|
324 | |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35356
diff
changeset
|
325 | if (records_count < 1) { |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
34878
diff
changeset
|
326 | 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
|
327 | "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
|
328 | 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
|
329 | _("Cannot get user information")); |
|
2a2560bb1445
Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33343
diff
changeset
|
330 | 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
|
331 | NULL, NULL); |
|
2a2560bb1445
Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33343
diff
changeset
|
332 | 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
|
333 | return; |
|
2a2560bb1445
Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33343
diff
changeset
|
334 | } |
|
35355
3be5d45ba972
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35158
diff
changeset
|
335 | |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
34878
diff
changeset
|
336 | 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
|
337 | 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
|
338 | g_assert(records_count == 1); |
|
35355
3be5d45ba972
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35158
diff
changeset
|
339 | |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34701
diff
changeset
|
340 | 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
|
341 | ggp_uin_to_str(uin)); |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35356
diff
changeset
|
342 | if (buddy) { |
|
33344
2a2560bb1445
Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33343
diff
changeset
|
343 | const char *alias; |
|
2a2560bb1445
Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33343
diff
changeset
|
344 | PurpleStatus *status; |
|
2a2560bb1445
Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33343
diff
changeset
|
345 | gchar *status_message; |
|
35355
3be5d45ba972
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35158
diff
changeset
|
346 | |
|
33344
2a2560bb1445
Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33343
diff
changeset
|
347 | 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
|
348 | if (alias) |
|
2a2560bb1445
Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33343
diff
changeset
|
349 | 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
|
350 | _("Alias"), alias); |
|
35355
3be5d45ba972
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35158
diff
changeset
|
351 | |
|
33344
2a2560bb1445
Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33343
diff
changeset
|
352 | 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
|
353 | 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
|
354 | 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
|
355 | 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
|
356 | purple_status_get_name(status)); |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35356
diff
changeset
|
357 | if (status_message) { |
|
33344
2a2560bb1445
Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33343
diff
changeset
|
358 | 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
|
359 | _("Message"), status_message); |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35356
diff
changeset
|
360 | } |
|
33344
2a2560bb1445
Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33343
diff
changeset
|
361 | } |
|
35355
3be5d45ba972
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35158
diff
changeset
|
362 | |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35356
diff
changeset
|
363 | if (record->nickname) { |
|
33347
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
364 | 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
|
365 | _("Nickname"), record->nickname); |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35356
diff
changeset
|
366 | } |
|
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35356
diff
changeset
|
367 | if (record->first_name) { |
|
33347
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
368 | 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
|
369 | _("First name"), record->first_name); |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35356
diff
changeset
|
370 | } |
|
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35356
diff
changeset
|
371 | if (record->last_name) { |
|
33347
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
372 | 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
|
373 | _("Last name"), record->last_name); |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35356
diff
changeset
|
374 | } |
|
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35356
diff
changeset
|
375 | 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
|
376 | 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
|
377 | 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
|
378 | _("Female") : _("Male")); |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35356
diff
changeset
|
379 | } |
|
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35356
diff
changeset
|
380 | if (record->city) { |
|
33344
2a2560bb1445
Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33343
diff
changeset
|
381 | 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
|
382 | record->city); |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35356
diff
changeset
|
383 | } |
|
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35356
diff
changeset
|
384 | if (record->birth) { |
|
33344
2a2560bb1445
Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33343
diff
changeset
|
385 | purple_notify_user_info_add_pair_plaintext(info, _("Birthday"), |
|
33347
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
386 | ggp_date_strftime("%Y-%m-%d", record->birth)); |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35356
diff
changeset
|
387 | } 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
|
388 | 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
|
389 | 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
|
390 | age_s); |
|
2a2560bb1445
Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33343
diff
changeset
|
391 | g_free(age_s); |
|
2a2560bb1445
Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33343
diff
changeset
|
392 | } |
|
35355
3be5d45ba972
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35158
diff
changeset
|
393 | |
|
33344
2a2560bb1445
Gadu-Gadu: getting user information with gg10.5 API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33343
diff
changeset
|
394 | 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
|
395 | 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
|
396 | } |
|
33345
740174b22496
Gadu-Gadu: retrieve buddy public alias after adding to blist. Fixes #2188
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33344
diff
changeset
|
397 | |
|
40010
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
398 | void |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
399 | ggp_pubdir_get_info_protocol(PurpleConnection *gc, const char *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
|
400 | { |
|
40010
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
401 | 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
|
402 | 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
|
403 | |
|
40010
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
404 | *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
|
405 | |
|
40010
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
406 | 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
|
407 | |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
408 | 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
|
409 | } |
|
740174b22496
Gadu-Gadu: retrieve buddy public alias after adding to blist. Fixes #2188
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33344
diff
changeset
|
410 | |
|
740174b22496
Gadu-Gadu: retrieve buddy public alias after adding to blist. Fixes #2188
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33344
diff
changeset
|
411 | static void ggp_pubdir_request_buddy_alias_got(PurpleConnection *gc, |
|
33346
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
412 | int records_count, const ggp_pubdir_record *records, int next_offset, |
|
33351
bd15903d0d89
Gadu-Gadu: fix compilation on 64bit targets
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33348
diff
changeset
|
413 | void *user_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
|
414 | { |
|
33351
bd15903d0d89
Gadu-Gadu: fix compilation on 64bit targets
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33348
diff
changeset
|
415 | 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
|
416 | const gchar *alias; |
|
35355
3be5d45ba972
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35158
diff
changeset
|
417 | |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35356
diff
changeset
|
418 | 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
|
419 | 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
|
420 | "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
|
421 | return; |
|
740174b22496
Gadu-Gadu: retrieve buddy public alias after adding to blist. Fixes #2188
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33344
diff
changeset
|
422 | } |
|
33351
bd15903d0d89
Gadu-Gadu: fix compilation on 64bit targets
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33348
diff
changeset
|
423 | uin = records[0].uin; |
|
35355
3be5d45ba972
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35158
diff
changeset
|
424 | |
|
33345
740174b22496
Gadu-Gadu: retrieve buddy public alias after adding to blist. Fixes #2188
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33344
diff
changeset
|
425 | alias = records[0].label; |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35356
diff
changeset
|
426 | 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
|
427 | 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
|
428 | "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
|
429 | return; |
|
740174b22496
Gadu-Gadu: retrieve buddy public alias after adding to blist. Fixes #2188
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33344
diff
changeset
|
430 | } |
|
740174b22496
Gadu-Gadu: retrieve buddy public alias after adding to blist. Fixes #2188
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33344
diff
changeset
|
431 | |
|
740174b22496
Gadu-Gadu: retrieve buddy public alias after adding to blist. Fixes #2188
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33344
diff
changeset
|
432 | 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
|
433 | "public alias for %u is \"%s\"\n", uin, alias); |
|
35355
3be5d45ba972
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35158
diff
changeset
|
434 | |
|
35499
c4c5e0a670b1
Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents:
35361
diff
changeset
|
435 | 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
|
436 | } |
|
33346
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
437 | |
|
40010
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
438 | void |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
439 | 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
|
440 | { |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
441 | 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
|
442 | |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
443 | 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
|
444 | |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
445 | 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
|
446 | } |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
447 | |
|
33346
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
448 | /******************************************************************************* |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
449 | * Searching for buddies. |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
450 | ******************************************************************************/ |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
451 | |
|
40010
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
452 | 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
|
453 | 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
|
454 | { |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
455 | 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
|
456 | |
|
33346
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
457 | 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
|
458 | 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
|
459 | dup->gender = form->gender; |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
460 | dup->offset = form->offset; |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
461 | dup->limit = form->limit; |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
462 | |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
463 | dup->display_handle = form->display_handle; |
|
35355
3be5d45ba972
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35158
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 | return dup; |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
466 | } |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
467 | |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
468 | 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
|
469 | { |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
470 | gchar *nick, *city, *gender; |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
471 | gchar *query; |
|
35355
3be5d45ba972
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35158
diff
changeset
|
472 | |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35356
diff
changeset
|
473 | 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
|
474 | 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
|
475 | 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
|
476 | g_free(nick_e); |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35356
diff
changeset
|
477 | } else |
|
33346
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
478 | nick = g_strdup(""); |
|
35355
3be5d45ba972
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35158
diff
changeset
|
479 | |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35356
diff
changeset
|
480 | 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
|
481 | 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
|
482 | 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
|
483 | g_free(city_e); |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35356
diff
changeset
|
484 | } else |
|
33346
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
485 | city = g_strdup(""); |
|
35355
3be5d45ba972
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35158
diff
changeset
|
486 | |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35356
diff
changeset
|
487 | 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
|
488 | 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
|
489 | 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
|
490 | } else |
|
33346
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
491 | gender = g_strdup(""); |
|
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 | 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
|
494 | form->offset, form->limit, nick, city, gender); |
|
35355
3be5d45ba972
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35158
diff
changeset
|
495 | |
|
33346
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
496 | g_free(nick); |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
497 | g_free(city); |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
498 | g_free(gender); |
|
35355
3be5d45ba972
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35158
diff
changeset
|
499 | |
|
33346
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
500 | return query; |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
501 | } |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
502 | |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
503 | 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
|
504 | 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
|
505 | { |
|
40020
76afb08714b4
Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40010
diff
changeset
|
506 | GGPInfo *info = NULL; |
|
76afb08714b4
Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40010
diff
changeset
|
507 | gchar *url; |
|
76afb08714b4
Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40010
diff
changeset
|
508 | SoupMessage *msg; |
|
33346
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
509 | 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
|
510 | gchar *query; |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
511 | |
|
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
|
512 | 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
|
513 | |
|
e9b9320a985a
Drop PURPLE_CONNECTION_IS_VALID in favor of (temporary) PURPLE_ASSERT_CONNECTION_IS_VALID
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35499
diff
changeset
|
514 | if (!token) { |
|
33346
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
515 | 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
|
516 | 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
|
517 | return; |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
518 | } |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
519 | |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
520 | 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
|
521 | |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
522 | 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
|
523 | |
|
40020
76afb08714b4
Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40010
diff
changeset
|
524 | 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
|
525 | |
|
40020
76afb08714b4
Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40010
diff
changeset
|
526 | 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
|
527 | msg = soup_message_new("GET", url); |
|
76afb08714b4
Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40010
diff
changeset
|
528 | soup_message_headers_replace(msg->request_headers, "Authorization", token); |
|
76afb08714b4
Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40010
diff
changeset
|
529 | soup_session_queue_message(info->http, msg, ggp_pubdir_got_data, request); |
|
76afb08714b4
Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40010
diff
changeset
|
530 | |
|
76afb08714b4
Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40010
diff
changeset
|
531 | g_free(url); |
|
33346
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
532 | g_free(query); |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
533 | } |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
534 | |
|
40010
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
535 | static void |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
536 | 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
|
537 | 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
|
538 | 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
|
539 | { |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
540 | 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
|
541 | gchar *url; |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
542 | 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
|
543 | gchar *query; |
|
33346
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
544 | |
|
40010
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
545 | 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
|
546 | request->gc = gc; |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
547 | request->cb = cb; |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
548 | 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
|
549 | 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
|
550 | |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
551 | 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
|
552 | 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
|
553 | 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
|
554 | 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
|
555 | g_free(query); |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
556 | g_free(url); |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
557 | } |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
558 | |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
559 | static void |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
560 | ggp_pubdir_search_results_new(PurpleConnection *gc, GList *row, gpointer _form) |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
561 | { |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
562 | 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
|
563 | 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
|
564 | } |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
565 | |
|
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_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
|
568 | { |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
569 | 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
|
570 | 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
|
571 | } |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
572 | |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
573 | static void |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
574 | ggp_pubdir_search_results_next(PurpleConnection *gc, GList *row, gpointer _form) |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
575 | { |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
576 | 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
|
577 | 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
|
578 | form); |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
579 | } |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
580 | |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
581 | static void |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
582 | ggp_pubdir_search_results_add(PurpleConnection *gc, GList *row, gpointer _form) |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
583 | { |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
584 | 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
|
585 | 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
|
586 | 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
|
587 | } |
|
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 | static void |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
590 | ggp_pubdir_search_results_im(PurpleConnection *gc, GList *row, gpointer _form) |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
591 | { |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
592 | 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
|
593 | 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
|
594 | } |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
595 | |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
596 | static void |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
597 | ggp_pubdir_search_results_info(PurpleConnection *gc, GList *row, gpointer _form) |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
598 | { |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
599 | ggp_pubdir_get_info_protocol(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
|
600 | } |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
601 | |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
602 | static void |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
603 | 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
|
604 | 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
|
605 | 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
|
606 | { |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
607 | 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
|
608 | PurpleNotifySearchResults *results; |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
609 | int i; |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
610 | |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
611 | 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
|
612 | "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
|
613 | records_count, next_offset); |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
614 | |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
615 | if (records_count < 0 || |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
616 | (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
|
617 | { |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
618 | 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
|
619 | _("Error while searching for buddies"), NULL, |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34338
diff
changeset
|
620 | 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
|
621 | 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
|
622 | return; |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
623 | } |
|
35355
3be5d45ba972
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35158
diff
changeset
|
624 | |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35356
diff
changeset
|
625 | 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
|
626 | 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
|
627 | _("No matching users found"), |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34338
diff
changeset
|
628 | _("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
|
629 | 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
|
630 | 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
|
631 | return; |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
632 | } |
|
35355
3be5d45ba972
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35158
diff
changeset
|
633 | |
|
33346
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
634 | form->offset = next_offset; |
|
35355
3be5d45ba972
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35158
diff
changeset
|
635 | |
|
33346
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
636 | results = purple_notify_searchresults_new(); |
|
35355
3be5d45ba972
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35158
diff
changeset
|
637 | |
|
33346
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
638 | 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
|
639 | 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
|
640 | 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
|
641 | 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
|
642 | 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
|
643 | 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
|
644 | 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
|
645 | 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
|
646 | 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
|
647 | purple_notify_searchresults_column_new(_("Age"))); |
|
35355
3be5d45ba972
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35158
diff
changeset
|
648 | |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35356
diff
changeset
|
649 | 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
|
650 | GList *row = NULL; |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
651 | 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
|
652 | 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
|
653 | |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
654 | 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
|
655 | gender = g_strdup("male"); |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
656 | 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
|
657 | gender = g_strdup("female"); |
|
35355
3be5d45ba972
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35158
diff
changeset
|
658 | |
|
33346
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
659 | if (record->age) |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
660 | age = g_strdup_printf("%d", record->age); |
|
35355
3be5d45ba972
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35158
diff
changeset
|
661 | |
|
33346
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
662 | 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
|
663 | 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
|
664 | 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
|
665 | 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
|
666 | 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
|
667 | 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
|
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 | 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
|
671 | 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
|
672 | 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
|
673 | 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
|
674 | 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
|
675 | 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
|
676 | 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
|
677 | 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
|
678 | if (next_offset != 0) |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
679 | 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
|
680 | PURPLE_NOTIFY_BUTTON_CONTINUE, |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
681 | ggp_pubdir_search_results_next); |
|
35355
3be5d45ba972
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35158
diff
changeset
|
682 | |
|
33346
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
683 | if (!form->display_handle) |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
684 | 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
|
685 | 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
|
686 | 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
|
687 | else |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
688 | 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
|
689 | form->display_handle); |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
690 | 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
|
691 | } |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
692 | |
|
40010
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
693 | static void |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
694 | 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
|
695 | { |
|
40010
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
696 | 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
|
697 | |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
698 | 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
|
699 | |
|
40010
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
700 | 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
|
701 | 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
|
702 | form->gender = |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
703 | 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
|
704 | form->offset = 0; |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
705 | 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
|
706 | |
|
33346
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
707 | 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
|
708 | form); |
|
33346
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
709 | } |
|
3b4cbb0e10d6
Gadu-Gadu: public directory search with gg10.5 api
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33345
diff
changeset
|
710 | |
|
40010
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
711 | void |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
712 | 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
|
713 | { |
|
40010
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
714 | PurpleRequestFields *fields; |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
715 | PurpleRequestFieldGroup *group; |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
716 | PurpleRequestField *field; |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
717 | |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
718 | 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
|
719 | |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
720 | 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
|
721 | 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
|
722 | 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
|
723 | |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
724 | 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
|
725 | 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
|
726 | 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
|
727 | |
|
40010
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
728 | 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
|
729 | 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
|
730 | 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
|
731 | |
|
40010
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
732 | 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
|
733 | "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
|
734 | 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
|
735 | 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
|
736 | 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
|
737 | 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
|
738 | 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
|
739 | 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
|
740 | |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
741 | 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
|
742 | _("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
|
743 | _("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
|
744 | _("Cancel"), NULL, |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
745 | 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
|
746 | } |
|
33347
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
747 | |
|
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
748 | /******************************************************************************* |
|
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
749 | * Own profile. |
|
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
750 | ******************************************************************************/ |
|
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
751 | |
|
40010
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
752 | static void |
|
40020
76afb08714b4
Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40010
diff
changeset
|
753 | ggp_pubdir_set_info_got_response(G_GNUC_UNUSED SoupSession *session, |
|
76afb08714b4
Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40010
diff
changeset
|
754 | SoupMessage *msg, gpointer user_data) |
|
33347
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
755 | { |
|
40020
76afb08714b4
Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40010
diff
changeset
|
756 | if (!SOUP_STATUS_IS_SUCCESSFUL(msg->status_code)) { |
|
40010
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
757 | purple_debug_error("gg", "ggp_pubdir_set_info_got_response: failed"); |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
758 | return; |
|
33347
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
759 | } |
|
35355
3be5d45ba972
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35158
diff
changeset
|
760 | |
|
40010
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
761 | purple_debug_info("gg", "ggp_pubdir_set_info_got_response: [%s]", |
|
40020
76afb08714b4
Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40010
diff
changeset
|
762 | msg->response_body->data); |
|
40010
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
763 | /* <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
|
764 | |
|
40010
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
765 | /* TODO: notify about failure */ |
|
33347
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
766 | } |
|
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
767 | |
|
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
768 | 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
|
769 | const gchar *token, gpointer _record) |
|
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
770 | { |
|
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
771 | ggp_pubdir_record *record = _record; |
|
40020
76afb08714b4
Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40010
diff
changeset
|
772 | GGPInfo *info = NULL; |
|
76afb08714b4
Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40010
diff
changeset
|
773 | SoupMessage *msg; |
|
76afb08714b4
Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40010
diff
changeset
|
774 | 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
|
775 | gchar *request_data; |
|
33347
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
776 | gchar *name, *surname, *city; |
|
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
777 | uin_t uin = record->uin; |
|
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
778 | |
|
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
|
779 | 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
|
780 | |
|
e9b9320a985a
Drop PURPLE_CONNECTION_IS_VALID in favor of (temporary) PURPLE_ASSERT_CONNECTION_IS_VALID
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35499
diff
changeset
|
781 | if (!token) { |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35355
diff
changeset
|
782 | /* TODO: notify about failure */ |
|
33347
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
783 | 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
|
784 | return; |
|
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
785 | } |
|
35355
3be5d45ba972
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35158
diff
changeset
|
786 | |
|
40020
76afb08714b4
Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40010
diff
changeset
|
787 | info = purple_connection_get_protocol_data(gc); |
|
76afb08714b4
Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40010
diff
changeset
|
788 | |
|
33347
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
789 | 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
|
790 | 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
|
791 | city = g_uri_escape_string(record->city, NULL, FALSE); |
|
35355
3be5d45ba972
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35158
diff
changeset
|
792 | |
|
33347
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
793 | request_data = g_strdup_printf( |
|
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
794 | "name=%s&" |
|
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
795 | "surname=%s&" |
|
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
796 | "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
|
797 | "birth_priv=2&" |
|
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
798 | "gender=%d&" |
|
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
799 | "gender_priv=2&" |
|
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
800 | "city=%s&" |
|
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
801 | "province=%d", |
|
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
802 | name, surname, |
|
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
803 | ggp_date_strftime("%Y-%m-%d", record->birth), |
|
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
804 | record->gender, |
|
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
805 | city, |
|
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
806 | 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
|
807 | |
|
a5517f235e0f
HTTP: migrate purple_util_fetch_url_request to new API for GG prpl
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33865
diff
changeset
|
808 | 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
|
809 | 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
|
810 | "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
|
811 | } |
|
33347
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
812 | |
|
40020
76afb08714b4
Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40010
diff
changeset
|
813 | 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
|
814 | msg = soup_message_new("PUT", url); |
|
76afb08714b4
Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40010
diff
changeset
|
815 | soup_message_headers_replace(msg->request_headers, "Authorization", token); |
|
76afb08714b4
Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40010
diff
changeset
|
816 | soup_message_set_request(msg, "application/x-www-form-urlencoded", |
|
76afb08714b4
Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40010
diff
changeset
|
817 | SOUP_MEMORY_TAKE, request_data, -1); |
|
76afb08714b4
Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40010
diff
changeset
|
818 | soup_session_queue_message(info->http, msg, |
|
76afb08714b4
Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40010
diff
changeset
|
819 | ggp_pubdir_set_info_got_response, NULL); |
|
33347
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
820 | |
|
40020
76afb08714b4
Convert GG pubdir to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40010
diff
changeset
|
821 | g_free(url); |
|
33347
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
822 | 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
|
823 | } |
|
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
824 | |
|
40010
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
825 | static void |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
826 | 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
|
827 | { |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
828 | gchar *url; |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
829 | uin_t uin = ggp_str_to_uin( |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
830 | purple_account_get_username(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
|
831 | 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
|
832 | gchar *birth_s; |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
833 | |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
834 | 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
|
835 | |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
836 | record->uin = uin; |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
837 | record->first_name = |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
838 | 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
|
839 | record->last_name = |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
840 | 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
|
841 | record->gender = |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
842 | 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
|
843 | 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
|
844 | 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
|
845 | 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
|
846 | |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
847 | 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
|
848 | "%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
|
849 | 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
|
850 | record->birth = ggp_date_from_iso8601(birth_s); |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
851 | 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
|
852 | purple_debug_info("gg", "ggp_pubdir_set_info_request: birth [%lu][%s]", |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
853 | record->birth, |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
854 | 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
|
855 | |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
856 | 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
|
857 | 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
|
858 | g_free(url); |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
859 | } |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
860 | |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
861 | static void |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
862 | ggp_pubdir_set_info_dialog(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
|
863 | const ggp_pubdir_record *records, int next_offset, |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
864 | void *user_data) |
|
33347
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33346
diff
changeset
|
865 | { |
|
40010
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
866 | PurpleRequestFields *fields; |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
867 | PurpleRequestFieldGroup *group; |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
868 | PurpleRequestField *field; |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
869 | gsize i; |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
870 | 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
|
871 | |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
872 | 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
|
873 | records_count); |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
874 | |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
875 | 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
|
876 | |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
877 | 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
|
878 | 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
|
879 | 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
|
880 | |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
881 | 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
|
882 | 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
|
883 | FALSE); |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
884 | 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
|
885 | |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
886 | 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
|
887 | 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
|
888 | FALSE); |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
889 | 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
|
890 | |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
891 | 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
|
892 | "gender", _("Gender"), |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
893 | 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
|
894 | : 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
|
895 | 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
|
896 | 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
|
897 | 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
|
898 | 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
|
899 | 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
|
900 | 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
|
901 | |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
902 | 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
|
903 | "birth_date", _("Birth Day"), |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
904 | (record && record->birth) |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
905 | ? ggp_date_strftime("%Y-%m-%d", record->birth) |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
906 | : NULL, |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
907 | FALSE); |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
908 | 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
|
909 | 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
|
910 | |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
911 | 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
|
912 | "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
|
913 | 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
|
914 | |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
915 | /* 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
|
916 | 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
|
917 | 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
|
918 | 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
|
919 | 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
|
920 | 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
|
921 | 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
|
922 | 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
|
923 | 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
|
924 | 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
|
925 | 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
|
926 | 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
|
927 | 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
|
928 | 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
|
929 | 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
|
930 | } |
|
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
|
931 | } |
|
a5517f235e0f
HTTP: migrate purple_util_fetch_url_request to new API for GG prpl
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33865
diff
changeset
|
932 | |
|
40010
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
933 | 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
|
934 | fields, _("OK"), |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
935 | 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
|
936 | 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
|
937 | } |
|
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
|
938 | |
|
40010
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
939 | void |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
940 | 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
|
941 | { |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
942 | ggp_pubdir_get_info(gc, |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
943 | ggp_str_to_uin(purple_account_get_username( |
|
a72915f6fb1d
Re-arrange GG pubdir-prpl file to avoid prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37155
diff
changeset
|
944 | 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
|
945 | 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
|
946 | } |