libpurple/purpledebugui.h

Mon, 12 May 2025 20:25:16 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Mon, 12 May 2025 20:25:16 -0500
changeset 43246
0e9bbe9b4da8
parent 42680
905bc2694da8
permissions
-rw-r--r--

Handle formatting in server messages

Testing Done:
Used the default motd on my local ergo server to verify that formatting was working.

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

40950
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1 /*
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
2 * Purple - Internet Messaging Library
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
3 * Copyright (C) Pidgin Developers <devel@pidgin.im>
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
4 *
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
5 * Purple is the legal property of its developers, whose names are too numerous
42594
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42387
diff changeset
6 * to list here. Please refer to the COPYRIGHT file distributed with this
40950
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
7 * source distribution.
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
8 *
42594
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42387
diff changeset
9 * This library is free software; you can redistribute it and/or modify it
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42387
diff changeset
10 * under the terms of the GNU General Public License as published by the Free
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42387
diff changeset
11 * Software Foundation; either version 2 of the License, or (at your option)
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42387
diff changeset
12 * any later version.
40950
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
13 *
42594
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42387
diff changeset
14 * This library is distributed in the hope that it will be useful, but WITHOUT
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42387
diff changeset
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42387
diff changeset
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42387
diff changeset
17 * more details.
40950
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
18 *
42594
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42387
diff changeset
19 * You should have received a copy of the GNU General Public License along with
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42387
diff changeset
20 * this library; if not, see <https://www.gnu.org/licenses/>.
40950
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
21 */
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
22
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
23 #if !defined(PURPLE_GLOBAL_HEADER_INSIDE) && !defined(PURPLE_COMPILATION)
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
24 # error "only <purple.h> may be included directly"
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
25 #endif
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
26
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
27 #ifndef PURPLE_DEBUG_UI_H
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
28 #define PURPLE_DEBUG_UI_H
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
29
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
30 #include <glib.h>
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
31 #include <glib-object.h>
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
32
42387
d9350cda1556 Export symbols added for 3.0.0
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41686
diff changeset
33 #include "purpleversion.h"
d9350cda1556 Export symbols added for 3.0.0
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41686
diff changeset
34
40950
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
35 G_BEGIN_DECLS
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
36
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
37 #define PURPLE_TYPE_DEBUG_UI (purple_debug_ui_get_type())
41207
d91e963b0a1c Remove unnecessary gtk-doc comments and move them where possible from libpurple/purple[a-n]*.h
Gary Kramlich <grim@reaperworld.com>
parents: 40950
diff changeset
38
d91e963b0a1c Remove unnecessary gtk-doc comments and move them where possible from libpurple/purple[a-n]*.h
Gary Kramlich <grim@reaperworld.com>
parents: 40950
diff changeset
39 /**
d91e963b0a1c Remove unnecessary gtk-doc comments and move them where possible from libpurple/purple[a-n]*.h
Gary Kramlich <grim@reaperworld.com>
parents: 40950
diff changeset
40 * PurpleDebugUi:
d91e963b0a1c Remove unnecessary gtk-doc comments and move them where possible from libpurple/purple[a-n]*.h
Gary Kramlich <grim@reaperworld.com>
parents: 40950
diff changeset
41 *
d91e963b0a1c Remove unnecessary gtk-doc comments and move them where possible from libpurple/purple[a-n]*.h
Gary Kramlich <grim@reaperworld.com>
parents: 40950
diff changeset
42 * #PurpleDebugUiInterface defines the behavior that libpurple uses to
d91e963b0a1c Remove unnecessary gtk-doc comments and move them where possible from libpurple/purple[a-n]*.h
Gary Kramlich <grim@reaperworld.com>
parents: 40950
diff changeset
43 * interface the debug API with the user interface.
d91e963b0a1c Remove unnecessary gtk-doc comments and move them where possible from libpurple/purple[a-n]*.h
Gary Kramlich <grim@reaperworld.com>
parents: 40950
diff changeset
44 *
42614
b75a5bbf6c35 Remove the micro version from since tags for libpurple part 3
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
45 * Since: 3.0
41207
d91e963b0a1c Remove unnecessary gtk-doc comments and move them where possible from libpurple/purple[a-n]*.h
Gary Kramlich <grim@reaperworld.com>
parents: 40950
diff changeset
46 */
42387
d9350cda1556 Export symbols added for 3.0.0
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41686
diff changeset
47 PURPLE_AVAILABLE_IN_3_0
40950
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
48 G_DECLARE_INTERFACE(PurpleDebugUi, purple_debug_ui, PURPLE, DEBUG_UI, GObject)
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
49
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
50 #include "debug.h"
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
51
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
52 struct _PurpleDebugUiInterface {
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
53 /*< private >*/
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
54 GTypeInterface parent_iface;
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
55
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
56 /*< public >*/
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
57 void (*print)(PurpleDebugUi *ui, PurpleDebugLevel level, const gchar *category, const gchar *arg_s);
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
58 gboolean (*is_enabled)(PurpleDebugUi *ui, PurpleDebugLevel level, const gchar *category);
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
59
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
60 /*< private >*/
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
61 gpointer reserved[4];
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
62 };
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
63
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
64 /**
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
65 * purple_debug_ui_is_enabled:
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
66 * @ui: The #PurpleDebugUi instance.
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
67 * @level: The #PurpleDebugLevel.
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
68 * @category: An optional category.
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
69 *
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
70 * Checks if the ui should output messages at the given level and optional
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
71 * category.
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
72 *
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
73 * Typically this function will not need to be called outside of libpurple.
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
74 *
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
75 * Returns: %TRUE if the given level and category will be output by @ui, %FALSE
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
76 * otherwise.
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
77 *
42614
b75a5bbf6c35 Remove the micro version from since tags for libpurple part 3
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
78 * Since: 3.0
40950
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
79 */
42387
d9350cda1556 Export symbols added for 3.0.0
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41686
diff changeset
80 PURPLE_AVAILABLE_IN_3_0
40950
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
81 gboolean purple_debug_ui_is_enabled(PurpleDebugUi *ui, PurpleDebugLevel level, const gchar *category);
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
82
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
83 /**
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
84 * purple_debug_ui_print:
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
85 * @ui: The #PurpleDebugUi instance.
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
86 * @level: The #PurpleDebugLevel.
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
87 * @category: An optional category.
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
88 * @arg_s: The debug string to output.
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
89 *
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
90 * Outputs @arg_s via @ui with the given @level and optional @category.
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
91 *
42614
b75a5bbf6c35 Remove the micro version from since tags for libpurple part 3
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
92 * Since: 3.0
40950
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
93 */
42387
d9350cda1556 Export symbols added for 3.0.0
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41686
diff changeset
94 PURPLE_AVAILABLE_IN_3_0
40950
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
95 void purple_debug_ui_print(PurpleDebugUi *ui, PurpleDebugLevel level, const gchar *category, const gchar *arg_s);
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
96
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
97 G_END_DECLS
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
98
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
99 #endif /* PURPLE_DEBUG_UI_H */
c3fc77a3c015 Separate PurpleDebugUi out to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
100

mercurial