protocols/ircv3/purpleircv3commands.c

changeset 43290
01edcfbfebaa
parent 43126
5b5a883528e0
equal deleted inserted replaced
43289:b39dbed64dc0 43290:01edcfbfebaa
21 */ 21 */
22 22
23 #include "purpleircv3commands.h" 23 #include "purpleircv3commands.h"
24 24
25 #include "purpleircv3connection.h" 25 #include "purpleircv3connection.h"
26 #include "purpleircv3protocol.h"
26 27
27 /****************************************************************************** 28 /******************************************************************************
28 * Internal Callbacks 29 * Internal Callbacks
29 *****************************************************************************/ 30 *****************************************************************************/
30 gboolean 31 gboolean
105 return TRUE; 106 return TRUE;
106 } 107 }
107 108
108 return FALSE; 109 return FALSE;
109 } 110 }
111
112 gboolean
113 purple_ircv3_command_action_cb(G_GNUC_UNUSED PurpleCommand *command,
114 PurpleConversation *conversation,
115 GStrv params,
116 gpointer data)
117 {
118 PurpleIRCv3Protocol *protocol = data;
119 PurpleAccount *account = NULL;
120 PurpleContactInfo *info = NULL;
121 PurpleConversationMember *author = NULL;
122 PurpleConversationMembers *members = NULL;
123 PurpleMessage *message = NULL;
124 PurpleProtocolConversation *protocol_conversation = NULL;
125 char *contents = NULL;
126
127 account = purple_conversation_get_account(conversation);
128 info = purple_account_get_contact_info(account);
129 members = purple_conversation_get_members(conversation);
130 author = purple_conversation_members_find_member(members, info);
131
132 contents = g_strjoinv(" ", params);
133 message = purple_message_new(author, contents);
134 g_free(contents);
135
136 purple_message_set_action(message, TRUE);
137
138 protocol_conversation = PURPLE_PROTOCOL_CONVERSATION(protocol);
139 purple_protocol_conversation_send_message_async(protocol_conversation,
140 conversation,
141 message,
142 NULL,
143 NULL,
144 NULL);
145
146 g_clear_object(&message);
147
148 return TRUE;
149 }

mercurial