libpurple/protocols/ircv3/purpleircv3protocol.c

Tue, 29 Nov 2022 00:06:45 -0600

author
Gary Kramlich <grim@reaperworld.com>
date
Tue, 29 Nov 2022 00:06:45 -0600
changeset 41951
00c472cd0fff
parent 41941
355bd17297f0
child 41955
d3117aac63b3
permissions
-rw-r--r--

Create PurpleIRCv3Capabilities for managing capabilities for each connection

This implements everything in capabilities version 302 except for handling the
NEW and DEL commands from the server. I'm not sure how we can test that yet,
so we're ignoring it for now.

After the server has told us about all of the capabilities it supports, we
explicitly request cap-notify which we implictly request when we send
CAP LS 302. This is mostly to test our code and might be removed in the future.

Testing Done:
Connected to my local ergo and used ngrep to verify that everything was being sent correctly.

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

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 *
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
5 * This program is free software; you can redistribute it and/or modify
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
6 * 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
7 * 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
8 * (at your option) any later version.
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
9 *
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful,
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
11 * 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
12 * 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
13 * GNU General Public License for more details.
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
14 *
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
16 * along with this program; if not, see <https://www.gnu.org/licenses/>.
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
17 */
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 #include <glib/gi18n-lib.h>
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
20
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
21 #include "purpleircv3protocol.h"
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
22
41783
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
23 #include "purpleircv3connection.h"
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
24 #include "purpleircv3core.h"
41916
4ee9cb957595 Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41870
diff changeset
25 #include "purpleircv3protocolim.h"
41772
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
26
41750
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
27 /******************************************************************************
41772
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
28 * PurpleProtocol Implementation
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
29 *****************************************************************************/
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
30 static GList *
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
31 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
32 PurpleAccountUserSplit *split = NULL;
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
33 GList *splits = NULL;
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
34
41783
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
35 split = purple_account_user_split_new(_("Server"),
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
36 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
37 '@');
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
38 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
39
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
40 return splits;
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
41 }
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
42
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
43 static GList *
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
44 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
45 {
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
46 PurpleAccountOption *option;
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
47 GList *options = NULL;
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
48
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
49 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
50 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
51 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
52
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
53 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
54 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
55
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
56 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
57 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
58
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
59 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
60 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
61
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
62 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
63 "sasl-login-name", "");
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
64 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
65
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
66 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
67 "unencrypted connection"),
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
68 "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
69 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
70
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
71 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
72 "messages"),
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
73 "rate-limit-interval", 2);
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
74 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
75
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
76 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
77 "once"),
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
78 "rate-limit-burst", 5);
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
79 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
80
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
81 return options;
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
41870
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
84 static PurpleConnection *
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
85 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
86 PurpleAccount *account,
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
87 const char *password,
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
88 GError **error)
41783
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
89 {
41870
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
90 const char *username = NULL;
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
91
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
92 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
93 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
94
41870
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
95 /* 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
96 * 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
97 */
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
98 username = purple_account_get_username(account);
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
99 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
100 g_set_error(error,
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
101 PURPLE_CONNECTION_ERROR,
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
102 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
103 _("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
104
41870
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
105 return NULL;
41783
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
106 }
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
107
41870
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
108 return g_object_new(
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
109 PURPLE_IRCV3_TYPE_CONNECTION,
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
110 "protocol", protocol,
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
111 "account", account,
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
112 "password", password,
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
113 NULL);
41783
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
114 }
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
115
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
116 static GList *
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
117 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
118 G_GNUC_UNUSED PurpleAccount *account)
41783
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
119 {
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
120 PurpleStatusType *type = NULL;
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
121 GList *types = NULL;
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
122
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
123 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
124 types = g_list_append(types, type);
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
125
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
126 type = purple_status_type_new_with_attrs(
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
127 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
128 "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
129 NULL);
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
130 types = g_list_append(types, type);
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
131
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
132 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
133 types = g_list_append(types, type);
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
134
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
135 return types;
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
136 }
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
137
41772
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
138 /******************************************************************************
41750
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
139 * GObject Implementation
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
140 *****************************************************************************/
41916
4ee9cb957595 Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41870
diff changeset
141 G_DEFINE_DYNAMIC_TYPE_EXTENDED(
4ee9cb957595 Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41870
diff changeset
142 PurpleIRCv3Protocol,
4ee9cb957595 Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41870
diff changeset
143 purple_ircv3_protocol,
4ee9cb957595 Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41870
diff changeset
144 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
145 0,
41916
4ee9cb957595 Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41870
diff changeset
146 G_IMPLEMENT_INTERFACE_DYNAMIC(PURPLE_TYPE_PROTOCOL_IM,
4ee9cb957595 Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41870
diff changeset
147 purple_ircv3_protocol_im_init))
41750
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
148
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
149 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
150 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
151 }
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
152
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
153 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
154 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
155 }
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
156
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
157 static void
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
158 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
159 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
160
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
161 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
162 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
163 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
164 protocol_class->create_connection =
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
165 purple_ircv3_protocol_create_connection;
41783
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
166 protocol_class->status_types = purple_ircv3_protocol_status_types;
41750
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
167 }
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
168
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
169 /******************************************************************************
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
170 * GObject Implementation
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
171 *****************************************************************************/
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
172 void
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
173 purple_ircv3_protocol_register(GPluginNativePlugin *plugin) {
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
174 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
175 }
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
176
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
177 PurpleProtocol *
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
178 purple_ircv3_protocol_new(void) {
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
179 return g_object_new(
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
180 PURPLE_IRCV3_TYPE_PROTOCOL,
41787
d25e0133b9ea Fix the ircv3 protocol id
Gary Kramlich <grim@reaperworld.com>
parents: 41783
diff changeset
181 "id", "prpl-ircv3",
41750
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
182 "name", "IRCv3",
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
183 "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
184 "icon-name", "im-ircv3",
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
185 "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
186 "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
187 OPT_PROTO_SLASH_COMMANDS_NATIVE,
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
188 NULL);
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
189 }

mercurial