Tue, 07 Jan 2014 19:02:19 +0100
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
|
33348
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33335
diff
changeset
|
1 | /* purple |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33335
diff
changeset
|
2 | * |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33335
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:
33335
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:
33335
diff
changeset
|
5 | * source distribution. |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33335
diff
changeset
|
6 | * |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33335
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:
33335
diff
changeset
|
8 | * by Tomek Wasilczyk (http://www.wasilczyk.pl). |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33335
diff
changeset
|
9 | * |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33335
diff
changeset
|
10 | * Previously implemented by: |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33335
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:
33335
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:
33335
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:
33335
diff
changeset
|
14 | * |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33335
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:
33335
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:
33335
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:
33335
diff
changeset
|
18 | * (at your option) any later version. |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33335
diff
changeset
|
19 | * |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33335
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:
33335
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:
33335
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:
33335
diff
changeset
|
23 | * GNU General Public License for more details. |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33335
diff
changeset
|
24 | * |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33335
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:
33335
diff
changeset
|
26 | * along with this program; if not, write to the Free Software |
|
34356
5d59fd4d5b2d
Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33348
diff
changeset
|
27 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
33348
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33335
diff
changeset
|
28 | */ |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33335
diff
changeset
|
29 | |
|
33335
a6356adbe365
Gadu-Gadu: initial multilogon support (2)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
30 | #include "multilogon.h" |
|
a6356adbe365
Gadu-Gadu: initial multilogon support (2)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
31 | |
|
a6356adbe365
Gadu-Gadu: initial multilogon support (2)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
32 | #include <debug.h> |
|
a6356adbe365
Gadu-Gadu: initial multilogon support (2)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
33 | |
|
a6356adbe365
Gadu-Gadu: initial multilogon support (2)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
34 | #include "gg.h" |
|
35144
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
35 | #include "keymapper.h" |
|
34356
5d59fd4d5b2d
Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33348
diff
changeset
|
36 | #include "utils.h" |
|
5d59fd4d5b2d
Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33348
diff
changeset
|
37 | #include "message-prpl.h" |
|
33335
a6356adbe365
Gadu-Gadu: initial multilogon support (2)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
38 | |
|
35144
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
39 | typedef struct |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
40 | { |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
41 | uint64_t id; |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
42 | uint32_t remote_addr; |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
43 | gchar *name; |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
44 | time_t logon_time; |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
45 | } ggp_multilogon_session_info; |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
46 | |
|
33335
a6356adbe365
Gadu-Gadu: initial multilogon support (2)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
47 | struct _ggp_multilogon_session_data |
|
a6356adbe365
Gadu-Gadu: initial multilogon support (2)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
48 | { |
|
a6356adbe365
Gadu-Gadu: initial multilogon support (2)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
49 | int session_count; |
|
35144
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
50 | ggp_multilogon_session_info *sessions; |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
51 | PurpleRequestDatasheet *sheet_handle; |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
52 | gpointer dialog_handle; |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
53 | ggp_keymapper *sid_mapper; |
|
33335
a6356adbe365
Gadu-Gadu: initial multilogon support (2)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
54 | }; |
|
a6356adbe365
Gadu-Gadu: initial multilogon support (2)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
55 | |
|
a6356adbe365
Gadu-Gadu: initial multilogon support (2)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
56 | static inline ggp_multilogon_session_data * |
|
a6356adbe365
Gadu-Gadu: initial multilogon support (2)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
57 | ggp_multilogon_get_mldata(PurpleConnection *gc); |
|
a6356adbe365
Gadu-Gadu: initial multilogon support (2)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
58 | |
|
a6356adbe365
Gadu-Gadu: initial multilogon support (2)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
59 | //////////// |
|
a6356adbe365
Gadu-Gadu: initial multilogon support (2)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
60 | |
|
a6356adbe365
Gadu-Gadu: initial multilogon support (2)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
61 | static inline ggp_multilogon_session_data * |
|
a6356adbe365
Gadu-Gadu: initial multilogon support (2)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
62 | ggp_multilogon_get_mldata(PurpleConnection *gc) |
|
a6356adbe365
Gadu-Gadu: initial multilogon support (2)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
63 | { |
|
a6356adbe365
Gadu-Gadu: initial multilogon support (2)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
64 | GGPInfo *accdata = purple_connection_get_protocol_data(gc); |
|
a6356adbe365
Gadu-Gadu: initial multilogon support (2)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
65 | return accdata->multilogon_data; |
|
a6356adbe365
Gadu-Gadu: initial multilogon support (2)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
66 | } |
|
a6356adbe365
Gadu-Gadu: initial multilogon support (2)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
67 | |
|
35144
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
68 | void |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
69 | ggp_multilogon_setup(PurpleConnection *gc) |
|
33335
a6356adbe365
Gadu-Gadu: initial multilogon support (2)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
70 | { |
|
a6356adbe365
Gadu-Gadu: initial multilogon support (2)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
71 | GGPInfo *accdata = purple_connection_get_protocol_data(gc); |
|
35144
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
72 | |
|
34356
5d59fd4d5b2d
Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33348
diff
changeset
|
73 | ggp_multilogon_session_data *mldata = |
|
5d59fd4d5b2d
Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33348
diff
changeset
|
74 | g_new0(ggp_multilogon_session_data, 1); |
|
33335
a6356adbe365
Gadu-Gadu: initial multilogon support (2)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
75 | accdata->multilogon_data = mldata; |
|
35144
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
76 | |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
77 | mldata->sid_mapper = ggp_keymapper_new(); |
|
33335
a6356adbe365
Gadu-Gadu: initial multilogon support (2)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
78 | } |
|
a6356adbe365
Gadu-Gadu: initial multilogon support (2)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
79 | |
|
35144
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
80 | static void |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
81 | ggp_multilogon_free_sessions(PurpleConnection *gc) |
|
33335
a6356adbe365
Gadu-Gadu: initial multilogon support (2)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
82 | { |
|
a6356adbe365
Gadu-Gadu: initial multilogon support (2)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
83 | ggp_multilogon_session_data *mldata = ggp_multilogon_get_mldata(gc); |
|
35144
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
84 | int i; |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
85 | |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
86 | for (i = 0; i < mldata->session_count; i++) |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
87 | g_free(mldata->sessions[i].name); |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
88 | g_free(mldata->sessions); |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
89 | |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
90 | mldata->sessions = NULL; |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
91 | mldata->session_count = 0; |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
92 | } |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
93 | |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
94 | void |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
95 | ggp_multilogon_cleanup(PurpleConnection *gc) |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
96 | { |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
97 | ggp_multilogon_session_data *mldata = ggp_multilogon_get_mldata(gc); |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
98 | |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
99 | if (mldata->dialog_handle) { |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
100 | purple_request_close(PURPLE_REQUEST_FIELDS, |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
101 | mldata->dialog_handle); |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
102 | mldata->dialog_handle = NULL; |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
103 | } |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
104 | |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
105 | ggp_multilogon_free_sessions(gc); |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
106 | ggp_keymapper_free(mldata->sid_mapper); |
|
33335
a6356adbe365
Gadu-Gadu: initial multilogon support (2)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
107 | g_free(mldata); |
|
a6356adbe365
Gadu-Gadu: initial multilogon support (2)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
108 | } |
|
a6356adbe365
Gadu-Gadu: initial multilogon support (2)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
109 | |
|
35144
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
110 | static uint64_t |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
111 | ggp_multilogon_sid_from_libgadu(gg_multilogon_id_t lsid) |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
112 | { |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
113 | uint64_t sid; |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
114 | |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
115 | memcpy(&sid, lsid.id, sizeof(uint64_t)); |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
116 | |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
117 | return sid; |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
118 | } |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
119 | |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
120 | static gg_multilogon_id_t |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
121 | ggp_multilogon_sid_to_libgadu(uint64_t sid) |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
122 | { |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
123 | gg_multilogon_id_t lsid; |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
124 | |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
125 | memcpy(lsid.id, &sid, sizeof(uint64_t)); |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
126 | |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
127 | return lsid; |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
128 | } |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
129 | |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
130 | void |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
131 | ggp_multilogon_fill_sessions(PurpleRequestDatasheet *sheet, |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
132 | PurpleConnection *gc) |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
133 | { |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
134 | ggp_multilogon_session_data *mldata = ggp_multilogon_get_mldata(gc); |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
135 | ggp_keymapper *km = mldata->sid_mapper; |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
136 | int i; |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
137 | |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
138 | purple_request_datasheet_record_mark_all_for_rem(sheet); |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
139 | |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
140 | for (i = 0; i < mldata->session_count; i++) { |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
141 | ggp_multilogon_session_info *sess = &mldata->sessions[i]; |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
142 | PurpleRequestDatasheetRecord *rec; |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
143 | |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
144 | rec = purple_request_datasheet_record_add(sheet, |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
145 | ggp_keymapper_to_key(km, sess->id)); |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
146 | |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
147 | purple_request_datasheet_record_set_string_data(rec, 0, |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
148 | ggp_ipv4_to_str(sess->remote_addr)); |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
149 | purple_request_datasheet_record_set_string_data(rec, 1, |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
150 | purple_date_format_full(localtime(&sess->logon_time))); |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
151 | purple_request_datasheet_record_set_string_data(rec, 2, |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
152 | sess->name); |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
153 | } |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
154 | |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
155 | purple_request_datasheet_record_remove_marked(sheet); |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
156 | } |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
157 | |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
158 | void |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
159 | ggp_multilogon_info(PurpleConnection *gc, struct gg_event_multilogon_info *info) |
|
33335
a6356adbe365
Gadu-Gadu: initial multilogon support (2)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
160 | { |
|
a6356adbe365
Gadu-Gadu: initial multilogon support (2)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
161 | ggp_multilogon_session_data *mldata = ggp_multilogon_get_mldata(gc); |
|
a6356adbe365
Gadu-Gadu: initial multilogon support (2)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
162 | int i; |
|
35144
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
163 | |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
164 | ggp_multilogon_free_sessions(gc); |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
165 | |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
166 | purple_debug_info("gg", "ggp_multilogon_info: session list changed " |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
167 | "(count now: %d)\n", info->count); |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
168 | |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
169 | mldata->sessions = g_new(ggp_multilogon_session_info, info->count); |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
170 | for (i = 0; i < info->count; i++) { |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
171 | struct gg_multilogon_session *lsess = &info->sessions[i]; |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
172 | ggp_multilogon_session_info *psess = &mldata->sessions[i]; |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
173 | |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
174 | psess->id = ggp_multilogon_sid_from_libgadu(lsess->id); |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
175 | psess->remote_addr = lsess->remote_addr; |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
176 | psess->name = g_strdup(lsess->name); |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
177 | psess->logon_time = lsess->logon_time; |
|
33335
a6356adbe365
Gadu-Gadu: initial multilogon support (2)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
178 | } |
|
a6356adbe365
Gadu-Gadu: initial multilogon support (2)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
179 | |
|
a6356adbe365
Gadu-Gadu: initial multilogon support (2)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
180 | mldata->session_count = info->count; |
|
35144
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
181 | |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
182 | if (mldata->sheet_handle != NULL) |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
183 | ggp_multilogon_fill_sessions(mldata->sheet_handle, gc); |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
184 | } |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
185 | |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
186 | void |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
187 | ggp_multilogon_disconnect(PurpleRequestDatasheetRecord *rec, gpointer _gc) |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
188 | { |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
189 | PurpleConnection *gc = _gc; |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
190 | ggp_multilogon_session_data *mldata = ggp_multilogon_get_mldata(gc); |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
191 | GGPInfo *accdata = purple_connection_get_protocol_data(gc); |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
192 | uint64_t sid; |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
193 | gpointer key; |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
194 | |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
195 | key = purple_request_datasheet_record_get_key(rec); |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
196 | sid = ggp_keymapper_from_key(mldata->sid_mapper, key); |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
197 | |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
198 | gg_multilogon_disconnect(accdata->session, |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
199 | ggp_multilogon_sid_to_libgadu(sid)); |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
200 | |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
201 | purple_request_datasheet_record_remove( |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
202 | purple_request_datasheet_record_get_datasheet(rec), key); |
|
33335
a6356adbe365
Gadu-Gadu: initial multilogon support (2)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
203 | } |
|
a6356adbe365
Gadu-Gadu: initial multilogon support (2)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
204 | |
|
35144
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
205 | void |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
206 | ggp_multilogon_dialog(PurpleConnection *gc) |
|
33335
a6356adbe365
Gadu-Gadu: initial multilogon support (2)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
207 | { |
|
a6356adbe365
Gadu-Gadu: initial multilogon support (2)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
208 | ggp_multilogon_session_data *mldata = ggp_multilogon_get_mldata(gc); |
|
35144
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
209 | PurpleRequestField *field; |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
210 | PurpleRequestFields *fields; |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
211 | PurpleRequestFieldGroup *group; |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
212 | PurpleRequestCommonParameters *cpar; |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
213 | PurpleRequestDatasheet *sheet; |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
214 | PurpleRequestDatasheetAction *action; |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
215 | gpointer dialog_handle; |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
216 | |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
217 | if (mldata->dialog_handle != NULL) |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
218 | return; |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
219 | |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
220 | fields = purple_request_fields_new(); |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
221 | group = purple_request_field_group_new(NULL); |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
222 | purple_request_fields_add_group(fields, group); |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
223 | |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
224 | sheet = purple_request_datasheet_new(); |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
225 | purple_request_datasheet_add_column(sheet, |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
226 | PURPLE_REQUEST_DATASHEET_COLUMN_STRING, _("IP")); |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
227 | purple_request_datasheet_add_column(sheet, |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
228 | PURPLE_REQUEST_DATASHEET_COLUMN_STRING, _("Logon time")); |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
229 | purple_request_datasheet_add_column(sheet, |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
230 | PURPLE_REQUEST_DATASHEET_COLUMN_STRING, _("Session")); |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
231 | |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
232 | action = purple_request_datasheet_action_new(); |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
233 | purple_request_datasheet_action_set_label(action, _("Disconnect")); |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
234 | purple_request_datasheet_action_set_cb(action, |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
235 | ggp_multilogon_disconnect, gc); |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
236 | purple_request_datasheet_add_action(sheet, action); |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
237 | ggp_multilogon_fill_sessions(sheet, gc); |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
238 | |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
239 | field = purple_request_field_datasheet_new("sessions", NULL, sheet); |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
240 | purple_request_field_group_add_field(group, field); |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
241 | |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
242 | cpar = purple_request_cpar_new(); |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
243 | purple_request_cpar_set_icon(cpar, PURPLE_REQUEST_ICON_DIALOG); |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
244 | |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
245 | dialog_handle = purple_request_fields(gc, |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
246 | _("Other Gadu-Gadu sessions"), NULL, NULL, fields, |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
247 | NULL, NULL, _("Close"), NULL, |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
248 | cpar, NULL); |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
249 | mldata->sheet_handle = sheet; |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
250 | mldata->dialog_handle = dialog_handle; |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
251 | |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
252 | purple_request_add_close_notify(dialog_handle, |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
253 | purple_callback_set_zero, &mldata->sheet_handle); |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
254 | purple_request_add_close_notify(dialog_handle, |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35139
diff
changeset
|
255 | purple_callback_set_zero, &mldata->dialog_handle); |
|
33335
a6356adbe365
Gadu-Gadu: initial multilogon support (2)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
256 | } |