protocols/ircv3/purpleircv3protocol.c

Mon, 25 Mar 2024 21:43:28 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Mon, 25 Mar 2024 21:43:28 -0500
changeset 42652
225762d4e206
parent 42646
libpurple/protocols/ircv3/purpleircv3protocol.c@b82b5609c044
child 42697
12b41aac2510
permissions
-rw-r--r--

Move the Demo and IRCv3 protocols to the new protocols directory

Testing Done:
Ran `meson dist` and `ninja turtles`

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

41750
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1 /*
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
2 * Purple - Internet Messaging Library
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
3 * Copyright (C) Pidgin Developers <devel@pidgin.im>
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
4 *
42568
31e8c7c92e2f Make sure all of the license headers for IRCv3 are GPLv2
Gary Kramlich <grim@reaperworld.com>
parents: 42469
diff changeset
5 * Purple is the legal property of its developers, whose names are too numerous
31e8c7c92e2f Make sure all of the license headers for IRCv3 are GPLv2
Gary Kramlich <grim@reaperworld.com>
parents: 42469
diff changeset
6 * to list here. Please refer to the COPYRIGHT file distributed with this
31e8c7c92e2f Make sure all of the license headers for IRCv3 are GPLv2
Gary Kramlich <grim@reaperworld.com>
parents: 42469
diff changeset
7 * source distribution.
31e8c7c92e2f Make sure all of the license headers for IRCv3 are GPLv2
Gary Kramlich <grim@reaperworld.com>
parents: 42469
diff changeset
8 *
31e8c7c92e2f Make sure all of the license headers for IRCv3 are GPLv2
Gary Kramlich <grim@reaperworld.com>
parents: 42469
diff changeset
9 * This library is free software; you can redistribute it and/or modify
41750
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
10 * it under the terms of the GNU General Public License as published by
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
11 * the Free Software Foundation; either version 2 of the License, or
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
12 * (at your option) any later version.
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
13 *
42568
31e8c7c92e2f Make sure all of the license headers for IRCv3 are GPLv2
Gary Kramlich <grim@reaperworld.com>
parents: 42469
diff changeset
14 * This library is distributed in the hope that it will be useful,
41750
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
17 * GNU General Public License for more details.
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
18 *
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
42568
31e8c7c92e2f Make sure all of the license headers for IRCv3 are GPLv2
Gary Kramlich <grim@reaperworld.com>
parents: 42469
diff changeset
20 * along with this library; if not, see <https://www.gnu.org/licenses/>.
41750
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
21 */
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
22
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
23 #include <glib/gi18n-lib.h>
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
24
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
25 #include "purpleircv3protocol.h"
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
26
41783
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
27 #include "purpleircv3connection.h"
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
28 #include "purpleircv3core.h"
42320
21cab78fb7d2 IRCv3: Move from ProtocolIM to ProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42044
diff changeset
29 #include "purpleircv3protocolconversation.h"
41772
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
30
41750
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
31 /******************************************************************************
42646
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
32 * Callbacks
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
33 *****************************************************************************/
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
34 static void
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
35 purple_ircv3_protocol_can_reach_cb(GObject *self, GAsyncResult *result,
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
36 gpointer data)
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
37 {
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
38 GError *error = NULL;
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
39 GTask *task = data;
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
40 gboolean can_reach = FALSE;
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
41
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
42 /* task and result share a cancellable, so either can be used here. */
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
43 if(g_task_return_error_if_cancelled(task)) {
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
44 g_clear_object(&task);
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
45
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
46 return;
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
47 }
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
48
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
49 can_reach = g_network_monitor_can_reach_finish(G_NETWORK_MONITOR(self), result,
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
50 &error);
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
51
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
52 if(error != NULL) {
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
53 g_task_return_error(task, error);
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
54 } else if(!can_reach) {
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
55 g_task_return_new_error(task, PURPLE_IRCV3_DOMAIN, 0,
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
56 _("Unknown network error."));
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
57 } else {
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
58 g_task_return_boolean(task, TRUE);
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
59 }
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
60
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
61 g_clear_object(&task);
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
62 }
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
63
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
64 /******************************************************************************
41772
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
65 * PurpleProtocol Implementation
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
66 *****************************************************************************/
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
67 static GList *
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
68 purple_ircv3_protocol_get_user_splits(G_GNUC_UNUSED PurpleProtocol *protocol) {
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
69 PurpleAccountUserSplit *split = NULL;
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
70 GList *splits = NULL;
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
71
41783
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
72 split = purple_account_user_split_new(_("Server"),
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
73 PURPLE_IRCV3_DEFAULT_SERVER,
41772
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
74 '@');
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
75 splits = g_list_append(splits, split);
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
76
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
77 return splits;
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
78 }
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
79
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
80 static GList *
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
81 purple_ircv3_protocol_get_account_options(G_GNUC_UNUSED PurpleProtocol *protocol)
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
82 {
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
83 PurpleAccountOption *option;
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
84 GList *options = NULL;
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
85
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
86 option = purple_account_option_int_new(_("Port"), "port",
41783
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
87 PURPLE_IRCV3_DEFAULT_TLS_PORT);
41772
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
88 options = g_list_append(options, option);
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
89
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
90 option = purple_account_option_bool_new(_("Use TLS"), "use-tls", TRUE);
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
91 options = g_list_append(options, option);
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
92
41955
d3117aac63b3 Add support for server passwords to the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents: 41941
diff changeset
93 option = purple_account_option_string_new(_("Server password"),
d3117aac63b3 Add support for server passwords to the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents: 41941
diff changeset
94 "server-password", "");
42469
b789ce8f43e2 IRCv3: Mask the server password in account options
Gary Kramlich <grim@reaperworld.com>
parents: 42320
diff changeset
95 purple_account_option_string_set_masked(option, TRUE);
41955
d3117aac63b3 Add support for server passwords to the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents: 41941
diff changeset
96 options = g_list_append(options, option);
d3117aac63b3 Add support for server passwords to the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents: 41941
diff changeset
97
41772
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
98 option = purple_account_option_string_new(_("Ident name"), "ident", "");
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
99 options = g_list_append(options, option);
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
100
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
101 option = purple_account_option_string_new(_("Real name"), "real-name", "");
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
102 options = g_list_append(options, option);
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
103
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
104 option = purple_account_option_string_new(_("SASL login name"),
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
105 "sasl-login-name", "");
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
106 options = g_list_append(options, option);
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
107
42044
37eaa6065a9a IRCv3: Add an account option to specify the SASL mechanisms
Gary Kramlich <grim@reaperworld.com>
parents: 41977
diff changeset
108 option = purple_account_option_string_new(_("SASL mechanisms"),
37eaa6065a9a IRCv3: Add an account option to specify the SASL mechanisms
Gary Kramlich <grim@reaperworld.com>
parents: 41977
diff changeset
109 "sasl-mechanisms", "");
37eaa6065a9a IRCv3: Add an account option to specify the SASL mechanisms
Gary Kramlich <grim@reaperworld.com>
parents: 41977
diff changeset
110 options = g_list_append(options, option);
37eaa6065a9a IRCv3: Add an account option to specify the SASL mechanisms
Gary Kramlich <grim@reaperworld.com>
parents: 41977
diff changeset
111
41772
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
112 option = purple_account_option_bool_new(_("Allow plaintext SASL auth over "
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
113 "unencrypted connection"),
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
114 "plain-sasl-in-clear", FALSE);
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
115 options = g_list_append(options, option);
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
116
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
117 option = purple_account_option_int_new(_("Seconds between sending "
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
118 "messages"),
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
119 "rate-limit-interval", 2);
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
120 options = g_list_append(options, option);
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
121
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
122 option = purple_account_option_int_new(_("Maximum messages to send at "
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
123 "once"),
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
124 "rate-limit-burst", 5);
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
125 options = g_list_append(options, option);
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
126
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
127 return options;
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
128 }
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
129
41870
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
130 static PurpleConnection *
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
131 purple_ircv3_protocol_create_connection(PurpleProtocol *protocol,
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
132 PurpleAccount *account,
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
133 const char *password,
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
134 GError **error)
41783
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
135 {
41870
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
136 const char *username = NULL;
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
137
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
138 g_return_val_if_fail(PURPLE_IS_PROTOCOL(protocol), NULL);
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
139 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL);
41783
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
140
41870
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
141 /* Make sure the username (which includes the servername via usersplits),
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
142 * does not contain any whitespace.
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
143 */
41977
bade7303795a Update all protocol except gg and xmpp for the account api deprecations
Gary Kramlich <grim@reaperworld.com>
parents: 41955
diff changeset
144 username = purple_contact_info_get_username(PURPLE_CONTACT_INFO(account));
41870
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
145 if(strpbrk(username, " \t\v\r\n") != NULL) {
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
146 g_set_error(error,
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
147 PURPLE_CONNECTION_ERROR,
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
148 PURPLE_CONNECTION_ERROR_INVALID_SETTINGS,
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
149 _("IRC nick and server may not contain whitespace"));
41783
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
150
41870
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
151 return NULL;
41783
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
152 }
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
153
41870
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
154 return g_object_new(
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
155 PURPLE_IRCV3_TYPE_CONNECTION,
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
156 "protocol", protocol,
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
157 "account", account,
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
158 "password", password,
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
159 NULL);
41783
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
160 }
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
161
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
162 static GList *
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
163 purple_ircv3_protocol_status_types(G_GNUC_UNUSED PurpleProtocol *protocol,
41941
355bd17297f0 Set the C standard to C99 and set warning_level to 2 for the IRCv3 Protocol Plugin
Gary Kramlich <grim@reaperworld.com>
parents: 41926
diff changeset
164 G_GNUC_UNUSED PurpleAccount *account)
41783
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
165 {
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
166 PurpleStatusType *type = NULL;
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
167 GList *types = NULL;
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
168
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
169 type = purple_status_type_new(PURPLE_STATUS_AVAILABLE, NULL, NULL, TRUE);
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
170 types = g_list_append(types, type);
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
171
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
172 type = purple_status_type_new_with_attrs(
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
173 PURPLE_STATUS_AWAY, NULL, NULL, TRUE, TRUE, FALSE,
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
174 "message", _("Message"), purple_value_new(G_TYPE_STRING),
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
175 NULL);
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
176 types = g_list_append(types, type);
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
177
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
178 type = purple_status_type_new(PURPLE_STATUS_OFFLINE, NULL, NULL, TRUE);
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
179 types = g_list_append(types, type);
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
180
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
181 return types;
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
182 }
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
183
42646
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
184 static void
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
185 purple_ircv3_protocol_can_connect_async(PurpleProtocol *protocol,
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
186 PurpleAccount *account,
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
187 GCancellable *cancellable,
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
188 GAsyncReadyCallback callback,
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
189 gpointer data)
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
190 {
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
191 GNetworkMonitor *monitor = NULL;
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
192 GSocketConnectable *connectable = NULL;
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
193 GStrv parts = NULL;
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
194 GTask *task = NULL;
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
195 const char *username = NULL;
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
196 gint port = 0;
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
197
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
198 task = g_task_new(protocol, cancellable, callback, data);
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
199
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
200 monitor = g_network_monitor_get_default();
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
201
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
202 username = purple_contact_info_get_username(PURPLE_CONTACT_INFO(account));
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
203 parts = g_strsplit(username, "@", 2);
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
204 port = purple_account_get_int(account, "port",
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
205 PURPLE_IRCV3_DEFAULT_TLS_PORT);
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
206
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
207 connectable = g_network_address_new(parts[1], (guint16)port);
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
208 g_strfreev(parts);
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
209
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
210 g_network_monitor_can_reach_async(monitor, connectable, cancellable,
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
211 purple_ircv3_protocol_can_reach_cb,
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
212 task);
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
213 g_clear_object(&connectable);
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
214 }
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
215
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
216 static gboolean
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
217 purple_ircv3_protocol_can_connect_finish(G_GNUC_UNUSED PurpleProtocol *protocol,
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
218 GAsyncResult *result,
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
219 GError **error)
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
220 {
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
221 return g_task_propagate_boolean(G_TASK(result), error);
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
222 }
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
223
41772
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
224 /******************************************************************************
41750
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
225 * GObject Implementation
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
226 *****************************************************************************/
41916
4ee9cb957595 Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41870
diff changeset
227 G_DEFINE_DYNAMIC_TYPE_EXTENDED(
4ee9cb957595 Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41870
diff changeset
228 PurpleIRCv3Protocol,
4ee9cb957595 Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41870
diff changeset
229 purple_ircv3_protocol,
4ee9cb957595 Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41870
diff changeset
230 PURPLE_TYPE_PROTOCOL,
41926
95d3df5d2f6e Fix the G_DEFINE_DYNAMIC_TYPE_EXTENDED macro for the IRCv3 plugin
Gary Kramlich <grim@reaperworld.com>
parents: 41916
diff changeset
231 0,
42320
21cab78fb7d2 IRCv3: Move from ProtocolIM to ProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42044
diff changeset
232 G_IMPLEMENT_INTERFACE_DYNAMIC(PURPLE_TYPE_PROTOCOL_CONVERSATION,
21cab78fb7d2 IRCv3: Move from ProtocolIM to ProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42044
diff changeset
233 purple_ircv3_protocol_conversation_init))
41750
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
234
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
235 static void
41941
355bd17297f0 Set the C standard to C99 and set warning_level to 2 for the IRCv3 Protocol Plugin
Gary Kramlich <grim@reaperworld.com>
parents: 41926
diff changeset
236 purple_ircv3_protocol_init(G_GNUC_UNUSED PurpleIRCv3Protocol *protocol) {
41750
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
237 }
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
238
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
239 static void
41941
355bd17297f0 Set the C standard to C99 and set warning_level to 2 for the IRCv3 Protocol Plugin
Gary Kramlich <grim@reaperworld.com>
parents: 41926
diff changeset
240 purple_ircv3_protocol_class_finalize(G_GNUC_UNUSED PurpleIRCv3ProtocolClass *klass) {
41750
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
241 }
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
242
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
243 static void
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
244 purple_ircv3_protocol_class_init(PurpleIRCv3ProtocolClass *klass) {
41772
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
245 PurpleProtocolClass *protocol_class = PURPLE_PROTOCOL_CLASS(klass);
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
246
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
247 protocol_class->get_user_splits = purple_ircv3_protocol_get_user_splits;
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
248 protocol_class->get_account_options =
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
249 purple_ircv3_protocol_get_account_options;
41870
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
250 protocol_class->create_connection =
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
251 purple_ircv3_protocol_create_connection;
41783
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
252 protocol_class->status_types = purple_ircv3_protocol_status_types;
42646
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
253 protocol_class->can_connect_async =
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
254 purple_ircv3_protocol_can_connect_async;
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
255 protocol_class->can_connect_finish =
b82b5609c044 Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents: 42568
diff changeset
256 purple_ircv3_protocol_can_connect_finish;
41750
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
257 }
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
258
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
259 /******************************************************************************
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
260 * GObject Implementation
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
261 *****************************************************************************/
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
262 void
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
263 purple_ircv3_protocol_register(GPluginNativePlugin *plugin) {
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
264 purple_ircv3_protocol_register_type(G_TYPE_MODULE(plugin));
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
265 }
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
266
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
267 PurpleProtocol *
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
268 purple_ircv3_protocol_new(void) {
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
269 return g_object_new(
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
270 PURPLE_IRCV3_TYPE_PROTOCOL,
41787
d25e0133b9ea Fix the ircv3 protocol id
Gary Kramlich <grim@reaperworld.com>
parents: 41783
diff changeset
271 "id", "prpl-ircv3",
41750
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
272 "name", "IRCv3",
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
273 "description", _("Version 3 of Internet Relay Chat (IRC)."),
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
274 "icon-name", "im-ircv3",
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
275 "icon-resource-path", "/im/pidgin/libpurple/ircv3/icons",
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
276 "options", OPT_PROTO_CHAT_TOPIC | OPT_PROTO_PASSWORD_OPTIONAL |
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
277 OPT_PROTO_SLASH_COMMANDS_NATIVE,
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
278 NULL);
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
279 }

mercurial