| 146 static void gray_stuff_out(PidginConversation *gtkconv); |
146 static void gray_stuff_out(PidginConversation *gtkconv); |
| 147 static GList *generate_invite_user_names(PurpleConnection *gc); |
147 static GList *generate_invite_user_names(PurpleConnection *gc); |
| 148 static void add_chat_buddy_common(PurpleConversation *conv, PurpleConvChatBuddy *cb, const char *old_name); |
148 static void add_chat_buddy_common(PurpleConversation *conv, PurpleConvChatBuddy *cb, const char *old_name); |
| 149 static gboolean tab_complete(PurpleConversation *conv); |
149 static gboolean tab_complete(PurpleConversation *conv); |
| 150 static void pidgin_conv_updated(PurpleConversation *conv, PurpleConvUpdateType type); |
150 static void pidgin_conv_updated(PurpleConversation *conv, PurpleConvUpdateType type); |
| |
151 static void conv_set_unseen(PurpleConversation *gtkconv, PidginUnseenState state); |
| 151 static void gtkconv_set_unseen(PidginConversation *gtkconv, PidginUnseenState state); |
152 static void gtkconv_set_unseen(PidginConversation *gtkconv, PidginUnseenState state); |
| 152 static void update_typing_icon(PidginConversation *gtkconv); |
153 static void update_typing_icon(PidginConversation *gtkconv); |
| 153 static const char *item_factory_translate_func (const char *path, gpointer func_data); |
154 static const char *item_factory_translate_func (const char *path, gpointer func_data); |
| 154 gboolean pidgin_conv_has_focus(PurpleConversation *conv); |
155 gboolean pidgin_conv_has_focus(PurpleConversation *conv); |
| 155 static void pidgin_conv_custom_smiley_allocated(GdkPixbufLoader *loader, gpointer user_data); |
156 static void pidgin_conv_custom_smiley_allocated(GdkPixbufLoader *loader, gpointer user_data); |
| 2851 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); |
2852 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); |
| 2852 |
2853 |
| 2853 if (gtkconv != NULL && gtkconv->active_conv != conv) |
2854 if (gtkconv != NULL && gtkconv->active_conv != conv) |
| 2854 continue; |
2855 continue; |
| 2855 if (gtkconv == NULL) { |
2856 if (gtkconv == NULL) { |
| 2856 if (!purple_conversation_get_data(conv, "unseen-count")) |
2857 if (!purple_conversation_get_data(conv, "unseen-count") || |
| |
2858 !purple_conversation_get_data(conv, "unseen-state") || |
| |
2859 GPOINTER_TO_INT(purple_conversation_get_data(conv, "unseen-state"))<min_state) |
| 2857 continue; |
2860 continue; |
| 2858 r = g_list_prepend(r, conv); |
2861 r = g_list_prepend(r, conv); |
| 2859 c++; |
2862 c++; |
| 2860 } else { |
2863 } else { |
| 2861 if (gtkconv->unseen_state >= min_state && !hidden_only) { |
2864 if (gtkconv->unseen_state >= min_state && !hidden_only) { |
| 5160 if (!conv) { |
5163 if (!conv) { |
| 5161 ui_ops->create_conversation = NULL; |
5164 ui_ops->create_conversation = NULL; |
| 5162 conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, sender); |
5165 conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, sender); |
| 5163 purple_conversation_set_ui_ops(conv, NULL); |
5166 purple_conversation_set_ui_ops(conv, NULL); |
| 5164 ui_ops->create_conversation = pidgin_conv_new; |
5167 ui_ops->create_conversation = pidgin_conv_new; |
| |
5168 } else { |
| |
5169 /* TODO: update the unseen_state data on the conv here */ |
| 5165 } |
5170 } |
| 5166 } else { |
5171 } else { |
| 5167 /* new message for an IM */ |
5172 /* new message for an IM */ |
| 5168 if (conv && conv->type == PURPLE_CONV_TYPE_IM) |
5173 if (conv && conv->type == PURPLE_CONV_TYPE_IM) |
| 5169 pidgin_conv_attach_to_conversation(conv); |
5174 pidgin_conv_attach_to_conversation(conv); |
| 6666 pidgin_conv_update_fields(conv, flags); |
6671 pidgin_conv_update_fields(conv, flags); |
| 6667 } |
6672 } |
| 6668 |
6673 |
| 6669 static void |
6674 static void |
| 6670 wrote_msg_update_unseen_cb(PurpleAccount *account, const char *who, const char *message, |
6675 wrote_msg_update_unseen_cb(PurpleAccount *account, const char *who, const char *message, |
| 6671 PurpleConversation *conv, PurpleMessageFlags flag, gpointer null) |
6676 PurpleConversation *conv, PurpleMessageFlags flags, gpointer null) |
| 6672 { |
6677 { |
| 6673 if (conv == NULL || PIDGIN_IS_PIDGIN_CONVERSATION(conv)) |
6678 if (conv == NULL || PIDGIN_IS_PIDGIN_CONVERSATION(conv)) |
| 6674 return; |
6679 return; |
| 6675 if (flag & (PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_RECV)) { |
6680 if (flags & (PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_RECV)) { |
| 6676 purple_conversation_set_data(conv, "unseen-count", |
6681 PidginUnseenState unseen = PIDGIN_UNSEEN_NONE; |
| 6677 GINT_TO_POINTER(GPOINTER_TO_INT(purple_conversation_get_data(conv, "unseen-count")) + 1)); |
6682 |
| |
6683 if ((flags & PURPLE_MESSAGE_NICK) == PURPLE_MESSAGE_NICK) |
| |
6684 unseen = PIDGIN_UNSEEN_NICK; |
| |
6685 else if (((flags & PURPLE_MESSAGE_SYSTEM) == PURPLE_MESSAGE_SYSTEM) || |
| |
6686 ((flags & PURPLE_MESSAGE_ERROR) == PURPLE_MESSAGE_ERROR)) |
| |
6687 unseen = PIDGIN_UNSEEN_EVENT; |
| |
6688 else if ((flags & PURPLE_MESSAGE_NO_LOG) == PURPLE_MESSAGE_NO_LOG) |
| |
6689 unseen = PIDGIN_UNSEEN_NO_LOG; |
| |
6690 else |
| |
6691 unseen = PIDGIN_UNSEEN_TEXT; |
| |
6692 |
| |
6693 conv_set_unseen(conv, unseen); |
| 6678 purple_conversation_update(conv, PURPLE_CONV_UPDATE_UNSEEN); |
6694 purple_conversation_update(conv, PURPLE_CONV_UPDATE_UNSEEN); |
| 6679 } |
6695 } |
| 6680 } |
6696 } |
| 6681 |
6697 |
| 6682 static PurpleConversationUiOps conversation_ui_ops = |
6698 static PurpleConversationUiOps conversation_ui_ops = |
| 7447 |
7463 |
| 7448 if (PIDGIN_IS_PIDGIN_CONVERSATION(conv)) |
7464 if (PIDGIN_IS_PIDGIN_CONVERSATION(conv)) |
| 7449 return FALSE; |
7465 return FALSE; |
| 7450 |
7466 |
| 7451 purple_conversation_set_data(conv, "unseen-count", NULL); |
7467 purple_conversation_set_data(conv, "unseen-count", NULL); |
| |
7468 purple_conversation_set_data(conv, "unseen-state", NULL); |
| 7452 purple_conversation_set_ui_ops(conv, pidgin_conversations_get_conv_ui_ops()); |
7469 purple_conversation_set_ui_ops(conv, pidgin_conversations_get_conv_ui_ops()); |
| 7453 private_gtkconv_new(conv, FALSE); |
7470 private_gtkconv_new(conv, FALSE); |
| 7454 gtkconv = PIDGIN_CONVERSATION(conv); |
7471 gtkconv = PIDGIN_CONVERSATION(conv); |
| 7455 |
7472 |
| 7456 list = purple_conversation_get_message_history(conv); |
7473 list = purple_conversation_get_message_history(conv); |
| 7916 |
7933 |
| 7917 return TRUE; |
7934 return TRUE; |
| 7918 } |
7935 } |
| 7919 |
7936 |
| 7920 static void |
7937 static void |
| |
7938 conv_set_unseen(PurpleConversation *conv, PidginUnseenState state) |
| |
7939 { |
| |
7940 int unseen_count = 0; |
| |
7941 PidginUnseenState unseen_state = PIDGIN_UNSEEN_NONE; |
| |
7942 |
| |
7943 if(purple_conversation_get_data(conv, "unseen-count")) |
| |
7944 unseen_count = GPOINTER_TO_INT(purple_conversation_get_data(conv, "unseen-count")); |
| |
7945 |
| |
7946 if(purple_conversation_get_data(conv, "unseen-state")) |
| |
7947 unseen_state = GPOINTER_TO_INT(purple_conversation_get_data(conv, "unseen-state")); |
| |
7948 |
| |
7949 if (state == PIDGIN_UNSEEN_NONE) |
| |
7950 { |
| |
7951 unseen_count = 0; |
| |
7952 unseen_state = PIDGIN_UNSEEN_NONE; |
| |
7953 } |
| |
7954 else |
| |
7955 { |
| |
7956 if (state >= PIDGIN_UNSEEN_TEXT) |
| |
7957 unseen_count++; |
| |
7958 |
| |
7959 if (state > unseen_state) |
| |
7960 unseen_state = state; |
| |
7961 } |
| |
7962 |
| |
7963 purple_conversation_set_data(conv, "unseen-count", GINT_TO_POINTER(unseen_count)); |
| |
7964 purple_conversation_set_data(conv, "unseen-state", GINT_TO_POINTER(unseen_state)); |
| |
7965 |
| |
7966 purple_conversation_update(conv, PURPLE_CONV_UPDATE_UNSEEN); |
| |
7967 } |
| |
7968 |
| |
7969 static void |
| 7921 gtkconv_set_unseen(PidginConversation *gtkconv, PidginUnseenState state) |
7970 gtkconv_set_unseen(PidginConversation *gtkconv, PidginUnseenState state) |
| 7922 { |
7971 { |
| 7923 if (state == PIDGIN_UNSEEN_NONE) |
7972 if (state == PIDGIN_UNSEEN_NONE) |
| 7924 { |
7973 { |
| 7925 gtkconv->unseen_count = 0; |
7974 gtkconv->unseen_count = 0; |