Sat, 01 Jul 2023 02:01:14 -0500
Add gobject-introspection for ircv3
This includes a pkgconfig file and installs the header files as well as
purpleircv3.h to ${prefix}/include/purple-3/libpurple/protocols/ircv3.
This does not yet include the documentation as I assume that's going to touch
a bunch of files.
Testing Done:
Compiled against gplugin 0.41.0 locally without issue. Also installed to a local prefix and verified everything looked okie dokie.
Reviewed at https://reviews.imfreedom.org/r/2484/
|
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 | |
|
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", ""); |
|
d3117aac63b3
Add support for server passwords to the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
41941
diff
changeset
|
58 | 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
|
59 | |
|
41772
e393090804c1
Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents:
41750
diff
changeset
|
60 | 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
|
61 | 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
|
62 | |
|
e393090804c1
Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents:
41750
diff
changeset
|
63 | 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
|
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_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
|
67 | "sasl-login-name", ""); |
|
e393090804c1
Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents:
41750
diff
changeset
|
68 | 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
|
69 | |
|
42044
37eaa6065a9a
IRCv3: Add an account option to specify the SASL mechanisms
Gary Kramlich <grim@reaperworld.com>
parents:
41977
diff
changeset
|
70 | 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
|
71 | "sasl-mechanisms", ""); |
|
37eaa6065a9a
IRCv3: Add an account option to specify the SASL mechanisms
Gary Kramlich <grim@reaperworld.com>
parents:
41977
diff
changeset
|
72 | 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
|
73 | |
|
41772
e393090804c1
Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents:
41750
diff
changeset
|
74 | 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
|
75 | "unencrypted connection"), |
|
e393090804c1
Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents:
41750
diff
changeset
|
76 | "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
|
77 | 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
|
78 | |
|
e393090804c1
Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents:
41750
diff
changeset
|
79 | 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
|
80 | "messages"), |
|
e393090804c1
Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents:
41750
diff
changeset
|
81 | "rate-limit-interval", 2); |
|
e393090804c1
Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents:
41750
diff
changeset
|
82 | 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
|
83 | |
|
e393090804c1
Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents:
41750
diff
changeset
|
84 | 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
|
85 | "once"), |
|
e393090804c1
Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents:
41750
diff
changeset
|
86 | "rate-limit-burst", 5); |
|
e393090804c1
Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents:
41750
diff
changeset
|
87 | 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
|
88 | |
|
e393090804c1
Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents:
41750
diff
changeset
|
89 | return options; |
|
e393090804c1
Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents:
41750
diff
changeset
|
90 | } |
|
e393090804c1
Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents:
41750
diff
changeset
|
91 | |
|
41870
7668d023ae05
Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents:
41814
diff
changeset
|
92 | static PurpleConnection * |
|
7668d023ae05
Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents:
41814
diff
changeset
|
93 | 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
|
94 | PurpleAccount *account, |
|
7668d023ae05
Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents:
41814
diff
changeset
|
95 | const char *password, |
|
7668d023ae05
Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents:
41814
diff
changeset
|
96 | GError **error) |
|
41783
5ea6c18ef7a8
Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
41772
diff
changeset
|
97 | { |
|
41870
7668d023ae05
Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents:
41814
diff
changeset
|
98 | const char *username = NULL; |
|
7668d023ae05
Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents:
41814
diff
changeset
|
99 | |
|
7668d023ae05
Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents:
41814
diff
changeset
|
100 | 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
|
101 | 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
|
102 | |
|
41870
7668d023ae05
Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents:
41814
diff
changeset
|
103 | /* 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
|
104 | * 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
|
105 | */ |
|
41977
bade7303795a
Update all protocol except gg and xmpp for the account api deprecations
Gary Kramlich <grim@reaperworld.com>
parents:
41955
diff
changeset
|
106 | 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
|
107 | 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
|
108 | g_set_error(error, |
|
7668d023ae05
Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents:
41814
diff
changeset
|
109 | PURPLE_CONNECTION_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_INVALID_SETTINGS, |
|
7668d023ae05
Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents:
41814
diff
changeset
|
111 | _("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
|
112 | |
|
41870
7668d023ae05
Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents:
41814
diff
changeset
|
113 | return 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 | |
|
41870
7668d023ae05
Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents:
41814
diff
changeset
|
116 | return g_object_new( |
|
7668d023ae05
Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents:
41814
diff
changeset
|
117 | PURPLE_IRCV3_TYPE_CONNECTION, |
|
7668d023ae05
Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents:
41814
diff
changeset
|
118 | "protocol", protocol, |
|
7668d023ae05
Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents:
41814
diff
changeset
|
119 | "account", account, |
|
7668d023ae05
Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents:
41814
diff
changeset
|
120 | "password", password, |
|
7668d023ae05
Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents:
41814
diff
changeset
|
121 | NULL); |
|
41783
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 | |
|
5ea6c18ef7a8
Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
41772
diff
changeset
|
124 | static GList * |
|
5ea6c18ef7a8
Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
41772
diff
changeset
|
125 | 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
|
126 | G_GNUC_UNUSED PurpleAccount *account) |
|
41783
5ea6c18ef7a8
Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
41772
diff
changeset
|
127 | { |
|
5ea6c18ef7a8
Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
41772
diff
changeset
|
128 | PurpleStatusType *type = NULL; |
|
5ea6c18ef7a8
Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
41772
diff
changeset
|
129 | GList *types = NULL; |
|
5ea6c18ef7a8
Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
41772
diff
changeset
|
130 | |
|
5ea6c18ef7a8
Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
41772
diff
changeset
|
131 | 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
|
132 | types = g_list_append(types, type); |
|
5ea6c18ef7a8
Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
41772
diff
changeset
|
133 | |
|
5ea6c18ef7a8
Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
41772
diff
changeset
|
134 | type = purple_status_type_new_with_attrs( |
|
5ea6c18ef7a8
Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
41772
diff
changeset
|
135 | 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
|
136 | "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
|
137 | NULL); |
|
5ea6c18ef7a8
Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
41772
diff
changeset
|
138 | types = g_list_append(types, type); |
|
5ea6c18ef7a8
Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
41772
diff
changeset
|
139 | |
|
5ea6c18ef7a8
Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
41772
diff
changeset
|
140 | 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
|
141 | types = g_list_append(types, type); |
|
5ea6c18ef7a8
Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
41772
diff
changeset
|
142 | |
|
5ea6c18ef7a8
Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
41772
diff
changeset
|
143 | return types; |
|
5ea6c18ef7a8
Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
41772
diff
changeset
|
144 | } |
|
5ea6c18ef7a8
Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
41772
diff
changeset
|
145 | |
|
41772
e393090804c1
Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents:
41750
diff
changeset
|
146 | /****************************************************************************** |
|
41750
7ab7d79ac0c5
Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
147 | * GObject Implementation |
|
7ab7d79ac0c5
Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
148 | *****************************************************************************/ |
|
41916
4ee9cb957595
Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
41870
diff
changeset
|
149 | G_DEFINE_DYNAMIC_TYPE_EXTENDED( |
|
4ee9cb957595
Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
41870
diff
changeset
|
150 | PurpleIRCv3Protocol, |
|
4ee9cb957595
Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
41870
diff
changeset
|
151 | purple_ircv3_protocol, |
|
4ee9cb957595
Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
41870
diff
changeset
|
152 | 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
|
153 | 0, |
|
41916
4ee9cb957595
Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
41870
diff
changeset
|
154 | G_IMPLEMENT_INTERFACE_DYNAMIC(PURPLE_TYPE_PROTOCOL_IM, |
|
4ee9cb957595
Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
41870
diff
changeset
|
155 | purple_ircv3_protocol_im_init)) |
|
41750
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 |
|
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
|
158 | 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
|
159 | } |
|
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 | 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
|
162 | 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
|
163 | } |
|
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 | static void |
|
7ab7d79ac0c5
Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
166 | 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
|
167 | 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
|
168 | |
|
e393090804c1
Add user splits and account options to the IRCv3 protocol
Gary Kramlich <grim@reaperworld.com>
parents:
41750
diff
changeset
|
169 | 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
|
170 | 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
|
171 | 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
|
172 | protocol_class->create_connection = |
|
7668d023ae05
Update the IRCv3 protocol plugin to the new connection setup
Gary Kramlich <grim@reaperworld.com>
parents:
41814
diff
changeset
|
173 | purple_ircv3_protocol_create_connection; |
|
41783
5ea6c18ef7a8
Add the ability to connect to IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
41772
diff
changeset
|
174 | 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
|
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 | /****************************************************************************** |
|
7ab7d79ac0c5
Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
178 | * GObject Implementation |
|
7ab7d79ac0c5
Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
179 | *****************************************************************************/ |
|
7ab7d79ac0c5
Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
180 | void |
|
7ab7d79ac0c5
Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
181 | purple_ircv3_protocol_register(GPluginNativePlugin *plugin) { |
|
7ab7d79ac0c5
Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
182 | 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
|
183 | } |
|
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 | PurpleProtocol * |
|
7ab7d79ac0c5
Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
186 | purple_ircv3_protocol_new(void) { |
|
7ab7d79ac0c5
Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
187 | return g_object_new( |
|
7ab7d79ac0c5
Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
188 | PURPLE_IRCV3_TYPE_PROTOCOL, |
|
41787
d25e0133b9ea
Fix the ircv3 protocol id
Gary Kramlich <grim@reaperworld.com>
parents:
41783
diff
changeset
|
189 | "id", "prpl-ircv3", |
|
41750
7ab7d79ac0c5
Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
190 | "name", "IRCv3", |
|
7ab7d79ac0c5
Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
191 | "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
|
192 | "icon-name", "im-ircv3", |
|
7ab7d79ac0c5
Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
193 | "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
|
194 | "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
|
195 | OPT_PROTO_SLASH_COMMANDS_NATIVE, |
|
7ab7d79ac0c5
Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
196 | NULL); |
|
7ab7d79ac0c5
Create a skeleton for the IRCv3 protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
197 | } |