| 204 static void add_chat_user_common(PurpleChatConversation *chat, PurpleChatUser *cb, const char *old_name); |
204 static void add_chat_user_common(PurpleChatConversation *chat, PurpleChatUser *cb, const char *old_name); |
| 205 static gboolean tab_complete(PurpleConversation *conv); |
205 static gboolean tab_complete(PurpleConversation *conv); |
| 206 static void pidgin_conv_updated(PurpleConversation *conv, PurpleConversationUpdateType type); |
206 static void pidgin_conv_updated(PurpleConversation *conv, PurpleConversationUpdateType type); |
| 207 static void conv_set_unseen(PurpleConversation *gtkconv, PidginUnseenState state); |
207 static void conv_set_unseen(PurpleConversation *gtkconv, PidginUnseenState state); |
| 208 static void gtkconv_set_unseen(PidginConversation *gtkconv, PidginUnseenState state); |
208 static void gtkconv_set_unseen(PidginConversation *gtkconv, PidginUnseenState state); |
| 209 static void update_typing_state(PidginConversation *gtkconv, gboolean deleting); |
|
| 210 static void update_typing_icon(PidginConversation *gtkconv); |
209 static void update_typing_icon(PidginConversation *gtkconv); |
| 211 static void update_typing_message(PidginConversation *gtkconv, const char *message); |
210 static void update_typing_message(PidginConversation *gtkconv, const char *message); |
| 212 gboolean pidgin_conv_has_focus(PurpleConversation *conv); |
211 gboolean pidgin_conv_has_focus(PurpleConversation *conv); |
| 213 static GArray* generate_nick_colors(guint numcolors, GdkColor background); |
212 static GArray* generate_nick_colors(guint numcolors, GdkColor background); |
| 214 static gboolean color_is_visible(GdkColor foreground, GdkColor background, guint color_contrast, guint brightness_contrast); |
213 static gboolean color_is_visible(GdkColor foreground, GdkColor background, guint color_contrast, guint brightness_contrast); |
| 1942 if (next) |
1941 if (next) |
| 1943 gtk_widget_grab_focus(next); |
1942 gtk_widget_grab_focus(next); |
| 1944 return !!next; |
1943 return !!next; |
| 1945 } |
1944 } |
| 1946 |
1945 |
| |
1946 static void |
| |
1947 update_typing_inserting(PidginConversation *gtkconv) |
| |
1948 { |
| |
1949 gchar *text; |
| |
1950 |
| |
1951 g_return_if_fail(gtkconv != NULL); |
| |
1952 |
| |
1953 text = gtk_webview_get_body_text(GTK_WEBVIEW(gtkconv->entry)); |
| |
1954 |
| |
1955 got_typing_keypress(gtkconv, text[0] == '\0' || !strcmp(text, "\n")); |
| |
1956 |
| |
1957 g_free(text); |
| |
1958 } |
| |
1959 |
| |
1960 static gboolean |
| |
1961 update_typing_deleting_cb(PidginConversation *gtkconv) |
| |
1962 { |
| |
1963 PurpleIMConversation *im = PURPLE_IM_CONVERSATION(gtkconv->active_conv); |
| |
1964 gchar *text = gtk_webview_get_body_text(GTK_WEBVIEW(gtkconv->entry)); |
| |
1965 |
| |
1966 if (!*text || !strcmp(text, "\n")) { |
| |
1967 /* We deleted all the text, so turn off typing. */ |
| |
1968 purple_im_conversation_stop_send_typed_timeout(im); |
| |
1969 |
| |
1970 serv_send_typing(purple_conversation_get_connection(gtkconv->active_conv), |
| |
1971 purple_conversation_get_name(gtkconv->active_conv), |
| |
1972 PURPLE_IM_NOT_TYPING); |
| |
1973 } |
| |
1974 else { |
| |
1975 /* We're deleting, but not all of it, so it counts as typing. */ |
| |
1976 got_typing_keypress(gtkconv, FALSE); |
| |
1977 } |
| |
1978 g_free(text); |
| |
1979 |
| |
1980 return FALSE; |
| |
1981 } |
| |
1982 |
| |
1983 static void |
| |
1984 update_typing_deleting(PidginConversation *gtkconv) |
| |
1985 { |
| |
1986 gchar *text; |
| |
1987 |
| |
1988 g_return_val_if_fail(gtkconv != NULL, FALSE); |
| |
1989 |
| |
1990 text = gtk_webview_get_body_text(GTK_WEBVIEW(gtkconv->entry)); |
| |
1991 |
| |
1992 if (*text && strcmp(text, "\n")) |
| |
1993 purple_timeout_add(0, (GSourceFunc)update_typing_deleting_cb, gtkconv); |
| |
1994 |
| |
1995 g_free(text); |
| |
1996 } |
| |
1997 |
| 1947 static gboolean |
1998 static gboolean |
| 1948 conv_keypress_common(PidginConversation *gtkconv, GdkEventKey *event) |
1999 conv_keypress_common(PidginConversation *gtkconv, GdkEventKey *event) |
| 1949 { |
2000 { |
| 1950 PidginWindow *win; |
2001 PidginWindow *win; |
| 1951 int curconv; |
2002 int curconv; |
| 2197 break; |
2248 break; |
| 2198 |
2249 |
| 2199 } |
2250 } |
| 2200 } |
2251 } |
| 2201 |
2252 |
| 2202 if (PURPLE_IS_IM_CONVERSATION(conv)) { |
2253 if (PURPLE_IS_IM_CONVERSATION(conv) && |
| 2203 gboolean deleting = FALSE; |
2254 purple_prefs_get_bool("/purple/conversations/im/send_typing")) { |
| 2204 |
2255 |
| 2205 switch (event->keyval) { |
2256 switch (event->keyval) { |
| 2206 case GDK_KEY_BackSpace: |
2257 case GDK_KEY_BackSpace: |
| 2207 case GDK_KEY_Delete: |
2258 case GDK_KEY_Delete: |
| 2208 case GDK_KEY_KP_Delete: |
2259 case GDK_KEY_KP_Delete: |
| 2209 deleting = TRUE; |
2260 update_typing_deleting(gtkconv); |
| 2210 } |
2261 break; |
| 2211 |
2262 default: |
| 2212 update_typing_state(gtkconv, deleting); |
2263 update_typing_inserting(gtkconv); |
| |
2264 } |
| 2213 } |
2265 } |
| 2214 |
2266 |
| 2215 return FALSE; |
2267 return FALSE; |
| 2216 } |
2268 } |
| 2217 |
2269 |
| 2419 if (gtk_check_menu_item_get_active((GtkCheckMenuItem*) m) == FALSE) |
2471 if (gtk_check_menu_item_get_active((GtkCheckMenuItem*) m) == FALSE) |
| 2420 return; |
2472 return; |
| 2421 |
2473 |
| 2422 im = purple_im_conversation_new(account, name); |
2474 im = purple_im_conversation_new(account, name); |
| 2423 pidgin_conv_switch_active_conversation(PURPLE_CONVERSATION(im)); |
2475 pidgin_conv_switch_active_conversation(PURPLE_CONVERSATION(im)); |
| 2424 } |
|
| 2425 |
|
| 2426 static void |
|
| 2427 update_typing_state(PidginConversation *gtkconv, gboolean deleting) |
|
| 2428 { |
|
| 2429 PurpleIMConversation *im; |
|
| 2430 gchar *text; |
|
| 2431 |
|
| 2432 g_return_if_fail(gtkconv != NULL); |
|
| 2433 |
|
| 2434 if (!purple_prefs_get_bool("/purple/conversations/im/send_typing")) |
|
| 2435 return; |
|
| 2436 |
|
| 2437 im = PURPLE_IM_CONVERSATION(gtkconv->active_conv); |
|
| 2438 |
|
| 2439 text = gtk_webview_get_body_text(GTK_WEBVIEW(gtkconv->entry)); |
|
| 2440 |
|
| 2441 if (!*text) { |
|
| 2442 |
|
| 2443 /* We deleted all the text, so turn off typing. */ |
|
| 2444 purple_im_conversation_stop_send_typed_timeout(im); |
|
| 2445 |
|
| 2446 serv_send_typing(purple_conversation_get_connection(gtkconv->active_conv), |
|
| 2447 purple_conversation_get_name(gtkconv->active_conv), |
|
| 2448 PURPLE_IM_NOT_TYPING); |
|
| 2449 } |
|
| 2450 else { |
|
| 2451 got_typing_keypress(gtkconv, !deleting && text[1] == '\0'); |
|
| 2452 } |
|
| 2453 } |
2476 } |
| 2454 |
2477 |
| 2455 /************************************************************************** |
2478 /************************************************************************** |
| 2456 * A bunch of buddy icon functions |
2479 * A bunch of buddy icon functions |
| 2457 **************************************************************************/ |
2480 **************************************************************************/ |