Fix an incorrect call to soup_message_set_request.
[pidgin-git.git] / libpurple / options.c
blobb3379f8501424f7ec511dc2a5a5a49487d283c9e
1 /* purple
3 * Purple is the legal property of its developers, whose names are too numerous
4 * to list here. Please refer to the COPYRIGHT file distributed with this
5 * source distribution.
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.
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.
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
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
22 #include "internal.h"
24 #include "options.h"
26 #include "network.h"
28 /******************************************************************************
29 * Callbacks
30 *****************************************************************************/
31 static gboolean
32 debug_cb(const gchar *option_name, const gchar *value,
33 gpointer data, GError **error)
35 purple_debug_set_enabled(TRUE);
37 if (purple_strequal(value, "colored")) {
38 purple_debug_set_colored(TRUE);
41 return TRUE;
44 static gboolean
45 force_online_cb(const gchar *option_name, const gchar *value,
46 gpointer data, GError **error)
48 purple_network_force_online();
50 return TRUE;
53 /******************************************************************************
54 * API
55 *****************************************************************************/
57 /**
58 * purple_get_option_group:
60 * Returns a #GOptionGroup for the commandline arguments recognized by
61 * LibPurple. You should add this option group to your #GOptionContext with
62 * g_option_context_add_group(), if you are using g_option_context_parse() to
63 * parse your commandline arguments.
65 * Return Value: (transfer full): a #GOptionGroup for the commandline arguments
66 * recognized by LibPurple.
68 GOptionGroup *
69 purple_get_option_group(void) {
70 GOptionGroup *group = NULL;
71 GOptionEntry entries[] = {
73 "debug", 'd', G_OPTION_FLAG_OPTIONAL_ARG,
74 G_OPTION_ARG_CALLBACK, &debug_cb,
75 _("print debugging messages to stdout"),
76 _("[colored]")
77 }, {
78 "force-online", 'f', G_OPTION_FLAG_NO_ARG,
79 G_OPTION_ARG_CALLBACK, &force_online_cb,
80 _("force online, regardless of network status"),
81 NULL
82 }, {
83 NULL
87 group = g_option_group_new(
88 "libpurple",
89 _("LibPurple options"),
90 _("Show LibPurple Options"),
91 NULL,
92 NULL
95 g_option_group_add_entries(group, entries);
97 return group;