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