| 6652 { |
6652 { |
| 6653 return g_regex_replace_eval(image_store_tag_re, msg, -1, 0, 0, |
6653 return g_regex_replace_eval(image_store_tag_re, msg, -1, 0, 0, |
| 6654 box_remote_image_cb, conv, NULL); |
6654 box_remote_image_cb, conv, NULL); |
| 6655 } |
6655 } |
| 6656 |
6656 |
| |
6657 static gboolean |
| |
6658 writing_msg(PurpleConversation *conv, PurpleMessage *msg, gpointer _unused) |
| |
6659 { |
| |
6660 PidginConversation *gtkconv; |
| |
6661 |
| |
6662 g_return_val_if_fail(msg != NULL, FALSE); |
| |
6663 |
| |
6664 if (!(purple_message_get_flags(msg) & PURPLE_MESSAGE_ACTIVE_ONLY)) |
| |
6665 return FALSE; |
| |
6666 |
| |
6667 g_return_val_if_fail(conv != NULL, FALSE); |
| |
6668 gtkconv = PIDGIN_CONVERSATION(conv); |
| |
6669 g_return_val_if_fail(gtkconv != NULL, FALSE); |
| |
6670 |
| |
6671 if (conv == gtkconv->active_conv) |
| |
6672 return FALSE; |
| |
6673 |
| |
6674 purple_debug_info("gtkconv", |
| |
6675 "Suppressing message for an inactive conversation"); |
| |
6676 |
| |
6677 return TRUE; |
| |
6678 } |
| |
6679 |
| 6657 static void |
6680 static void |
| 6658 pidgin_conv_write_conv(PurpleConversation *conv, PurpleMessage *pmsg) |
6681 pidgin_conv_write_conv(PurpleConversation *conv, PurpleMessage *pmsg) |
| 6659 { |
6682 { |
| 6660 PidginConversation *gtkconv; |
6683 PidginConversation *gtkconv; |
| 6661 PurpleConnection *gc; |
6684 PurpleConnection *gc; |
| 6700 return; |
6723 return; |
| 6701 } |
6724 } |
| 6702 |
6725 |
| 6703 if (conv != gtkconv->active_conv) |
6726 if (conv != gtkconv->active_conv) |
| 6704 { |
6727 { |
| 6705 if (flags & PURPLE_MESSAGE_ACTIVE_ONLY) |
|
| 6706 { |
|
| 6707 /* Unless this had PURPLE_MESSAGE_NO_LOG, this message |
|
| 6708 * was logged. Plugin writers: if this isn't what |
|
| 6709 * you wanted, call purple_im_conversation_write_message() instead of |
|
| 6710 * purple_conversation_write(). */ |
|
| 6711 purple_debug_info("gtkconv", |
|
| 6712 "Suppressing message for an inactive conversation in pidgin_conv_write_conv()\n"); |
|
| 6713 return; |
|
| 6714 } |
|
| 6715 |
|
| 6716 /* Set the active conversation to the one that just messaged us. */ |
6728 /* Set the active conversation to the one that just messaged us. */ |
| 6717 /* TODO: consider not doing this if the account is offline or something */ |
6729 /* TODO: consider not doing this if the account is offline or something */ |
| 6718 if (flags & (PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_RECV)) |
6730 if (flags & (PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_RECV)) |
| 6719 pidgin_conv_switch_active_conversation(conv); |
6731 pidgin_conv_switch_active_conversation(conv); |
| 6720 } |
6732 } |
| 8860 G_CALLBACK(account_signed_off_cb), |
8872 G_CALLBACK(account_signed_off_cb), |
| 8861 GINT_TO_POINTER(PURPLE_CONVERSATION_ACCOUNT_OFFLINE)); |
8873 GINT_TO_POINTER(PURPLE_CONVERSATION_ACCOUNT_OFFLINE)); |
| 8862 purple_signal_connect(purple_connections_get_handle(), "signing-off", handle, |
8874 purple_signal_connect(purple_connections_get_handle(), "signing-off", handle, |
| 8863 G_CALLBACK(account_signing_off), NULL); |
8875 G_CALLBACK(account_signing_off), NULL); |
| 8864 |
8876 |
| |
8877 purple_signal_connect(purple_conversations_get_handle(), "writing-im-msg", |
| |
8878 handle, G_CALLBACK(writing_msg), NULL); |
| |
8879 purple_signal_connect(purple_conversations_get_handle(), "writing-chat-msg", |
| |
8880 handle, G_CALLBACK(writing_msg), NULL); |
| 8865 purple_signal_connect(purple_conversations_get_handle(), "received-im-msg", |
8881 purple_signal_connect(purple_conversations_get_handle(), "received-im-msg", |
| 8866 handle, G_CALLBACK(received_im_msg_cb), NULL); |
8882 handle, G_CALLBACK(received_im_msg_cb), NULL); |
| 8867 purple_signal_connect(purple_conversations_get_handle(), "cleared-message-history", |
8883 purple_signal_connect(purple_conversations_get_handle(), "cleared-message-history", |
| 8868 handle, G_CALLBACK(clear_conversation_scrollback_cb), NULL); |
8884 handle, G_CALLBACK(clear_conversation_scrollback_cb), NULL); |
| 8869 |
8885 |