comparison libpurple/protocols/jabber/message.c @ 29309:974748d0e1f2

jabber: Don't pre-create a conversation on an incoming attention Prevents a conversation popping up despite "Hide new IM"
author Marcus Lundblad <ml@update.uu.se>
date Mon, 16 Nov 2009 19:59:20 +0000
parents f85510c955e4
children 9198a5d39c5c
comparison
equal deleted inserted replaced
29308:430badc49904 29309:974748d0e1f2
293 293
294 static void handle_buzz(JabberMessage *jm) { 294 static void handle_buzz(JabberMessage *jm) {
295 PurpleBuddy *buddy; 295 PurpleBuddy *buddy;
296 PurpleAccount *account; 296 PurpleAccount *account;
297 PurpleConversation *c; 297 PurpleConversation *c;
298 char *username;
299 298
300 /* Delayed buzz MUST NOT be accepted */ 299 /* Delayed buzz MUST NOT be accepted */
301 if(jm->delayed) 300 if(jm->delayed)
302 return; 301 return;
303 302
308 account = purple_connection_get_account(jm->js->gc); 307 account = purple_connection_get_account(jm->js->gc);
309 308
310 if ((buddy = purple_find_buddy(account, jm->from)) == NULL) 309 if ((buddy = purple_find_buddy(account, jm->from)) == NULL)
311 return; /* Do not accept buzzes from unknown people */ 310 return; /* Do not accept buzzes from unknown people */
312 311
313 c = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, jm->from, account);
314 if (c == NULL)
315 c = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, jm->from);
316
317 username = g_markup_escape_text(purple_buddy_get_alias(buddy), -1);
318 /* xmpp only has 1 attention type, so index is 0 */ 312 /* xmpp only has 1 attention type, so index is 0 */
319 purple_prpl_got_attention(jm->js->gc, jm->from, 0); 313 purple_prpl_got_attention(jm->js->gc, jm->from, 0);
320 purple_conversation_attention(c, jm->from, 0, PURPLE_MESSAGE_RECV, time(NULL)); 314 c = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, jm->from, account);
321 315 if (c)
322 g_free(username); 316 purple_conversation_attention(c, jm->from, 0, PURPLE_MESSAGE_RECV, time(NULL));
323 } 317 }
324 318
325 /* used internally by the functions below */ 319 /* used internally by the functions below */
326 typedef struct { 320 typedef struct {
327 gchar *cid; 321 gchar *cid;