Mon, 23 Oct 2023 22:08:37 -0500
Create PurpleIdleManager for managing idle states
Testing Done:
Ran the unit tests
Bugs closed: PIDGIN-17818
Reviewed at https://reviews.imfreedom.org/r/2586/
|
20147
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
20137
diff
changeset
|
1 | /* pidgin |
| 9709 | 2 | * |
|
15931
716b5fac1895
Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@pidgin.im>
parents:
15906
diff
changeset
|
3 | * Pidgin is the legal property of its developers, whose names are too numerous |
| 9709 | 4 | * to list here. Please refer to the COPYRIGHT file distributed with this |
| 5 | * source distribution. | |
| 6 | * | |
| 7 | * This program is free software; you can redistribute it and/or modify | |
| 8 | * it under the terms of the GNU General Public License as published by | |
| 9 | * the Free Software Foundation; either version 2 of the License, or | |
| 10 | * (at your option) any later version. | |
| 11 | * | |
| 12 | * This program is distributed in the hope that it will be useful, | |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 15 | * GNU General Public License for more details. | |
| 16 | * | |
| 17 | * You should have received a copy of the GNU General Public License | |
| 18 | * along with this program; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19693
diff
changeset
|
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 9709 | 20 | */ |
|
24569
5dbd0617a27d
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@pidgin.im>
parents:
24541
diff
changeset
|
21 | |
|
40439
e9838d634d5e
Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents:
40360
diff
changeset
|
22 | #ifdef HAVE_CONFIG_H |
|
e9838d634d5e
Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents:
40360
diff
changeset
|
23 | # include <config.h> |
|
e9838d634d5e
Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents:
40360
diff
changeset
|
24 | #endif |
|
e9838d634d5e
Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents:
40360
diff
changeset
|
25 | |
|
e9838d634d5e
Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents:
40360
diff
changeset
|
26 | #include <glib/gi18n-lib.h> |
|
e9838d634d5e
Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents:
40360
diff
changeset
|
27 | |
|
40523
9bcf96663cb9
Make gstreamer-1.0 a required dependency
Gary Kramlich <grim@reaperworld.com>
parents:
40496
diff
changeset
|
28 | #include <gst/gst.h> |
|
9bcf96663cb9
Make gstreamer-1.0 a required dependency
Gary Kramlich <grim@reaperworld.com>
parents:
40496
diff
changeset
|
29 | |
|
40360
e21f3bbcc2a5
Update all of the pidgin code to include purple.h
Gary Kramlich <grim@reaperworld.com>
parents:
40240
diff
changeset
|
30 | #include <purple.h> |
| 9709 | 31 | |
|
12232
857f087ec86b
[gaim-migrate @ 14534]
Richard Laager <rlaager@pidgin.im>
parents:
12122
diff
changeset
|
32 | #include "gtkblist.h" |
|
42347
d768e30362a4
Fix some random include issues
Gary Kramlich <grim@reaperworld.com>
parents:
42342
diff
changeset
|
33 | #include "gtkconv.h" |
| 9709 | 34 | #include "gtkdialogs.h" |
| 35 | #include "gtkutils.h" | |
|
40496
6941fece679b
phase2 of pidgin.h: move existing file to pidgincore.h
Gary Kramlich <grim@reaperworld.com>
parents:
40490
diff
changeset
|
36 | #include "pidgincore.h" |
| 9709 | 37 | |
|
9730
e59812364b8b
[gaim-migrate @ 10591]
Mark Doliner <markdoliner@pidgin.im>
parents:
9728
diff
changeset
|
38 | static void |
|
42128
118067ca0367
Convert PurpleRequestPage into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42127
diff
changeset
|
39 | pidgin_dialogs_im_cb(G_GNUC_UNUSED gpointer data, PurpleRequestPage *page) { |
| 15884 | 40 | PurpleAccount *account; |
|
9730
e59812364b8b
[gaim-migrate @ 10591]
Mark Doliner <markdoliner@pidgin.im>
parents:
9728
diff
changeset
|
41 | const char *username; |
| 9709 | 42 | |
|
42128
118067ca0367
Convert PurpleRequestPage into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42127
diff
changeset
|
43 | account = purple_request_page_get_account(page, "account"); |
|
118067ca0367
Convert PurpleRequestPage into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42127
diff
changeset
|
44 | username = purple_request_page_get_string(page, "screenname"); |
| 9709 | 45 | |
|
16263
27e0ef0f38e6
Word on the street is that we don't want things named pidginfoo_bar(), but
Richard Laager <rlaager@pidgin.im>
parents:
16254
diff
changeset
|
46 | pidgin_dialogs_im_with_user(account, username); |
| 9709 | 47 | } |
| 48 | ||
|
33213
2852fbde4722
Validation for Request API; use it in 'new IM' dialog.
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33170
diff
changeset
|
49 | static gboolean |
|
42159
1a481edc6307
Fix new request warning in New IM dialog
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42149
diff
changeset
|
50 | pidgin_dialogs_im_name_validator(PurpleRequestField *field, char **errmsg, |
|
1a481edc6307
Fix new request warning in New IM dialog
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42149
diff
changeset
|
51 | gpointer data) |
|
33213
2852fbde4722
Validation for Request API; use it in 'new IM' dialog.
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33170
diff
changeset
|
52 | { |
|
42159
1a481edc6307
Fix new request warning in New IM dialog
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42149
diff
changeset
|
53 | PurpleRequestFieldAccount *account_field = data; |
|
33213
2852fbde4722
Validation for Request API; use it in 'new IM' dialog.
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33170
diff
changeset
|
54 | PurpleAccount *account; |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
55 | PurpleProtocol *protocol; |
|
33213
2852fbde4722
Validation for Request API; use it in 'new IM' dialog.
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33170
diff
changeset
|
56 | const char *username; |
|
40240
4adf32217c85
Fix a warning when opening the new IM dialog.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
57 | gboolean valid = FALSE; |
|
33213
2852fbde4722
Validation for Request API; use it in 'new IM' dialog.
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33170
diff
changeset
|
58 | |
|
42159
1a481edc6307
Fix new request warning in New IM dialog
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42149
diff
changeset
|
59 | account = purple_request_field_account_get_value(account_field); |
|
40803
0e11ce1049b2
Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents:
40533
diff
changeset
|
60 | protocol = purple_account_get_protocol(account); |
|
42159
1a481edc6307
Fix new request warning in New IM dialog
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42149
diff
changeset
|
61 | username = purple_request_field_string_get_value(PURPLE_REQUEST_FIELD_STRING(field)); |
|
33213
2852fbde4722
Validation for Request API; use it in 'new IM' dialog.
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33170
diff
changeset
|
62 | |
|
40240
4adf32217c85
Fix a warning when opening the new IM dialog.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
63 | if (username) { |
|
4adf32217c85
Fix a warning when opening the new IM dialog.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
64 | valid = purple_validate(protocol, username); |
|
4adf32217c85
Fix a warning when opening the new IM dialog.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
65 | } |
|
33219
06b19630bdb0
Validation for Request API fixes
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33213
diff
changeset
|
66 | |
|
06b19630bdb0
Validation for Request API fixes
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33213
diff
changeset
|
67 | if (errmsg && !valid) |
|
06b19630bdb0
Validation for Request API fixes
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33213
diff
changeset
|
68 | *errmsg = g_strdup(_("Invalid username")); |
|
06b19630bdb0
Validation for Request API fixes
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33213
diff
changeset
|
69 | |
|
06b19630bdb0
Validation for Request API fixes
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33213
diff
changeset
|
70 | return valid; |
|
33213
2852fbde4722
Validation for Request API; use it in 'new IM' dialog.
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33170
diff
changeset
|
71 | } |
|
2852fbde4722
Validation for Request API; use it in 'new IM' dialog.
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33170
diff
changeset
|
72 | |
|
9730
e59812364b8b
[gaim-migrate @ 10591]
Mark Doliner <markdoliner@pidgin.im>
parents:
9728
diff
changeset
|
73 | void |
|
16263
27e0ef0f38e6
Word on the street is that we don't want things named pidginfoo_bar(), but
Richard Laager <rlaager@pidgin.im>
parents:
16254
diff
changeset
|
74 | pidgin_dialogs_im(void) |
| 9709 | 75 | { |
|
42128
118067ca0367
Convert PurpleRequestPage into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42127
diff
changeset
|
76 | PurpleRequestPage *page; |
|
42127
18acb99a0fa6
Convert PurpleRequestGroup into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41947
diff
changeset
|
77 | PurpleRequestGroup *group; |
|
42159
1a481edc6307
Fix new request warning in New IM dialog
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42149
diff
changeset
|
78 | PurpleRequestField *username_field = NULL; |
|
1a481edc6307
Fix new request warning in New IM dialog
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42149
diff
changeset
|
79 | PurpleRequestField *account_field = NULL; |
| 9709 | 80 | |
|
42128
118067ca0367
Convert PurpleRequestPage into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42127
diff
changeset
|
81 | page = purple_request_page_new(); |
| 9709 | 82 | |
|
42127
18acb99a0fa6
Convert PurpleRequestGroup into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41947
diff
changeset
|
83 | group = purple_request_group_new(NULL); |
|
42128
118067ca0367
Convert PurpleRequestPage into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42127
diff
changeset
|
84 | purple_request_page_add_group(page, group); |
| 9709 | 85 | |
|
42159
1a481edc6307
Fix new request warning in New IM dialog
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42149
diff
changeset
|
86 | account_field = purple_request_field_account_new("account", _("_Account"), |
|
1a481edc6307
Fix new request warning in New IM dialog
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42149
diff
changeset
|
87 | NULL); |
|
1a481edc6307
Fix new request warning in New IM dialog
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42149
diff
changeset
|
88 | purple_request_field_set_type_hint(account_field, "account"); |
|
1a481edc6307
Fix new request warning in New IM dialog
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42149
diff
changeset
|
89 | purple_request_field_set_visible(account_field, |
| 15884 | 90 | (purple_connections_get_all() != NULL && |
| 91 | purple_connections_get_all()->next != NULL)); | |
|
42159
1a481edc6307
Fix new request warning in New IM dialog
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42149
diff
changeset
|
92 | purple_request_field_set_required(account_field, TRUE); |
|
1a481edc6307
Fix new request warning in New IM dialog
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42149
diff
changeset
|
93 | purple_request_group_add_field(group, account_field); |
|
1a481edc6307
Fix new request warning in New IM dialog
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42149
diff
changeset
|
94 | |
|
1a481edc6307
Fix new request warning in New IM dialog
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42149
diff
changeset
|
95 | purple_request_field_set_validator(username_field, |
|
1a481edc6307
Fix new request warning in New IM dialog
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42149
diff
changeset
|
96 | pidgin_dialogs_im_name_validator, |
|
1a481edc6307
Fix new request warning in New IM dialog
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42149
diff
changeset
|
97 | account_field, NULL); |
|
9730
e59812364b8b
[gaim-migrate @ 10591]
Mark Doliner <markdoliner@pidgin.im>
parents:
9728
diff
changeset
|
98 | |
|
42365
45ce6d3f6386
Create PidginAccountRow which subclasses AdwRow
Gary Kramlich <grim@reaperworld.com>
parents:
42357
diff
changeset
|
99 | username_field = purple_request_field_string_new("screenname", _("_Name"), |
|
45ce6d3f6386
Create PidginAccountRow which subclasses AdwRow
Gary Kramlich <grim@reaperworld.com>
parents:
42357
diff
changeset
|
100 | NULL, FALSE); |
|
45ce6d3f6386
Create PidginAccountRow which subclasses AdwRow
Gary Kramlich <grim@reaperworld.com>
parents:
42357
diff
changeset
|
101 | purple_request_field_set_type_hint(username_field, "screenname"); |
|
45ce6d3f6386
Create PidginAccountRow which subclasses AdwRow
Gary Kramlich <grim@reaperworld.com>
parents:
42357
diff
changeset
|
102 | purple_request_field_set_required(username_field, TRUE); |
|
45ce6d3f6386
Create PidginAccountRow which subclasses AdwRow
Gary Kramlich <grim@reaperworld.com>
parents:
42357
diff
changeset
|
103 | purple_request_group_add_field(group, username_field); |
|
45ce6d3f6386
Create PidginAccountRow which subclasses AdwRow
Gary Kramlich <grim@reaperworld.com>
parents:
42357
diff
changeset
|
104 | |
|
39665
2172e3b8eeef
Rename some buddy list accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39603
diff
changeset
|
105 | purple_request_fields( |
|
2172e3b8eeef
Rename some buddy list accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39603
diff
changeset
|
106 | purple_blist_get_default(), _("New Instant Message"), NULL, |
|
2172e3b8eeef
Rename some buddy list accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39603
diff
changeset
|
107 | _("Please enter the username or alias of the person " |
|
2172e3b8eeef
Rename some buddy list accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39603
diff
changeset
|
108 | "you would like to IM."), |
|
42128
118067ca0367
Convert PurpleRequestPage into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42127
diff
changeset
|
109 | page, _("OK"), G_CALLBACK(pidgin_dialogs_im_cb), _("Cancel"), |
|
39665
2172e3b8eeef
Rename some buddy list accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39603
diff
changeset
|
110 | NULL, NULL, NULL); |
| 9709 | 111 | } |
| 112 | ||
|
9730
e59812364b8b
[gaim-migrate @ 10591]
Mark Doliner <markdoliner@pidgin.im>
parents:
9728
diff
changeset
|
113 | void |
|
16263
27e0ef0f38e6
Word on the street is that we don't want things named pidginfoo_bar(), but
Richard Laager <rlaager@pidgin.im>
parents:
16254
diff
changeset
|
114 | pidgin_dialogs_im_with_user(PurpleAccount *account, const char *username) |
| 9709 | 115 | { |
|
40885
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40803
diff
changeset
|
116 | PurpleConversation *im; |
|
40952
53fa03701534
Port Pidgin to the new PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
117 | PurpleConversationManager *manager; |
| 9709 | 118 | |
|
9753
5951fd24250e
[gaim-migrate @ 10620]
Mark Doliner <markdoliner@pidgin.im>
parents:
9730
diff
changeset
|
119 | g_return_if_fail(account != NULL); |
|
5951fd24250e
[gaim-migrate @ 10620]
Mark Doliner <markdoliner@pidgin.im>
parents:
9730
diff
changeset
|
120 | g_return_if_fail(username != NULL); |
|
5951fd24250e
[gaim-migrate @ 10620]
Mark Doliner <markdoliner@pidgin.im>
parents:
9730
diff
changeset
|
121 | |
|
40952
53fa03701534
Port Pidgin to the new PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
122 | manager = purple_conversation_manager_get_default(); |
|
53fa03701534
Port Pidgin to the new PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
123 | im = purple_conversation_manager_find_im(manager, account, username); |
| 9709 | 124 | |
|
40952
53fa03701534
Port Pidgin to the new PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
125 | if(!PURPLE_IS_IM_CONVERSATION(im)) { |
|
34662
f14347f38e3b
Refactor the remaining pidgin to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34627
diff
changeset
|
126 | im = purple_im_conversation_new(account, username); |
|
40952
53fa03701534
Port Pidgin to the new PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
127 | } |
|
12295
b81286b6bc54
[gaim-migrate @ 14599]
Luke Schierer <lschiere@pidgin.im>
parents:
12288
diff
changeset
|
128 | |
|
40885
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40803
diff
changeset
|
129 | pidgin_conv_attach_to_conversation(im); |
|
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40803
diff
changeset
|
130 | purple_conversation_present(im); |
| 9709 | 131 | } |
| 132 | ||
| 133 | static void | |
|
42128
118067ca0367
Convert PurpleRequestPage into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42127
diff
changeset
|
134 | pidgin_dialogs_info_cb(G_GNUC_UNUSED gpointer data, PurpleRequestPage *page) { |
| 9709 | 135 | char *username; |
| 15884 | 136 | PurpleAccount *account; |
|
41529
0e835d051f5c
Update gtkdialogs.c for GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41106
diff
changeset
|
137 | const gchar *screenname = NULL; |
| 9709 | 138 | |
|
42128
118067ca0367
Convert PurpleRequestPage into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42127
diff
changeset
|
139 | account = purple_request_page_get_account(page, "account"); |
| 9709 | 140 | |
|
42128
118067ca0367
Convert PurpleRequestPage into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42127
diff
changeset
|
141 | screenname = purple_request_page_get_string(page, "screenname"); |
|
41529
0e835d051f5c
Update gtkdialogs.c for GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41106
diff
changeset
|
142 | username = g_strdup(purple_normalize(account, screenname)); |
| 9709 | 143 | |
|
41529
0e835d051f5c
Update gtkdialogs.c for GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41106
diff
changeset
|
144 | if(username != NULL && *username != '\0' && account != NULL) { |
|
0e835d051f5c
Update gtkdialogs.c for GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41106
diff
changeset
|
145 | pidgin_retrieve_user_info(purple_account_get_connection(account), |
|
0e835d051f5c
Update gtkdialogs.c for GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41106
diff
changeset
|
146 | username); |
|
40125
a7acc7b00d79
Replace purple_str_has_{prefix,suffix} by g_str_has_{prefix,suffix}.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40064
diff
changeset
|
147 | } |
| 9709 | 148 | |
| 149 | g_free(username); | |
| 150 | } | |
| 151 | ||
| 152 | void | |
|
16263
27e0ef0f38e6
Word on the street is that we don't want things named pidginfoo_bar(), but
Richard Laager <rlaager@pidgin.im>
parents:
16254
diff
changeset
|
153 | pidgin_dialogs_info(void) |
| 9709 | 154 | { |
|
42128
118067ca0367
Convert PurpleRequestPage into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42127
diff
changeset
|
155 | PurpleRequestPage *page; |
|
42127
18acb99a0fa6
Convert PurpleRequestGroup into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41947
diff
changeset
|
156 | PurpleRequestGroup *group; |
| 15884 | 157 | PurpleRequestField *field; |
| 9709 | 158 | |
|
42128
118067ca0367
Convert PurpleRequestPage into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42127
diff
changeset
|
159 | page = purple_request_page_new(); |
| 9709 | 160 | |
|
42127
18acb99a0fa6
Convert PurpleRequestGroup into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41947
diff
changeset
|
161 | group = purple_request_group_new(NULL); |
|
42128
118067ca0367
Convert PurpleRequestPage into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42127
diff
changeset
|
162 | purple_request_page_add_group(page, group); |
| 9709 | 163 | |
| 15884 | 164 | field = purple_request_field_account_new("account", _("_Account"), NULL); |
| 165 | purple_request_field_set_type_hint(field, "account"); | |
| 166 | purple_request_field_set_visible(field, | |
| 167 | (purple_connections_get_all() != NULL && | |
| 168 | purple_connections_get_all()->next != NULL)); | |
| 169 | purple_request_field_set_required(field, TRUE); | |
|
42127
18acb99a0fa6
Convert PurpleRequestGroup into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41947
diff
changeset
|
170 | purple_request_group_add_field(group, field); |
| 9709 | 171 | |
|
42365
45ce6d3f6386
Create PidginAccountRow which subclasses AdwRow
Gary Kramlich <grim@reaperworld.com>
parents:
42357
diff
changeset
|
172 | field = purple_request_field_string_new("screenname", _("_Name"), NULL, FALSE); |
|
45ce6d3f6386
Create PidginAccountRow which subclasses AdwRow
Gary Kramlich <grim@reaperworld.com>
parents:
42357
diff
changeset
|
173 | purple_request_field_set_type_hint(field, "screenname"); |
|
45ce6d3f6386
Create PidginAccountRow which subclasses AdwRow
Gary Kramlich <grim@reaperworld.com>
parents:
42357
diff
changeset
|
174 | purple_request_field_set_required(field, TRUE); |
|
45ce6d3f6386
Create PidginAccountRow which subclasses AdwRow
Gary Kramlich <grim@reaperworld.com>
parents:
42357
diff
changeset
|
175 | purple_request_group_add_field(group, field); |
|
45ce6d3f6386
Create PidginAccountRow which subclasses AdwRow
Gary Kramlich <grim@reaperworld.com>
parents:
42357
diff
changeset
|
176 | |
|
39665
2172e3b8eeef
Rename some buddy list accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39603
diff
changeset
|
177 | purple_request_fields( |
|
2172e3b8eeef
Rename some buddy list accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39603
diff
changeset
|
178 | purple_blist_get_default(), _("Get User Info"), NULL, |
|
2172e3b8eeef
Rename some buddy list accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39603
diff
changeset
|
179 | _("Please enter the username or alias of the person " |
|
2172e3b8eeef
Rename some buddy list accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39603
diff
changeset
|
180 | "whose info you would like to view."), |
|
42128
118067ca0367
Convert PurpleRequestPage into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42127
diff
changeset
|
181 | page, _("OK"), G_CALLBACK(pidgin_dialogs_info_cb), |
|
39665
2172e3b8eeef
Rename some buddy list accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39603
diff
changeset
|
182 | _("Cancel"), NULL, NULL, NULL); |
| 9709 | 183 | } |
| 184 | ||
| 185 | static void | |
|
16263
27e0ef0f38e6
Word on the street is that we don't want things named pidginfoo_bar(), but
Richard Laager <rlaager@pidgin.im>
parents:
16254
diff
changeset
|
186 | pidgin_dialogs_alias_buddy_cb(PurpleBuddy *buddy, const char *new_alias) |
|
9730
e59812364b8b
[gaim-migrate @ 10591]
Mark Doliner <markdoliner@pidgin.im>
parents:
9728
diff
changeset
|
187 | { |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34726
diff
changeset
|
188 | purple_buddy_set_local_alias(buddy, new_alias); |
|
35499
c4c5e0a670b1
Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents:
35469
diff
changeset
|
189 | purple_serv_alias_buddy(buddy); |
|
9730
e59812364b8b
[gaim-migrate @ 10591]
Mark Doliner <markdoliner@pidgin.im>
parents:
9728
diff
changeset
|
190 | } |
|
e59812364b8b
[gaim-migrate @ 10591]
Mark Doliner <markdoliner@pidgin.im>
parents:
9728
diff
changeset
|
191 | |
|
e59812364b8b
[gaim-migrate @ 10591]
Mark Doliner <markdoliner@pidgin.im>
parents:
9728
diff
changeset
|
192 | void |
|
16263
27e0ef0f38e6
Word on the street is that we don't want things named pidginfoo_bar(), but
Richard Laager <rlaager@pidgin.im>
parents:
16254
diff
changeset
|
193 | pidgin_dialogs_alias_buddy(PurpleBuddy *buddy) |
|
9730
e59812364b8b
[gaim-migrate @ 10591]
Mark Doliner <markdoliner@pidgin.im>
parents:
9728
diff
changeset
|
194 | { |
|
9753
5951fd24250e
[gaim-migrate @ 10620]
Mark Doliner <markdoliner@pidgin.im>
parents:
9730
diff
changeset
|
195 | gchar *secondary; |
|
5951fd24250e
[gaim-migrate @ 10620]
Mark Doliner <markdoliner@pidgin.im>
parents:
9730
diff
changeset
|
196 | |
|
5951fd24250e
[gaim-migrate @ 10620]
Mark Doliner <markdoliner@pidgin.im>
parents:
9730
diff
changeset
|
197 | g_return_if_fail(buddy != NULL); |
|
5951fd24250e
[gaim-migrate @ 10620]
Mark Doliner <markdoliner@pidgin.im>
parents:
9730
diff
changeset
|
198 | |
|
32709
0edad3ff7243
Use the PurpleBuddy accessor functions.
Andrew Victor <andrew.victor@mxit.com>
parents:
32577
diff
changeset
|
199 | secondary = g_strdup_printf(_("Enter an alias for %s."), purple_buddy_get_name(buddy)); |
|
9730
e59812364b8b
[gaim-migrate @ 10591]
Mark Doliner <markdoliner@pidgin.im>
parents:
9728
diff
changeset
|
200 | |
| 15884 | 201 | purple_request_input(NULL, _("Alias Buddy"), NULL, |
|
34717
b3e588adef5a
Global replace purple_buddy_get_local_buddy_alias() with purple_buddy_get_local_alias()
Ankit Vani <a@nevitus.org>
parents:
34708
diff
changeset
|
202 | secondary, purple_buddy_get_local_alias(buddy), FALSE, FALSE, NULL, |
|
16263
27e0ef0f38e6
Word on the street is that we don't want things named pidginfoo_bar(), but
Richard Laager <rlaager@pidgin.im>
parents:
16254
diff
changeset
|
203 | _("Alias"), G_CALLBACK(pidgin_dialogs_alias_buddy_cb), |
|
16490
68c22924d66b
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents:
16471
diff
changeset
|
204 | _("Cancel"), NULL, |
|
34329
ddbc1337332c
Request API refactoring: introduce PurpleRequestCommonParameters and switch purple_request_input to it
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34301
diff
changeset
|
205 | purple_request_cpar_from_account(purple_buddy_get_account(buddy)), |
|
16490
68c22924d66b
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents:
16471
diff
changeset
|
206 | buddy); |
|
9730
e59812364b8b
[gaim-migrate @ 10591]
Mark Doliner <markdoliner@pidgin.im>
parents:
9728
diff
changeset
|
207 | |
|
e59812364b8b
[gaim-migrate @ 10591]
Mark Doliner <markdoliner@pidgin.im>
parents:
9728
diff
changeset
|
208 | g_free(secondary); |
|
e59812364b8b
[gaim-migrate @ 10591]
Mark Doliner <markdoliner@pidgin.im>
parents:
9728
diff
changeset
|
209 | } |
|
e59812364b8b
[gaim-migrate @ 10591]
Mark Doliner <markdoliner@pidgin.im>
parents:
9728
diff
changeset
|
210 | |
|
e59812364b8b
[gaim-migrate @ 10591]
Mark Doliner <markdoliner@pidgin.im>
parents:
9728
diff
changeset
|
211 | static void |
|
16263
27e0ef0f38e6
Word on the street is that we don't want things named pidginfoo_bar(), but
Richard Laager <rlaager@pidgin.im>
parents:
16254
diff
changeset
|
212 | pidgin_dialogs_alias_chat_cb(PurpleChat *chat, const char *new_alias) |
| 9709 | 213 | { |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34726
diff
changeset
|
214 | purple_chat_set_alias(chat, new_alias); |
| 9709 | 215 | } |
| 216 | ||
| 217 | void | |
|
16263
27e0ef0f38e6
Word on the street is that we don't want things named pidginfoo_bar(), but
Richard Laager <rlaager@pidgin.im>
parents:
16254
diff
changeset
|
218 | pidgin_dialogs_alias_chat(PurpleChat *chat) |
| 9709 | 219 | { |
|
34739
7d507b8b9f92
Refactored pidgin to use the GObject BList API
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
220 | gchar *alias; |
|
7d507b8b9f92
Refactored pidgin to use the GObject BList API
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
221 | |
|
9753
5951fd24250e
[gaim-migrate @ 10620]
Mark Doliner <markdoliner@pidgin.im>
parents:
9730
diff
changeset
|
222 | g_return_if_fail(chat != NULL); |
|
5951fd24250e
[gaim-migrate @ 10620]
Mark Doliner <markdoliner@pidgin.im>
parents:
9730
diff
changeset
|
223 | |
|
34739
7d507b8b9f92
Refactored pidgin to use the GObject BList API
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
224 | g_object_get(chat, "alias", &alias, NULL); |
|
7d507b8b9f92
Refactored pidgin to use the GObject BList API
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
225 | |
| 15884 | 226 | purple_request_input(NULL, _("Alias Chat"), NULL, |
| 9709 | 227 | _("Enter an alias for this chat."), |
|
34739
7d507b8b9f92
Refactored pidgin to use the GObject BList API
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
228 | alias, FALSE, FALSE, NULL, |
|
16263
27e0ef0f38e6
Word on the street is that we don't want things named pidginfoo_bar(), but
Richard Laager <rlaager@pidgin.im>
parents:
16254
diff
changeset
|
229 | _("Alias"), G_CALLBACK(pidgin_dialogs_alias_chat_cb), |
|
16490
68c22924d66b
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents:
16471
diff
changeset
|
230 | _("Cancel"), NULL, |
|
34329
ddbc1337332c
Request API refactoring: introduce PurpleRequestCommonParameters and switch purple_request_input to it
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34301
diff
changeset
|
231 | purple_request_cpar_from_account(purple_chat_get_account(chat)), |
|
16490
68c22924d66b
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents:
16471
diff
changeset
|
232 | chat); |
|
34923
416a7736a401
Unref and free everything recieved from g_object_get
Ankit Vani <a@nevitus.org>
parents:
34887
diff
changeset
|
233 | |
|
416a7736a401
Unref and free everything recieved from g_object_get
Ankit Vani <a@nevitus.org>
parents:
34887
diff
changeset
|
234 | g_free(alias); |
| 9709 | 235 | } |
| 236 |