Sat, 29 Oct 2022 01:14:13 -0500
Convert PidginProxyPrefs to Adwaita 1.2
Testing Done:
Set all the values via the ui and the config file and tested bad values in the port in both as well. Bad values in the ui will store whatever atoi returned, but bad values in the config file will fallback to the default.
Reviewed at https://reviews.imfreedom.org/r/1996/
|
40871
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1 | /* |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
2 | * Pidgin - Internet Messenger |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
3 | * Copyright (C) Pidgin Developers <devel@pidgin.im> |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
4 | * |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
5 | * Pidgin is the legal property of its developers, whose names are too numerous |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
6 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
7 | * source distribution. |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
8 | * |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
9 | * This program is free software; you can redistribute it and/or modify |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
10 | * it under the terms of the GNU General Public License as published by |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
11 | * the Free Software Foundation; either version 2 of the License, or |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
12 | * (at your option) any later version. |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
13 | * |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
14 | * This program is distributed in the hope that it will be useful, |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
17 | * GNU General Public License for more details. |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
18 | * |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
19 | * You should have received a copy of the GNU General Public License |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
20 | * along with this program; if not, see <https://www.gnu.org/licenses/>. |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
21 | */ |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
22 | |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
23 | #include <glib/gi18n-lib.h> |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
24 | |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
25 | #include <pidginprivate.h> |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
26 | |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
27 | /****************************************************************************** |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
28 | * Command Implementations |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
29 | *****************************************************************************/ |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
30 | static PurpleCmdRet |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
31 | say_command_cb(PurpleConversation *conv, |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
32 | const char *cmd, char **args, char **error, void *data) |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
33 | { |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
34 | purple_conversation_send(conv, args[0]); |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
35 | |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
36 | return PURPLE_CMD_RET_OK; |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
37 | } |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
38 | |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
39 | static PurpleCmdRet |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
40 | me_command_cb(PurpleConversation *conv, |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
41 | const char *cmd, char **args, char **error, void *data) |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
42 | { |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
43 | char *tmp; |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
44 | |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
45 | tmp = g_strdup_printf("/me %s", args[0]); |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
46 | purple_conversation_send(conv, tmp); |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
47 | |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
48 | g_free(tmp); |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
49 | return PURPLE_CMD_RET_OK; |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
50 | } |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
51 | |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
52 | static PurpleCmdRet |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
53 | debug_command_cb(PurpleConversation *conv, |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
54 | const char *cmd, char **args, char **error, void *data) |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
55 | { |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
56 | char *tmp, *markup; |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
57 | |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
58 | if (!g_ascii_strcasecmp(args[0], "version")) { |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
59 | tmp = g_strdup_printf("Using Pidgin v%s with libpurple v%s.", |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
60 | DISPLAY_VERSION, purple_core_get_version()); |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
61 | } else if (!g_ascii_strcasecmp(args[0], "plugins")) { |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
62 | /* Show all the loaded plugins, including plugins marked internal. |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
63 | * This is intentional, since third party protocols are often sources of bugs, and some |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
64 | * plugin loaders can also be buggy. |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
65 | */ |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
66 | GString *str = g_string_new("Loaded Plugins: "); |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
67 | const GList *plugins = purple_plugins_get_loaded(); |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
68 | if (plugins) { |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
69 | for (; plugins; plugins = plugins->next) { |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
70 | GPluginPluginInfo *info = GPLUGIN_PLUGIN_INFO( |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
71 | purple_plugin_get_info( |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
72 | PURPLE_PLUGIN(plugins->data))); |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
73 | str = g_string_append( |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
74 | str, |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
75 | gplugin_plugin_info_get_name(info)); |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
76 | |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
77 | if (plugins->next) |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
78 | str = g_string_append(str, ", "); |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
79 | } |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
80 | } else { |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
81 | str = g_string_append(str, "(none)"); |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
82 | } |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
83 | |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
84 | tmp = g_string_free(str, FALSE); |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
85 | } else if (!g_ascii_strcasecmp(args[0], "unsafe")) { |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
86 | if (purple_debug_is_unsafe()) { |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
87 | purple_debug_set_unsafe(FALSE); |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
88 | purple_conversation_write_system_message(conv, |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
89 | _("Unsafe debugging is now disabled."), |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
90 | PURPLE_MESSAGE_NO_LOG); |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
91 | } else { |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
92 | purple_debug_set_unsafe(TRUE); |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
93 | purple_conversation_write_system_message(conv, |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
94 | _("Unsafe debugging is now enabled."), |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
95 | PURPLE_MESSAGE_NO_LOG); |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
96 | } |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
97 | |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
98 | return PURPLE_CMD_RET_OK; |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
99 | } else if (!g_ascii_strcasecmp(args[0], "verbose")) { |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
100 | if (purple_debug_is_verbose()) { |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
101 | purple_debug_set_verbose(FALSE); |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
102 | purple_conversation_write_system_message(conv, |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
103 | _("Verbose debugging is now disabled."), |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
104 | PURPLE_MESSAGE_NO_LOG); |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
105 | } else { |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
106 | purple_debug_set_verbose(TRUE); |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
107 | purple_conversation_write_system_message(conv, |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
108 | _("Verbose debugging is now enabled."), |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
109 | PURPLE_MESSAGE_NO_LOG); |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
110 | } |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
111 | |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
112 | return PURPLE_CMD_RET_OK; |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
113 | } else { |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
114 | purple_conversation_write_system_message(conv, |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
115 | _("Supported debug options are: plugins, version, unsafe, verbose"), |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
116 | PURPLE_MESSAGE_NO_LOG); |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
117 | return PURPLE_CMD_RET_OK; |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
118 | } |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
119 | |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
120 | markup = g_markup_escape_text(tmp, -1); |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
121 | purple_conversation_send(conv, markup); |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
122 | |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
123 | g_free(tmp); |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
124 | g_free(markup); |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
125 | return PURPLE_CMD_RET_OK; |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
126 | } |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
127 | |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
128 | static PurpleCmdRet |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
129 | clear_command_cb(PurpleConversation *conv, |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
130 | const char *cmd, char **args, char **error, void *data) |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
131 | { |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
132 | purple_conversation_clear_message_history(conv); |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
133 | return PURPLE_CMD_RET_OK; |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
134 | } |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
135 | |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
136 | static PurpleCmdRet |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
137 | clearall_command_cb(PurpleConversation *conv, |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
138 | const char *cmd, char **args, char **error, void *data) |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
139 | { |
|
40952
53fa03701534
Port Pidgin to the new PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40871
diff
changeset
|
140 | PurpleConversationManager *manager; |
|
53fa03701534
Port Pidgin to the new PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40871
diff
changeset
|
141 | GList *list; |
|
53fa03701534
Port Pidgin to the new PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40871
diff
changeset
|
142 | |
|
53fa03701534
Port Pidgin to the new PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40871
diff
changeset
|
143 | manager = purple_conversation_manager_get_default(); |
|
53fa03701534
Port Pidgin to the new PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40871
diff
changeset
|
144 | list = purple_conversation_manager_get_all(manager); |
|
53fa03701534
Port Pidgin to the new PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40871
diff
changeset
|
145 | |
|
53fa03701534
Port Pidgin to the new PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40871
diff
changeset
|
146 | while(list != NULL) { |
|
53fa03701534
Port Pidgin to the new PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40871
diff
changeset
|
147 | PurpleConversation *conv = PURPLE_CONVERSATION(list->data); |
|
53fa03701534
Port Pidgin to the new PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40871
diff
changeset
|
148 | |
|
53fa03701534
Port Pidgin to the new PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40871
diff
changeset
|
149 | purple_conversation_clear_message_history(conv); |
|
53fa03701534
Port Pidgin to the new PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40871
diff
changeset
|
150 | |
|
53fa03701534
Port Pidgin to the new PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40871
diff
changeset
|
151 | list = g_list_delete_link(list, list); |
|
53fa03701534
Port Pidgin to the new PurpleConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40871
diff
changeset
|
152 | } |
|
40871
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
153 | |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
154 | return PURPLE_CMD_RET_OK; |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
155 | } |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
156 | |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
157 | static PurpleCmdRet |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
158 | help_command_cb(PurpleConversation *conv, |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
159 | const char *cmd, char **args, char **error, void *data) |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
160 | { |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
161 | GList *l, *text; |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
162 | GString *s; |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
163 | |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
164 | if (args[0] != NULL) { |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
165 | s = g_string_new(""); |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
166 | text = purple_cmd_help(conv, args[0]); |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
167 | |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
168 | if (text) { |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
169 | for (l = text; l; l = l->next) |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
170 | if (l->next) |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
171 | g_string_append_printf(s, "%s\n", (char *)l->data); |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
172 | else |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
173 | g_string_append_printf(s, "%s", (char *)l->data); |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
174 | } else { |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
175 | g_string_append(s, _("No such command (in this context).")); |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
176 | } |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
177 | } else { |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
178 | s = g_string_new(_("Use \"/help <command>\" for help with a " |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
179 | "specific command.<br/>The following commands are available " |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
180 | "in this context:<br/>")); |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
181 | |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
182 | text = purple_cmd_list(conv); |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
183 | for (l = text; l; l = l->next) |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
184 | if (l->next) |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
185 | g_string_append_printf(s, "%s, ", (char *)l->data); |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
186 | else |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
187 | g_string_append_printf(s, "%s.", (char *)l->data); |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
188 | g_list_free(text); |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
189 | } |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
190 | |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
191 | purple_conversation_write_system_message(conv, s->str, PURPLE_MESSAGE_NO_LOG); |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
192 | g_string_free(s, TRUE); |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
193 | |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
194 | return PURPLE_CMD_RET_OK; |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
195 | } |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
196 | |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
197 | /****************************************************************************** |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
198 | * Public API |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
199 | *****************************************************************************/ |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
200 | void |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
201 | pidgin_commands_init(void) { |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
202 | purple_cmd_register("say", "S", PURPLE_CMD_P_DEFAULT, |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
203 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM, NULL, |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
204 | say_command_cb, _("say <message>: Send a message normally as if you weren't using a command."), NULL); |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
205 | purple_cmd_register("me", "S", PURPLE_CMD_P_DEFAULT, |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
206 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM, NULL, |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
207 | me_command_cb, _("me <action>: Send an IRC style action to a buddy or chat."), NULL); |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
208 | purple_cmd_register("debug", "w", PURPLE_CMD_P_DEFAULT, |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
209 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM, NULL, |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
210 | debug_command_cb, _("debug <option>: Send various debug information to the current conversation."), NULL); |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
211 | purple_cmd_register("clear", "", PURPLE_CMD_P_DEFAULT, |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
212 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM, NULL, |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
213 | clear_command_cb, _("clear: Clears the conversation scrollback."), NULL); |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
214 | purple_cmd_register("clearall", "", PURPLE_CMD_P_DEFAULT, |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
215 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM, NULL, |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
216 | clearall_command_cb, _("clearall: Clears all conversation scrollbacks."), NULL); |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
217 | purple_cmd_register("help", "w", PURPLE_CMD_P_DEFAULT, |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
218 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, NULL, |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
219 | help_command_cb, _("help <command>: Help on a specific command."), NULL); |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
220 | } |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
221 | |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
222 | void |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
223 | pidgin_commands_uninit(void) { |
|
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
224 | } |