comparison src/gtkconv.c @ 12021:1a86417abfc8

[gaim-migrate @ 14314] Yet another patch from charkins related to the docklet. This one prevents the docklet's unseen msg notification from kicking in for non-logged text (e.g. notification of file transfer, etc). committer: Tailor Script <tailor@pidgin.im>
author Daniel Atallah <daniel.atallah@gmail.com>
date Wed, 09 Nov 2005 03:55:20 +0000
parents 16f75a4d9fec
children e67993da8a22
comparison
equal deleted inserted replaced
12020:440d9354b67f 12021:1a86417abfc8
2353 } 2353 }
2354 2354
2355 /************************************************************************** 2355 /**************************************************************************
2356 * End of the bunch of buddy icon functions 2356 * End of the bunch of buddy icon functions
2357 **************************************************************************/ 2357 **************************************************************************/
2358 GaimConversation *
2359 gaim_gtk_conversations_get_first_unseen(GaimConversationType type,
2360 GaimUnseenState min_state)
2361 {
2362 GList *l;
2363
2364 if(type==GAIM_CONV_TYPE_IM) {
2365 l = gaim_get_ims();
2366 } else if(type==GAIM_CONV_TYPE_CHAT) {
2367 l = gaim_get_chats();
2368 } else {
2369 l = gaim_get_conversations();
2370 }
2371
2372 for(; l!=NULL; l=l->next) {
2373 GaimConversation *conv = (GaimConversation*)l->data;
2374 if(GAIM_IS_GTK_CONVERSATION(conv)) {
2375 if(GAIM_GTK_CONVERSATION(conv)->unseen_state>=min_state) {
2376 return conv;
2377 }
2378 }
2379 }
2380
2381 return NULL;
2382 }
2358 2383
2359 GaimGtkWindow * 2384 GaimGtkWindow *
2360 gaim_gtkconv_get_window(GaimGtkConversation *gtkconv) 2385 gaim_gtkconv_get_window(GaimGtkConversation *gtkconv)
2361 { 2386 {
2362 g_return_val_if_fail(gtkconv != NULL, NULL); 2387 g_return_val_if_fail(gtkconv != NULL, NULL);
4333 /* Tab highlighting stuff */ 4358 /* Tab highlighting stuff */
4334 if (!gaim_gtkconv_has_focus(conv)) 4359 if (!gaim_gtkconv_has_focus(conv))
4335 { 4360 {
4336 GaimUnseenState unseen = GAIM_UNSEEN_NONE; 4361 GaimUnseenState unseen = GAIM_UNSEEN_NONE;
4337 4362
4338 if ((flags & GAIM_MESSAGE_NICK) == GAIM_MESSAGE_NICK || 4363 if ((flags & GAIM_MESSAGE_NICK) == GAIM_MESSAGE_NICK)
4339 gtkconv->unseen_state == GAIM_UNSEEN_NICK)
4340 unseen = GAIM_UNSEEN_NICK; 4364 unseen = GAIM_UNSEEN_NICK;
4341 else if ((((flags & GAIM_MESSAGE_SYSTEM) == GAIM_MESSAGE_SYSTEM) || 4365 else if (((flags & GAIM_MESSAGE_SYSTEM) == GAIM_MESSAGE_SYSTEM) ||
4342 ((flags & GAIM_MESSAGE_ERROR) == GAIM_MESSAGE_ERROR)) && 4366 ((flags & GAIM_MESSAGE_ERROR) == GAIM_MESSAGE_ERROR))
4343 gtkconv->unseen_state != GAIM_UNSEEN_TEXT)
4344 unseen = GAIM_UNSEEN_EVENT; 4367 unseen = GAIM_UNSEEN_EVENT;
4368 else if ((flags & GAIM_MESSAGE_NO_LOG) == GAIM_MESSAGE_NO_LOG)
4369 unseen = GAIM_UNSEEN_NOLOG;
4345 else 4370 else
4346 unseen = GAIM_UNSEEN_TEXT; 4371 unseen = GAIM_UNSEEN_TEXT;
4347 4372
4348 gtkconv_set_unseen(gtkconv, unseen); 4373 gtkconv_set_unseen(gtkconv, unseen);
4349 } 4374 }
5814 } 5839 }
5815 5840
5816 static void 5841 static void
5817 gtkconv_set_unseen(GaimGtkConversation *gtkconv, GaimUnseenState state) 5842 gtkconv_set_unseen(GaimGtkConversation *gtkconv, GaimUnseenState state)
5818 { 5843 {
5819 gtkconv->unseen_state = state; 5844 /* only allow NONE or higher priority unseen state */
5820 5845 if((state==GAIM_UNSEEN_NONE && gtkconv->unseen_state!=GAIM_UNSEEN_NONE)
5821 gaim_conversation_update(gtkconv->active_conv, GAIM_CONV_UPDATE_UNSEEN); 5846 || state > gtkconv->unseen_state) {
5822 } 5847 gtkconv->unseen_state = state;
5848 gaim_conversation_update(gtkconv->active_conv, GAIM_CONV_UPDATE_UNSEEN);
5849 }
5850 }
5851
5823 /* 5852 /*
5824 * When a conversation window is focused, we know the user 5853 * When a conversation window is focused, we know the user
5825 * has looked at it so we know there are no longer unseen 5854 * has looked at it so we know there are no longer unseen
5826 * messages. 5855 * messages.
5827 */ 5856 */