libpurple/purpleoptions.c

Tue, 06 Apr 2021 03:35:20 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Tue, 06 Apr 2021 03:35:20 -0500
changeset 40840
b5f355f90ab0
parent 40727
9389ba16cf40
child 41127
cd297cfc56f3
permissions
-rw-r--r--

Port the updates from 2.14.2 and the upcoming 2.14.3 to 3.0.0

* Use the unicode version of the System and UserInfo plugins to fix
non-english languages in the Windows installer.
* Update the installer to use the inetc plugin so that https downloads will
work. This became necessary because Sourceforge now redirects http to
https.
* Standardize everything in pidgin/win32/winpidgin.c to use `wprintf`.

Testing Done:
Compiled and ran on windows 10.

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

40727
9389ba16cf40 Rename options.[ch] to purpleoptions.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
1 /*
9389ba16cf40 Rename options.[ch] to purpleoptions.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
2 * Purple - Internet Messaging Library
9389ba16cf40 Rename options.[ch] to purpleoptions.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
3 * Copyright (C) Pidgin Developers <devel@pidgin.im>
38802
afb1c8302e49 The start of the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
4 *
afb1c8302e49 The start of the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
5 * Purple is the legal property of its developers, whose names are too numerous
afb1c8302e49 The start of the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
6 * to list here. Please refer to the COPYRIGHT file distributed with this
afb1c8302e49 The start of the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
7 * source distribution.
afb1c8302e49 The start of the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
8 *
afb1c8302e49 The start of the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
9 * This program is free software; you can redistribute it and/or modify
afb1c8302e49 The start of the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
10 * it under the terms of the GNU General Public License as published by
afb1c8302e49 The start of the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
11 * the Free Software Foundation; either version 2 of the License, or
afb1c8302e49 The start of the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
12 * (at your option) any later version.
afb1c8302e49 The start of the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
13 *
afb1c8302e49 The start of the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
14 * This program is distributed in the hope that it will be useful,
afb1c8302e49 The start of the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
afb1c8302e49 The start of the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
afb1c8302e49 The start of the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
17 * GNU General Public License for more details.
afb1c8302e49 The start of the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
18 *
afb1c8302e49 The start of the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
40727
9389ba16cf40 Rename options.[ch] to purpleoptions.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
20 * along with this program; if not, see <https://www.gnu.org/licenses/>.
38802
afb1c8302e49 The start of the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
21 */
afb1c8302e49 The start of the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
22
40441
f23c7e772667 Make sure we're not including the gettext macros in header files and deal with the repercussions of that.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
23 #include <glib/gi18n-lib.h>
f23c7e772667 Make sure we're not including the gettext macros in header files and deal with the repercussions of that.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
24
40727
9389ba16cf40 Rename options.[ch] to purpleoptions.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
25 #include "purpleoptions.h"
38802
afb1c8302e49 The start of the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
26
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: 39024
diff changeset
27 #include "debug.h"
38803
60c745a9e06d Move the force online option into the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents: 38802
diff changeset
28 #include "network.h"
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: 39024
diff changeset
29 #include "util.h"
38803
60c745a9e06d Move the force online option into the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents: 38802
diff changeset
30
38802
afb1c8302e49 The start of the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
31 /******************************************************************************
afb1c8302e49 The start of the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
32 * Callbacks
afb1c8302e49 The start of the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
33 *****************************************************************************/
afb1c8302e49 The start of the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
34 static gboolean
40727
9389ba16cf40 Rename options.[ch] to purpleoptions.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
35 purple_options_debug_cb(const gchar *option_name, const gchar *value,
9389ba16cf40 Rename options.[ch] to purpleoptions.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
36 gpointer data, GError **error)
38802
afb1c8302e49 The start of the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
37 {
afb1c8302e49 The start of the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
38 purple_debug_set_enabled(TRUE);
afb1c8302e49 The start of the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
39
afb1c8302e49 The start of the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
40 if (purple_strequal(value, "colored")) {
afb1c8302e49 The start of the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
41 purple_debug_set_colored(TRUE);
afb1c8302e49 The start of the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
42 }
afb1c8302e49 The start of the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
43
afb1c8302e49 The start of the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
44 return TRUE;
afb1c8302e49 The start of the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
45 }
afb1c8302e49 The start of the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
46
38803
60c745a9e06d Move the force online option into the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents: 38802
diff changeset
47 static gboolean
40727
9389ba16cf40 Rename options.[ch] to purpleoptions.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
48 purple_options_force_online_cb(const gchar *option_name, const gchar *value,
9389ba16cf40 Rename options.[ch] to purpleoptions.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
49 gpointer data, GError **error)
38803
60c745a9e06d Move the force online option into the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents: 38802
diff changeset
50 {
60c745a9e06d Move the force online option into the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents: 38802
diff changeset
51 purple_network_force_online();
60c745a9e06d Move the force online option into the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents: 38802
diff changeset
52
60c745a9e06d Move the force online option into the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents: 38802
diff changeset
53 return TRUE;
60c745a9e06d Move the force online option into the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents: 38802
diff changeset
54 }
60c745a9e06d Move the force online option into the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents: 38802
diff changeset
55
38802
afb1c8302e49 The start of the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
56 /******************************************************************************
40727
9389ba16cf40 Rename options.[ch] to purpleoptions.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
57 * Public API
38802
afb1c8302e49 The start of the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
58 *****************************************************************************/
afb1c8302e49 The start of the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
59 GOptionGroup *
afb1c8302e49 The start of the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
60 purple_get_option_group(void) {
afb1c8302e49 The start of the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
61 GOptionGroup *group = NULL;
afb1c8302e49 The start of the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
62 GOptionEntry entries[] = {
afb1c8302e49 The start of the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
63 {
afb1c8302e49 The start of the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
64 "debug", 'd', G_OPTION_FLAG_OPTIONAL_ARG,
40727
9389ba16cf40 Rename options.[ch] to purpleoptions.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
65 G_OPTION_ARG_CALLBACK, &purple_options_debug_cb,
38802
afb1c8302e49 The start of the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
66 _("print debugging messages to stdout"),
afb1c8302e49 The start of the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
67 _("[colored]")
38803
60c745a9e06d Move the force online option into the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents: 38802
diff changeset
68 }, {
39024
3338d8afcad6 options: Fix flags for force-online
Mike Ruprecht <cmaiku@gmail.com>
parents: 38973
diff changeset
69 "force-online", 'f', G_OPTION_FLAG_NO_ARG,
40727
9389ba16cf40 Rename options.[ch] to purpleoptions.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
70 G_OPTION_ARG_CALLBACK, &purple_options_force_online_cb,
38803
60c745a9e06d Move the force online option into the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents: 38802
diff changeset
71 _("force online, regardless of network status"),
60c745a9e06d Move the force online option into the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents: 38802
diff changeset
72 NULL
38973
b4ebaec25764 libpurple/options.c: NULL terminate GOptionEntry array
Mike Ruprecht <cmaiku@gmail.com>
parents: 38805
diff changeset
73 }, {
b4ebaec25764 libpurple/options.c: NULL terminate GOptionEntry array
Mike Ruprecht <cmaiku@gmail.com>
parents: 38805
diff changeset
74 NULL
38802
afb1c8302e49 The start of the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
75 },
afb1c8302e49 The start of the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
76 };
afb1c8302e49 The start of the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
77
afb1c8302e49 The start of the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
78 group = g_option_group_new(
afb1c8302e49 The start of the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
79 "libpurple",
afb1c8302e49 The start of the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
80 _("LibPurple options"),
afb1c8302e49 The start of the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
81 _("Show LibPurple Options"),
afb1c8302e49 The start of the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
82 NULL,
afb1c8302e49 The start of the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
83 NULL
afb1c8302e49 The start of the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
84 );
afb1c8302e49 The start of the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
85
afb1c8302e49 The start of the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
86 g_option_group_add_entries(group, entries);
afb1c8302e49 The start of the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
87
afb1c8302e49 The start of the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
88 return group;
afb1c8302e49 The start of the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
89 }

mercurial