libpurple/protocols/ircv3/purpleircv3protocol.c

Thu, 02 Nov 2023 23:38:51 -0500

author
Elliott Sales de Andrade <quantum.analyst@gmail.com>
date
Thu, 02 Nov 2023 23:38:51 -0500
changeset 42472
409148c5c5b7
parent 42469
b789ce8f43e2
child 42568
31e8c7c92e2f
permissions
-rw-r--r--

Add symbol visibility on IRCv3 protocol plugin

This only adds visibility to things that have `Since: 3.0.0` _and_ are not already tagged with `G_GNUC_INTERNAL`.

It also assumes that the version is the same as libpurple, but that 3.0 is the minimum instead of 2.0, so everything is `PURPLE_IRCV3_AVAILABLE_IN_ALL`.

Testing Done:
Compiled on Linux and Windows.

Bugs closed: PIDGIN-17840

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

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"
42320
21cab78fb7d2 IRCv3: Move from ProtocolIM to ProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42044
diff changeset
25 #include "purpleircv3protocolconversation.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
41955
d3117aac63b3 Add support for server passwords to the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents: 41941
diff changeset
56 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
57 "server-password", "");
42469
b789ce8f43e2 IRCv3: Mask the server password in account options
Gary Kramlich <grim@reaperworld.com>
parents: 42320
diff changeset
58 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
59 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
60
41772
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
61 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
62 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
63
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
64 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
65 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
66
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
67 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
68 "sasl-login-name", "");
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
42044
37eaa6065a9a IRCv3: Add an account option to specify the SASL mechanisms
Gary Kramlich <grim@reaperworld.com>
parents: 41977
diff changeset
71 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
72 "sasl-mechanisms", "");
37eaa6065a9a IRCv3: Add an account option to specify the SASL mechanisms
Gary Kramlich <grim@reaperworld.com>
parents: 41977
diff changeset
73 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
74
41772
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
75 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
76 "unencrypted connection"),
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
77 "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
78 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
79
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
80 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
81 "messages"),
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
82 "rate-limit-interval", 2);
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
83 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
84
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
85 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
86 "once"),
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
87 "rate-limit-burst", 5);
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 return options;
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
91 }
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
92
41870
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
93 static PurpleConnection *
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
94 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
95 PurpleAccount *account,
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
96 const char *password,
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
97 GError **error)
41783
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
98 {
41870
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
99 const char *username = NULL;
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
100
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
101 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
102 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
103
41870
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
104 /* 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
105 * 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
106 */
41977
bade7303795a Update all protocol except gg and xmpp for the account api deprecations
Gary Kramlich <grim@reaperworld.com>
parents: 41955
diff changeset
107 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
108 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
109 g_set_error(error,
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
110 PURPLE_CONNECTION_ERROR,
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
111 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
112 _("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
113
41870
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
114 return NULL;
41783
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
41870
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
117 return g_object_new(
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
118 PURPLE_IRCV3_TYPE_CONNECTION,
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
119 "protocol", protocol,
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
120 "account", account,
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
121 "password", password,
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
122 NULL);
41783
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
123 }
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
124
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
125 static GList *
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
126 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
127 G_GNUC_UNUSED PurpleAccount *account)
41783
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
128 {
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
129 PurpleStatusType *type = NULL;
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
130 GList *types = NULL;
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_AVAILABLE, 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 type = purple_status_type_new_with_attrs(
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
136 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
137 "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
138 NULL);
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
139 types = g_list_append(types, type);
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
140
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
141 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
142 types = g_list_append(types, type);
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
143
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
144 return types;
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
145 }
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
146
41772
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
147 /******************************************************************************
41750
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
148 * GObject Implementation
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
149 *****************************************************************************/
41916
4ee9cb957595 Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41870
diff changeset
150 G_DEFINE_DYNAMIC_TYPE_EXTENDED(
4ee9cb957595 Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41870
diff changeset
151 PurpleIRCv3Protocol,
4ee9cb957595 Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41870
diff changeset
152 purple_ircv3_protocol,
4ee9cb957595 Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41870
diff changeset
153 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
154 0,
42320
21cab78fb7d2 IRCv3: Move from ProtocolIM to ProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42044
diff changeset
155 G_IMPLEMENT_INTERFACE_DYNAMIC(PURPLE_TYPE_PROTOCOL_CONVERSATION,
21cab78fb7d2 IRCv3: Move from ProtocolIM to ProtocolConversation
Gary Kramlich <grim@reaperworld.com>
parents: 42044
diff changeset
156 purple_ircv3_protocol_conversation_init))
41750
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
157
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
158 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
159 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
160 }
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
161
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
162 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
163 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
164 }
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
165
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
166 static void
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
167 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
168 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
169
e393090804c1 Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents: 41750
diff changeset
170 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
171 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
172 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
173 protocol_class->create_connection =
7668d023ae05 Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents: 41814
diff changeset
174 purple_ircv3_protocol_create_connection;
41783
5ea6c18ef7a8 Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents: 41772
diff changeset
175 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
176 }
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
177
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
178 /******************************************************************************
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
179 * GObject Implementation
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
180 *****************************************************************************/
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
181 void
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
182 purple_ircv3_protocol_register(GPluginNativePlugin *plugin) {
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
183 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
184 }
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
185
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
186 PurpleProtocol *
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
187 purple_ircv3_protocol_new(void) {
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
188 return g_object_new(
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
189 PURPLE_IRCV3_TYPE_PROTOCOL,
41787
d25e0133b9ea Fix the ircv3 protocol id
Gary Kramlich <grim@reaperworld.com>
parents: 41783
diff changeset
190 "id", "prpl-ircv3",
41750
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
191 "name", "IRCv3",
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
192 "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
193 "icon-name", "im-ircv3",
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
194 "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
195 "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
196 OPT_PROTO_SLASH_COMMANDS_NATIVE,
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
197 NULL);
7ab7d79ac0c5 Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
198 }

mercurial