protocols/ircv3/purpleircv3messagehandlers.c

changeset 42893
d73c5851a773
parent 42883
51a0fe1e2500
child 42896
5c8f4a455d3c
equal deleted inserted replaced
42892:ca6c19529734 42893:d73c5851a773
32 *****************************************************************************/ 32 *****************************************************************************/
33 static void 33 static void
34 purple_ircv3_add_contact_to_conversation(PurpleContact *contact, 34 purple_ircv3_add_contact_to_conversation(PurpleContact *contact,
35 PurpleConversation *conversation) 35 PurpleConversation *conversation)
36 { 36 {
37 PurpleContactInfo *info = PURPLE_CONTACT_INFO(contact);
37 PurpleConversationMember *member = NULL; 38 PurpleConversationMember *member = NULL;
38 39 PurpleConversationMembers *members = NULL;
39 member = purple_conversation_find_member(conversation, 40
40 PURPLE_CONTACT_INFO(contact)); 41 members = purple_conversation_get_members(conversation);
41 42
43 member = purple_conversation_members_find_member(members, info);
42 if(!PURPLE_IS_CONVERSATION_MEMBER(member)) { 44 if(!PURPLE_IS_CONVERSATION_MEMBER(member)) {
43 purple_conversation_add_member(conversation, 45 purple_conversation_members_add_member(members, info, TRUE, NULL);
44 PURPLE_CONTACT_INFO(contact),
45 TRUE, NULL);
46 } 46 }
47 } 47 }
48 48
49 /****************************************************************************** 49 /******************************************************************************
50 * General Commands 50 * General Commands
95 PurpleIRCv3Connection *connection = data; 95 PurpleIRCv3Connection *connection = data;
96 PurpleAccount *account = NULL; 96 PurpleAccount *account = NULL;
97 PurpleContact *contact = NULL; 97 PurpleContact *contact = NULL;
98 PurpleConversation *conversation = NULL; 98 PurpleConversation *conversation = NULL;
99 PurpleConversationManager *manager = NULL; 99 PurpleConversationManager *manager = NULL;
100 PurpleConversationMembers *members = NULL;
100 GStrv params = NULL; 101 GStrv params = NULL;
101 guint n_params = 0; 102 guint n_params = 0;
102 char *reason = NULL; 103 char *reason = NULL;
103 const char *conversation_name = NULL; 104 const char *conversation_name = NULL;
104 105
121 if(!PURPLE_IS_CONVERSATION(conversation)) { 122 if(!PURPLE_IS_CONVERSATION(conversation)) {
122 /* TODO: write status message unknown channel. */ 123 /* TODO: write status message unknown channel. */
123 124
124 return TRUE; 125 return TRUE;
125 } 126 }
127
128 members = purple_conversation_get_members(conversation);
126 129
127 /* We do want to find or create the contact, even on a part, because we 130 /* We do want to find or create the contact, even on a part, because we
128 * could have connected to a BNC and we weren't told about the contact yet. 131 * could have connected to a BNC and we weren't told about the contact yet.
129 */ 132 */
130 contact = purple_ircv3_connection_find_or_create_contact(connection, 133 contact = purple_ircv3_connection_find_or_create_contact(connection,
134 */ 137 */
135 if(n_params > 1) { 138 if(n_params > 1) {
136 reason = g_strjoinv(" ", params + 1); 139 reason = g_strjoinv(" ", params + 1);
137 } 140 }
138 141
139 purple_conversation_remove_member(conversation, 142 purple_conversation_members_remove_member(members,
140 PURPLE_CONTACT_INFO(contact), TRUE, 143 PURPLE_CONTACT_INFO(contact),
141 reason); 144 TRUE, reason);
142 145
143 g_clear_pointer(&reason, g_free); 146 g_clear_pointer(&reason, g_free);
144 147
145 return TRUE; 148 return TRUE;
146 } 149 }
192 195
193 /* Handle typing notifications. */ 196 /* Handle typing notifications. */
194 value = ibis_tags_lookup(tags, IBIS_TAG_TYPING); 197 value = ibis_tags_lookup(tags, IBIS_TAG_TYPING);
195 if(!purple_strempty(value)) { 198 if(!purple_strempty(value)) {
196 PurpleConversationMember *member = NULL; 199 PurpleConversationMember *member = NULL;
200 PurpleConversationMembers *members = NULL;
197 PurpleTypingState state = PURPLE_TYPING_STATE_NONE; 201 PurpleTypingState state = PURPLE_TYPING_STATE_NONE;
198 guint timeout = 1; 202 guint timeout = 1;
199 203
200 member = purple_conversation_find_member(conversation, 204 members = purple_conversation_get_members(conversation);
201 PURPLE_CONTACT_INFO(contact)); 205 member = purple_conversation_members_find_member(members,
206 PURPLE_CONTACT_INFO(contact));
202 207
203 if(purple_strequal(value, IBIS_TYPING_ACTIVE)) { 208 if(purple_strequal(value, IBIS_TYPING_ACTIVE)) {
204 state = PURPLE_TYPING_STATE_TYPING; 209 state = PURPLE_TYPING_STATE_TYPING;
205 timeout = 6; 210 timeout = 6;
206 } else if(purple_strequal(value, IBIS_TYPING_PAUSED)) { 211 } else if(purple_strequal(value, IBIS_TYPING_PAUSED)) {

mercurial