Changeset ba7618d
- Timestamp:
- 2015-12-27T04:39:17Z (9 years ago)
- Branches:
- master
- Children:
- cdd1ded
- Parents:
- 98d46d5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/purple/purple.c
r98d46d5 rba7618d 964 964 } 965 965 966 void prplcb_conv_chat_msg(PurpleConversation *conv, const char *who, const char *message, PurpleMessageFlags flags, 967 time_t mtime) 968 { 966 /* Generic handler for IM or chat messages, covers write_chat, write_im and write_conv */ 967 static void handle_conv_msg(PurpleConversation *conv, const char *who, const char *message, guint32 bee_flags, time_t mtime) 968 { 969 struct im_connection *ic = purple_ic_by_pa(conv->account); 969 970 struct groupchat *gc = conv->ui_data; 970 971 PurpleBuddy *buddy; 971 972 /* ..._SEND means it's an outgoing message, no need to echo those. */973 if (flags & PURPLE_MESSAGE_SEND) {974 return;975 }976 972 977 973 buddy = purple_find_buddy(conv->account, who); … … 980 976 } 981 977 982 imcb_chat_msg(gc, who, (char *) message, 0, mtime); 983 } 984 985 static void prplcb_conv_im(PurpleConversation *conv, const char *who, const char *message, PurpleMessageFlags flags, 986 time_t mtime) 987 { 988 struct im_connection *ic = purple_ic_by_pa(conv->account); 989 PurpleBuddy *buddy; 990 991 /* ..._SEND means it's an outgoing message, no need to echo those. */ 978 if (conv->type == PURPLE_CONV_TYPE_IM) { 979 imcb_buddy_msg(ic, (char *) who, (char *) message, bee_flags, mtime); 980 } else if (gc) { 981 imcb_chat_msg(gc, who, (char *) message, bee_flags, mtime); 982 } 983 } 984 985 /* Handles write_im and write_chat. Removes echoes of locally sent messages */ 986 static void prplcb_conv_msg(PurpleConversation *conv, const char *who, const char *message, PurpleMessageFlags flags, time_t mtime) 987 { 988 if (!(flags & PURPLE_MESSAGE_SEND)) { 989 handle_conv_msg(conv, who, message, 0, mtime); 990 } 991 } 992 993 /* Handles write_conv. Only passes self messages from other locations through. 994 * That is, only writes of PURPLE_MESSAGE_SEND. 995 * There are more events which might be handled in the future, but some are tricky. 996 * (images look like <img id="123">, what do i do with that?) */ 997 static void prplcb_conv_write(PurpleConversation *conv, const char *who, const char *alias, const char *message, 998 PurpleMessageFlags flags, time_t mtime) 999 { 992 1000 if (flags & PURPLE_MESSAGE_SEND) { 993 return; 994 } 995 996 buddy = purple_find_buddy(conv->account, who); 997 if (buddy != NULL) { 998 who = purple_buddy_get_name(buddy); 999 } 1000 1001 imcb_buddy_msg(ic, (char *) who, (char *) message, 0, mtime); 1001 handle_conv_msg(conv, who, message, OPT_SELFMESSAGE, mtime); 1002 } 1002 1003 } 1003 1004 … … 1032 1033 prplcb_conv_new, /* create_conversation */ 1033 1034 prplcb_conv_free, /* destroy_conversation */ 1034 prplcb_conv_ chat_msg,/* write_chat */1035 prplcb_conv_ im,/* write_im */1036 NULL,/* write_conv */1035 prplcb_conv_msg, /* write_chat */ 1036 prplcb_conv_msg, /* write_im */ 1037 prplcb_conv_write, /* write_conv */ 1037 1038 prplcb_conv_add_users, /* chat_add_users */ 1038 1039 NULL, /* chat_rename_user */
Note: See TracChangeset
for help on using the changeset viewer.