Mercurial > pidgin
comparison libpurple/conversation.c @ 19424:c17e41049b61
Do not duplicate the same message in the history, and store the correct
information when sending a message.
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Sat, 25 Aug 2007 12:06:40 +0000 |
parents | b33c2b085e78 |
children | 4da3c8618c24 |
comparison
equal
deleted
inserted
replaced
19423:dc4e8460622f | 19424:c17e41049b61 |
---|---|
209 add_message_to_history(PurpleConversation *conv, const char *who, const char *message, | 209 add_message_to_history(PurpleConversation *conv, const char *who, const char *message, |
210 PurpleMessageFlags flags, time_t when) | 210 PurpleMessageFlags flags, time_t when) |
211 { | 211 { |
212 GList *list; | 212 GList *list; |
213 PurpleConvMessage *msg; | 213 PurpleConvMessage *msg; |
214 | |
215 if (flags & PURPLE_MESSAGE_SEND) { | |
216 const char *me = NULL; | |
217 if (conv->account->gc) | |
218 me = conv->account->gc->display_name; | |
219 if (!me) | |
220 me = conv->account->username; | |
221 who = me; | |
222 } | |
214 | 223 |
215 msg = g_new0(PurpleConvMessage, 1); | 224 msg = g_new0(PurpleConvMessage, 1); |
216 PURPLE_DBUS_REGISTER_POINTER(msg, PurpleConvMessage); | 225 PURPLE_DBUS_REGISTER_POINTER(msg, PurpleConvMessage); |
217 msg->who = g_strdup(who); | 226 msg->who = g_strdup(who); |
218 msg->flags = flags; | 227 msg->flags = flags; |
1143 g_return_if_fail(message != NULL); | 1152 g_return_if_fail(message != NULL); |
1144 | 1153 |
1145 c = purple_conv_im_get_conversation(im); | 1154 c = purple_conv_im_get_conversation(im); |
1146 | 1155 |
1147 /* Pass this on to either the ops structure or the default write func. */ | 1156 /* Pass this on to either the ops structure or the default write func. */ |
1148 if (c->ui_ops != NULL && c->ui_ops->write_im != NULL) { | 1157 if (c->ui_ops != NULL && c->ui_ops->write_im != NULL) |
1149 c->ui_ops->write_im(c, who, message, flags, mtime); | 1158 c->ui_ops->write_im(c, who, message, flags, mtime); |
1150 add_message_to_history(c, who, message, flags, mtime); | 1159 else |
1151 } else | |
1152 purple_conversation_write(c, who, message, flags, mtime); | 1160 purple_conversation_write(c, who, message, flags, mtime); |
1153 } | 1161 } |
1154 | 1162 |
1155 gboolean purple_conv_present_error(const char *who, PurpleAccount *account, const char *what) | 1163 gboolean purple_conv_present_error(const char *who, PurpleAccount *account, const char *what) |
1156 { | 1164 { |
1470 | 1478 |
1471 g_free(str); | 1479 g_free(str); |
1472 } | 1480 } |
1473 | 1481 |
1474 /* Pass this on to either the ops structure or the default write func. */ | 1482 /* Pass this on to either the ops structure or the default write func. */ |
1475 if (conv->ui_ops != NULL && conv->ui_ops->write_chat != NULL) { | 1483 if (conv->ui_ops != NULL && conv->ui_ops->write_chat != NULL) |
1476 conv->ui_ops->write_chat(conv, who, message, flags, mtime); | 1484 conv->ui_ops->write_chat(conv, who, message, flags, mtime); |
1477 add_message_to_history(conv, who, message, flags, mtime); | 1485 else |
1478 } else | |
1479 purple_conversation_write(conv, who, message, flags, mtime); | 1486 purple_conversation_write(conv, who, message, flags, mtime); |
1480 } | 1487 } |
1481 | 1488 |
1482 void | 1489 void |
1483 purple_conv_chat_send(PurpleConvChat *chat, const char *message) | 1490 purple_conv_chat_send(PurpleConvChat *chat, const char *message) |