Tue, 29 Nov 2022 00:06:45 -0600
Create PurpleIRCv3Capabilities for managing capabilities for each connection
This implements everything in capabilities version 302 except for handling the
NEW and DEL commands from the server. I'm not sure how we can test that yet,
so we're ignoring it for now.
After the server has told us about all of the capabilities it supports, we
explicitly request cap-notify which we implictly request when we send
CAP LS 302. This is mostly to test our code and might be removed in the future.
Testing Done:
Connected to my local ergo and used ngrep to verify that everything was being sent correctly.
Reviewed at https://reviews.imfreedom.org/r/2100/
|
41916
4ee9cb957595
Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1 | /* |
|
4ee9cb957595
Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
2 | * Purple - Internet Messaging Library |
|
4ee9cb957595
Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
3 | * Copyright (C) Pidgin Developers <devel@pidgin.im> |
|
4ee9cb957595
Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
4 | * |
|
4ee9cb957595
Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
5 | * This library is free software; you can redistribute it and/or |
|
4ee9cb957595
Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
6 | * modify it under the terms of the GNU Lesser General Public |
|
4ee9cb957595
Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
7 | * License as published by the Free Software Foundation; either |
|
4ee9cb957595
Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
8 | * version 2 of the License, or (at your option) any later version. |
|
4ee9cb957595
Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
9 | * |
|
4ee9cb957595
Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
10 | * This library is distributed in the hope that it will be useful, |
|
4ee9cb957595
Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
4ee9cb957595
Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
4ee9cb957595
Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
13 | * Lesser General Public License for more details. |
|
4ee9cb957595
Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
14 | * |
|
4ee9cb957595
Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
15 | * You should have received a copy of the GNU Lesser General Public |
|
4ee9cb957595
Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
16 | * License along with this library; if not, see <https://www.gnu.org/licenses/>. |
|
4ee9cb957595
Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
17 | */ |
|
4ee9cb957595
Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
18 | |
|
4ee9cb957595
Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
19 | #include <glib/gi18n-lib.h> |
|
4ee9cb957595
Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
20 | |
|
4ee9cb957595
Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
21 | #include "purpleircv3protocolim.h" |
|
4ee9cb957595
Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
22 | |
|
4ee9cb957595
Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
23 | #include "purpleircv3connection.h" |
|
4ee9cb957595
Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
24 | |
|
4ee9cb957595
Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
25 | /****************************************************************************** |
|
4ee9cb957595
Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
26 | * PurpleProtocolIM Implementation |
|
4ee9cb957595
Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
27 | *****************************************************************************/ |
|
4ee9cb957595
Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
28 | static gint |
|
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:
41916
diff
changeset
|
29 | purple_ircv3_protocol_send_im(G_GNUC_UNUSED PurpleProtocolIM *im, |
|
41916
4ee9cb957595
Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
30 | PurpleConnection *conn, |
|
4ee9cb957595
Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
31 | PurpleMessage *message) |
|
4ee9cb957595
Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
32 | { |
|
4ee9cb957595
Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
33 | PurpleIRCv3Connection *connection = PURPLE_IRCV3_CONNECTION(conn); |
|
4ee9cb957595
Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
34 | const char *contents = NULL; |
|
4ee9cb957595
Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
35 | const char *recipient = NULL; |
|
4ee9cb957595
Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
36 | |
|
4ee9cb957595
Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
37 | contents = purple_message_get_contents(message); |
|
4ee9cb957595
Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
38 | recipient = purple_message_get_recipient(message); |
|
4ee9cb957595
Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
39 | |
|
4ee9cb957595
Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
40 | purple_ircv3_connection_writef(connection, "PRIVMSG %s :%s", recipient, |
|
4ee9cb957595
Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
41 | contents); |
|
4ee9cb957595
Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
42 | |
|
4ee9cb957595
Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
43 | return 1; |
|
4ee9cb957595
Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
44 | } |
|
4ee9cb957595
Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
45 | |
|
4ee9cb957595
Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
46 | void |
|
4ee9cb957595
Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
47 | purple_ircv3_protocol_im_init(PurpleProtocolIMInterface *iface) { |
|
4ee9cb957595
Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
48 | iface->send = purple_ircv3_protocol_send_im; |
|
4ee9cb957595
Implement sending im's for IRCv3
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
49 | } |