Mon, 31 Oct 2022 23:00:12 -0500
Update the IRCv3 protocol plugin to the new connection setup
Testing Done:
Connected and disconnected an IRCv3 account and verified that it worked and that there were no `g_warnings`.
Reviewed at https://reviews.imfreedom.org/r/2003/
|
41796
ebe4ff278b02
Use the parser on ircv3 messages and handle pings
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1 | /* |
|
ebe4ff278b02
Use the parser on ircv3 messages and handle pings
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
2 | * Purple - Internet Messaging Library |
|
ebe4ff278b02
Use the parser on ircv3 messages and handle pings
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
3 | * Copyright (C) Pidgin Developers <devel@pidgin.im> |
|
ebe4ff278b02
Use the parser on ircv3 messages and handle pings
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
4 | * |
|
ebe4ff278b02
Use the parser on ircv3 messages and handle pings
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
5 | * This program is free software; you can redistribute it and/or modify |
|
ebe4ff278b02
Use the parser on ircv3 messages and handle pings
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
6 | * it under the terms of the GNU General Public License as published by |
|
ebe4ff278b02
Use the parser on ircv3 messages and handle pings
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
7 | * the Free Software Foundation; either version 2 of the License, or |
|
ebe4ff278b02
Use the parser on ircv3 messages and handle pings
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
8 | * (at your option) any later version. |
|
ebe4ff278b02
Use the parser on ircv3 messages and handle pings
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
9 | * |
|
ebe4ff278b02
Use the parser on ircv3 messages and handle pings
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
10 | * This program is distributed in the hope that it will be useful, |
|
ebe4ff278b02
Use the parser on ircv3 messages and handle pings
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
ebe4ff278b02
Use the parser on ircv3 messages and handle pings
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
ebe4ff278b02
Use the parser on ircv3 messages and handle pings
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
13 | * GNU General Public License for more details. |
|
ebe4ff278b02
Use the parser on ircv3 messages and handle pings
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
14 | * |
|
ebe4ff278b02
Use the parser on ircv3 messages and handle pings
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
15 | * You should have received a copy of the GNU General Public License |
|
ebe4ff278b02
Use the parser on ircv3 messages and handle pings
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
16 | * along with this program; if not, see <https://www.gnu.org/licenses/>. |
|
ebe4ff278b02
Use the parser on ircv3 messages and handle pings
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
17 | */ |
|
ebe4ff278b02
Use the parser on ircv3 messages and handle pings
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
18 | |
|
ebe4ff278b02
Use the parser on ircv3 messages and handle pings
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
19 | #ifndef PURPLE_IRCV3_MESSAGE_HANDLERS_H |
|
ebe4ff278b02
Use the parser on ircv3 messages and handle pings
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
20 | #define PURPLE_IRCV3_MESSAGE_HANDLERS_H |
|
ebe4ff278b02
Use the parser on ircv3 messages and handle pings
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
21 | |
|
ebe4ff278b02
Use the parser on ircv3 messages and handle pings
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
22 | #include <glib.h> |
|
ebe4ff278b02
Use the parser on ircv3 messages and handle pings
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
23 | |
|
ebe4ff278b02
Use the parser on ircv3 messages and handle pings
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
24 | #include <purple.h> |
|
ebe4ff278b02
Use the parser on ircv3 messages and handle pings
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
25 | |
|
ebe4ff278b02
Use the parser on ircv3 messages and handle pings
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
26 | G_BEGIN_DECLS |
|
ebe4ff278b02
Use the parser on ircv3 messages and handle pings
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
27 | |
|
ebe4ff278b02
Use the parser on ircv3 messages and handle pings
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
28 | /** |
|
ebe4ff278b02
Use the parser on ircv3 messages and handle pings
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
29 | * PurpleIRCv3MessageHandler: |
|
ebe4ff278b02
Use the parser on ircv3 messages and handle pings
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
30 | * @tags: (element-type utf8 utf8): A [struct@GLib.HashTable] of tags for this |
|
ebe4ff278b02
Use the parser on ircv3 messages and handle pings
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
31 | * message. |
|
ebe4ff278b02
Use the parser on ircv3 messages and handle pings
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
32 | * @source: The source of the command. |
|
ebe4ff278b02
Use the parser on ircv3 messages and handle pings
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
33 | * @command: The command or numeric of the message. |
|
ebe4ff278b02
Use the parser on ircv3 messages and handle pings
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
34 | * @n_params: The number of parameters. |
|
ebe4ff278b02
Use the parser on ircv3 messages and handle pings
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
35 | * @params: (array_length=n_params): The parameters of the message. |
|
ebe4ff278b02
Use the parser on ircv3 messages and handle pings
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
36 | * @error: (nullable) (optional): A return address for a [type@GLib.Error]. |
|
ebe4ff278b02
Use the parser on ircv3 messages and handle pings
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
37 | * @data: The user data that was passed to [method@PurpleIRCv3.Parser.parse]. |
|
ebe4ff278b02
Use the parser on ircv3 messages and handle pings
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
38 | * |
|
ebe4ff278b02
Use the parser on ircv3 messages and handle pings
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
39 | * Defines the type of a function that will be called to handle a message. |
|
ebe4ff278b02
Use the parser on ircv3 messages and handle pings
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
40 | * |
|
ebe4ff278b02
Use the parser on ircv3 messages and handle pings
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
41 | * Returns: %TRUE if the command was handled properly, otherwise %FALSE and |
|
ebe4ff278b02
Use the parser on ircv3 messages and handle pings
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
42 | * @error may be set. |
|
ebe4ff278b02
Use the parser on ircv3 messages and handle pings
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
43 | * |
|
ebe4ff278b02
Use the parser on ircv3 messages and handle pings
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
44 | * Since: 3.0.0 |
|
ebe4ff278b02
Use the parser on ircv3 messages and handle pings
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
45 | */ |
|
ebe4ff278b02
Use the parser on ircv3 messages and handle pings
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
46 | typedef gboolean (*PurpleIRCv3MessageHandler)(GHashTable *tags, |
|
ebe4ff278b02
Use the parser on ircv3 messages and handle pings
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
47 | const char *source, |
|
ebe4ff278b02
Use the parser on ircv3 messages and handle pings
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
48 | const char *command, |
|
ebe4ff278b02
Use the parser on ircv3 messages and handle pings
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
49 | guint n_params, |
|
ebe4ff278b02
Use the parser on ircv3 messages and handle pings
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
50 | GStrv params, |
|
ebe4ff278b02
Use the parser on ircv3 messages and handle pings
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
51 | GError **error, |
|
ebe4ff278b02
Use the parser on ircv3 messages and handle pings
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
52 | gpointer data); |
|
ebe4ff278b02
Use the parser on ircv3 messages and handle pings
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
53 | |
|
41821
ec766a6f010a
Properly namespace the message handlers and reorganize them
Gary Kramlich <grim@reaperworld.com>
parents:
41813
diff
changeset
|
54 | G_GNUC_INTERNAL gboolean purple_ircv3_message_handler_cap(GHashTable *tags, const char *source, const char *command, guint n_params, GStrv params, GError **error, gpointer data); |
|
ec766a6f010a
Properly namespace the message handlers and reorganize them
Gary Kramlich <grim@reaperworld.com>
parents:
41813
diff
changeset
|
55 | G_GNUC_INTERNAL gboolean purple_ircv3_message_handler_fallback(GHashTable *tags, const char *source, const char *command, guint n_params, GStrv params, GError **error, gpointer data); |
|
ec766a6f010a
Properly namespace the message handlers and reorganize them
Gary Kramlich <grim@reaperworld.com>
parents:
41813
diff
changeset
|
56 | G_GNUC_INTERNAL gboolean purple_ircv3_message_handler_ping(GHashTable *tags, const char *source, const char *command, guint n_params, GStrv params, GError **error, gpointer data); |
|
41813
86302ce7e3c1
Add support for handling PRIVMSG and NOTICE messages from the server
Gary Kramlich <grim@reaperworld.com>
parents:
41807
diff
changeset
|
57 | G_GNUC_INTERNAL gboolean purple_ircv3_message_handler_privmsg(GHashTable *tags, const char *source, const char *command, guint n_params, GStrv params, GError **error, gpointer data); |
|
86302ce7e3c1
Add support for handling PRIVMSG and NOTICE messages from the server
Gary Kramlich <grim@reaperworld.com>
parents:
41807
diff
changeset
|
58 | |
|
41796
ebe4ff278b02
Use the parser on ircv3 messages and handle pings
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
59 | G_END_DECLS |
|
ebe4ff278b02
Use the parser on ircv3 messages and handle pings
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
60 | |
|
ebe4ff278b02
Use the parser on ircv3 messages and handle pings
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
61 | #endif /* PURPLE_IRCV3_MESSAGE_HANDLERS_H */ |