Thu, 17 Jul 2025 20:28:54 -0500
IRCv3: Implement the /me command
This was kind of forgotten about, but it's here now.
Testing Done:
Watched a packet dump to verify it was sent correct and asked people in #pidgin on libera if it came through correctly.
Reviewed at https://reviews.imfreedom.org/r/4070/
|
43097
757575456cc2
IRCv3: Implement the query command
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1 | /* |
|
757575456cc2
IRCv3: Implement the query command
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
2 | * Purple - Internet Messaging Library |
|
757575456cc2
IRCv3: Implement the query command
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
3 | * Copyright (C) Pidgin Developers <devel@pidgin.im> |
|
757575456cc2
IRCv3: Implement the query command
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
4 | * |
|
757575456cc2
IRCv3: Implement the query command
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
5 | * Purple is the legal property of its developers, whose names are too numerous |
|
757575456cc2
IRCv3: Implement the query command
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
6 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
757575456cc2
IRCv3: Implement the query command
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
7 | * source distribution. |
|
757575456cc2
IRCv3: Implement the query command
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
8 | * |
|
757575456cc2
IRCv3: Implement the query command
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
9 | * This library is free software; you can redistribute it and/or modify |
|
757575456cc2
IRCv3: Implement the query command
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
10 | * it under the terms of the GNU General Public License as published by |
|
757575456cc2
IRCv3: Implement the query command
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
11 | * the Free Software Foundation; either version 2 of the License, or |
|
757575456cc2
IRCv3: Implement the query command
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
12 | * (at your option) any later version. |
|
757575456cc2
IRCv3: Implement the query command
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
13 | * |
|
757575456cc2
IRCv3: Implement the query command
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
14 | * This library is distributed in the hope that it will be useful, |
|
757575456cc2
IRCv3: Implement the query command
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
757575456cc2
IRCv3: Implement the query command
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
757575456cc2
IRCv3: Implement the query command
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
17 | * GNU General Public License for more details. |
|
757575456cc2
IRCv3: Implement the query command
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
18 | * |
|
757575456cc2
IRCv3: Implement the query command
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
19 | * You should have received a copy of the GNU General Public License |
|
757575456cc2
IRCv3: Implement the query command
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
20 | * along with this library; if not, see <https://www.gnu.org/licenses/>. |
|
757575456cc2
IRCv3: Implement the query command
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
21 | */ |
|
757575456cc2
IRCv3: Implement the query command
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
22 | |
|
757575456cc2
IRCv3: Implement the query command
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
23 | #include "purpleircv3commands.h" |
|
757575456cc2
IRCv3: Implement the query command
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
24 | |
|
757575456cc2
IRCv3: Implement the query command
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
25 | #include "purpleircv3connection.h" |
|
43290
01edcfbfebaa
IRCv3: Implement the /me command
Gary Kramlich <grim@reaperworld.com>
parents:
43126
diff
changeset
|
26 | #include "purpleircv3protocol.h" |
|
43097
757575456cc2
IRCv3: Implement the query command
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
27 | |
|
757575456cc2
IRCv3: Implement the query command
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
28 | /****************************************************************************** |
|
757575456cc2
IRCv3: Implement the query command
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
29 | * Internal Callbacks |
|
757575456cc2
IRCv3: Implement the query command
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
30 | *****************************************************************************/ |
|
757575456cc2
IRCv3: Implement the query command
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
31 | gboolean |
|
757575456cc2
IRCv3: Implement the query command
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
32 | purple_ircv3_command_query_cb(G_GNUC_UNUSED PurpleCommand *command, |
|
757575456cc2
IRCv3: Implement the query command
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
33 | PurpleConversation *conversation, |
|
757575456cc2
IRCv3: Implement the query command
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
34 | GStrv params, |
|
757575456cc2
IRCv3: Implement the query command
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
35 | G_GNUC_UNUSED gpointer data) |
|
757575456cc2
IRCv3: Implement the query command
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
36 | { |
|
43126
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
37 | PurpleIRCv3Connection *v3_connection = NULL; |
|
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
38 | PurpleAccount *account = NULL; |
|
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
39 | PurpleConnection *connection = NULL; |
|
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
40 | PurpleConversation *new_conversation = NULL; |
|
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
41 | guint n_params = 0; |
|
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
42 | |
|
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
43 | n_params = g_strv_length(params); |
|
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
44 | if(n_params < 1) { |
|
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
45 | return FALSE; |
|
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
46 | } |
|
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
47 | |
|
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
48 | account = purple_conversation_get_account(conversation); |
|
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
49 | connection = purple_account_get_connection(account); |
|
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
50 | v3_connection = PURPLE_IRCV3_CONNECTION(connection); |
|
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
51 | |
|
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
52 | new_conversation = purple_ircv3_connection_find_or_create_conversation(v3_connection, |
|
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
53 | params[0]); |
|
43097
757575456cc2
IRCv3: Implement the query command
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
54 | |
|
43126
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
55 | if(n_params > 1) { |
|
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
56 | PurpleMessage *message = NULL; |
|
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
57 | PurpleContactInfo *info = NULL; |
|
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
58 | PurpleConversationMember *member = NULL; |
|
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
59 | PurpleConversationMembers *members = NULL; |
|
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
60 | char *contents = NULL; |
|
43097
757575456cc2
IRCv3: Implement the query command
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
61 | |
|
43126
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
62 | info = purple_account_get_contact_info(account); |
|
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
63 | members = purple_conversation_get_members(conversation); |
|
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
64 | member = purple_conversation_members_find_member(members, info); |
|
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
65 | |
|
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
66 | contents = g_strjoinv(" ", params + 1); |
|
43097
757575456cc2
IRCv3: Implement the query command
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
67 | |
|
43126
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
68 | message = purple_message_new(member, contents); |
|
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
69 | g_free(contents); |
|
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
70 | |
|
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
71 | purple_conversation_send_message_async(new_conversation, message, NULL, |
|
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
72 | NULL, NULL); |
|
43097
757575456cc2
IRCv3: Implement the query command
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
73 | |
|
43126
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
74 | g_clear_object(&message); |
|
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
75 | } |
|
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
76 | |
|
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
77 | return TRUE; |
|
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
78 | } |
|
43097
757575456cc2
IRCv3: Implement the query command
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
79 | |
|
43126
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
80 | gboolean |
|
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
81 | purple_ircv3_command_quote_cb(G_GNUC_UNUSED PurpleCommand *command, |
|
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
82 | PurpleConversation *conversation, |
|
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
83 | GStrv params, |
|
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
84 | G_GNUC_UNUSED gpointer data) |
|
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
85 | { |
|
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
86 | IbisMessage *message = NULL; |
|
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
87 | char *raw = NULL; |
|
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
88 | |
|
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
89 | raw = g_strjoinv(" ", params); |
|
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
90 | message = ibis_message_parse(raw, NULL); |
|
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
91 | g_free(raw); |
|
43100
e6df74d36862
Change Purple.Message:author to Purple.ConversationMember
Gary Kramlich <grim@reaperworld.com>
parents:
43097
diff
changeset
|
92 | |
|
43126
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
93 | if(IBIS_IS_MESSAGE(message)) { |
|
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
94 | PurpleIRCv3Connection *v3_connection = NULL; |
|
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
95 | PurpleAccount *account = NULL; |
|
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
96 | PurpleConnection *connection = NULL; |
|
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
97 | IbisClient *client = NULL; |
|
43097
757575456cc2
IRCv3: Implement the query command
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
98 | |
|
43126
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
99 | account = purple_conversation_get_account(conversation); |
|
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
100 | connection = purple_account_get_connection(account); |
|
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
101 | v3_connection = PURPLE_IRCV3_CONNECTION(connection); |
|
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
102 | client = purple_ircv3_connection_get_client(v3_connection); |
|
43097
757575456cc2
IRCv3: Implement the query command
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
103 | |
|
43126
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
104 | ibis_client_write(client, message); |
|
43097
757575456cc2
IRCv3: Implement the query command
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
105 | |
|
43126
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
106 | return TRUE; |
|
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
107 | } |
|
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
108 | |
|
5b5a883528e0
IRCv3: Add the quote command to send raw messages
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
109 | return FALSE; |
|
43097
757575456cc2
IRCv3: Implement the query command
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
110 | } |
|
43290
01edcfbfebaa
IRCv3: Implement the /me command
Gary Kramlich <grim@reaperworld.com>
parents:
43126
diff
changeset
|
111 | |
|
01edcfbfebaa
IRCv3: Implement the /me command
Gary Kramlich <grim@reaperworld.com>
parents:
43126
diff
changeset
|
112 | gboolean |
|
01edcfbfebaa
IRCv3: Implement the /me command
Gary Kramlich <grim@reaperworld.com>
parents:
43126
diff
changeset
|
113 | purple_ircv3_command_action_cb(G_GNUC_UNUSED PurpleCommand *command, |
|
01edcfbfebaa
IRCv3: Implement the /me command
Gary Kramlich <grim@reaperworld.com>
parents:
43126
diff
changeset
|
114 | PurpleConversation *conversation, |
|
01edcfbfebaa
IRCv3: Implement the /me command
Gary Kramlich <grim@reaperworld.com>
parents:
43126
diff
changeset
|
115 | GStrv params, |
|
01edcfbfebaa
IRCv3: Implement the /me command
Gary Kramlich <grim@reaperworld.com>
parents:
43126
diff
changeset
|
116 | gpointer data) |
|
01edcfbfebaa
IRCv3: Implement the /me command
Gary Kramlich <grim@reaperworld.com>
parents:
43126
diff
changeset
|
117 | { |
|
01edcfbfebaa
IRCv3: Implement the /me command
Gary Kramlich <grim@reaperworld.com>
parents:
43126
diff
changeset
|
118 | PurpleIRCv3Protocol *protocol = data; |
|
01edcfbfebaa
IRCv3: Implement the /me command
Gary Kramlich <grim@reaperworld.com>
parents:
43126
diff
changeset
|
119 | PurpleAccount *account = NULL; |
|
01edcfbfebaa
IRCv3: Implement the /me command
Gary Kramlich <grim@reaperworld.com>
parents:
43126
diff
changeset
|
120 | PurpleContactInfo *info = NULL; |
|
01edcfbfebaa
IRCv3: Implement the /me command
Gary Kramlich <grim@reaperworld.com>
parents:
43126
diff
changeset
|
121 | PurpleConversationMember *author = NULL; |
|
01edcfbfebaa
IRCv3: Implement the /me command
Gary Kramlich <grim@reaperworld.com>
parents:
43126
diff
changeset
|
122 | PurpleConversationMembers *members = NULL; |
|
01edcfbfebaa
IRCv3: Implement the /me command
Gary Kramlich <grim@reaperworld.com>
parents:
43126
diff
changeset
|
123 | PurpleMessage *message = NULL; |
|
01edcfbfebaa
IRCv3: Implement the /me command
Gary Kramlich <grim@reaperworld.com>
parents:
43126
diff
changeset
|
124 | PurpleProtocolConversation *protocol_conversation = NULL; |
|
01edcfbfebaa
IRCv3: Implement the /me command
Gary Kramlich <grim@reaperworld.com>
parents:
43126
diff
changeset
|
125 | char *contents = NULL; |
|
01edcfbfebaa
IRCv3: Implement the /me command
Gary Kramlich <grim@reaperworld.com>
parents:
43126
diff
changeset
|
126 | |
|
01edcfbfebaa
IRCv3: Implement the /me command
Gary Kramlich <grim@reaperworld.com>
parents:
43126
diff
changeset
|
127 | account = purple_conversation_get_account(conversation); |
|
01edcfbfebaa
IRCv3: Implement the /me command
Gary Kramlich <grim@reaperworld.com>
parents:
43126
diff
changeset
|
128 | info = purple_account_get_contact_info(account); |
|
01edcfbfebaa
IRCv3: Implement the /me command
Gary Kramlich <grim@reaperworld.com>
parents:
43126
diff
changeset
|
129 | members = purple_conversation_get_members(conversation); |
|
01edcfbfebaa
IRCv3: Implement the /me command
Gary Kramlich <grim@reaperworld.com>
parents:
43126
diff
changeset
|
130 | author = purple_conversation_members_find_member(members, info); |
|
01edcfbfebaa
IRCv3: Implement the /me command
Gary Kramlich <grim@reaperworld.com>
parents:
43126
diff
changeset
|
131 | |
|
01edcfbfebaa
IRCv3: Implement the /me command
Gary Kramlich <grim@reaperworld.com>
parents:
43126
diff
changeset
|
132 | contents = g_strjoinv(" ", params); |
|
01edcfbfebaa
IRCv3: Implement the /me command
Gary Kramlich <grim@reaperworld.com>
parents:
43126
diff
changeset
|
133 | message = purple_message_new(author, contents); |
|
01edcfbfebaa
IRCv3: Implement the /me command
Gary Kramlich <grim@reaperworld.com>
parents:
43126
diff
changeset
|
134 | g_free(contents); |
|
01edcfbfebaa
IRCv3: Implement the /me command
Gary Kramlich <grim@reaperworld.com>
parents:
43126
diff
changeset
|
135 | |
|
01edcfbfebaa
IRCv3: Implement the /me command
Gary Kramlich <grim@reaperworld.com>
parents:
43126
diff
changeset
|
136 | purple_message_set_action(message, TRUE); |
|
01edcfbfebaa
IRCv3: Implement the /me command
Gary Kramlich <grim@reaperworld.com>
parents:
43126
diff
changeset
|
137 | |
|
01edcfbfebaa
IRCv3: Implement the /me command
Gary Kramlich <grim@reaperworld.com>
parents:
43126
diff
changeset
|
138 | protocol_conversation = PURPLE_PROTOCOL_CONVERSATION(protocol); |
|
01edcfbfebaa
IRCv3: Implement the /me command
Gary Kramlich <grim@reaperworld.com>
parents:
43126
diff
changeset
|
139 | purple_protocol_conversation_send_message_async(protocol_conversation, |
|
01edcfbfebaa
IRCv3: Implement the /me command
Gary Kramlich <grim@reaperworld.com>
parents:
43126
diff
changeset
|
140 | conversation, |
|
01edcfbfebaa
IRCv3: Implement the /me command
Gary Kramlich <grim@reaperworld.com>
parents:
43126
diff
changeset
|
141 | message, |
|
01edcfbfebaa
IRCv3: Implement the /me command
Gary Kramlich <grim@reaperworld.com>
parents:
43126
diff
changeset
|
142 | NULL, |
|
01edcfbfebaa
IRCv3: Implement the /me command
Gary Kramlich <grim@reaperworld.com>
parents:
43126
diff
changeset
|
143 | NULL, |
|
01edcfbfebaa
IRCv3: Implement the /me command
Gary Kramlich <grim@reaperworld.com>
parents:
43126
diff
changeset
|
144 | NULL); |
|
01edcfbfebaa
IRCv3: Implement the /me command
Gary Kramlich <grim@reaperworld.com>
parents:
43126
diff
changeset
|
145 | |
|
01edcfbfebaa
IRCv3: Implement the /me command
Gary Kramlich <grim@reaperworld.com>
parents:
43126
diff
changeset
|
146 | g_clear_object(&message); |
|
01edcfbfebaa
IRCv3: Implement the /me command
Gary Kramlich <grim@reaperworld.com>
parents:
43126
diff
changeset
|
147 | |
|
01edcfbfebaa
IRCv3: Implement the /me command
Gary Kramlich <grim@reaperworld.com>
parents:
43126
diff
changeset
|
148 | return TRUE; |
|
01edcfbfebaa
IRCv3: Implement the /me command
Gary Kramlich <grim@reaperworld.com>
parents:
43126
diff
changeset
|
149 | } |