libpurple/conversation.c

branch
soc.2013.gobjectification.plugins
changeset 37155
1aee6d5eefba
parent 37153
c0eccc6696da
parent 36125
03ba2ca0be88
child 38240
0552f69f1996
child 38281
df274be2afa2
equal deleted inserted replaced
37154:ff7a5660dd4f 37155:1aee6d5eefba
86 { 86 {
87 PurpleAccount *account; 87 PurpleAccount *account;
88 PurpleConnection *gc; 88 PurpleConnection *gc;
89 PurpleConversationPrivate *priv = PURPLE_CONVERSATION_GET_PRIVATE(conv); 89 PurpleConversationPrivate *priv = PURPLE_CONVERSATION_GET_PRIVATE(conv);
90 PurpleMessage *msg; 90 PurpleMessage *msg;
91 char *displayed = NULL, *sent = NULL; 91 char *displayed = NULL;
92 const char *sent;
92 int err = 0; 93 int err = 0;
93 94
94 g_return_if_fail(priv != NULL); 95 g_return_if_fail(priv != NULL);
95 96
96 if (*message == '\0') 97 if (*message == '\0')
111 displayed = purple_markup_linkify(message); 112 displayed = purple_markup_linkify(message);
112 } 113 }
113 114
114 if (displayed && (priv->features & PURPLE_CONNECTION_FLAG_HTML) && 115 if (displayed && (priv->features & PURPLE_CONNECTION_FLAG_HTML) &&
115 !(msgflags & PURPLE_MESSAGE_RAW)) { 116 !(msgflags & PURPLE_MESSAGE_RAW)) {
116 sent = g_strdup(displayed); 117 sent = displayed;
117 } else 118 } else
118 sent = g_strdup(message); 119 sent = message;
119 120
120 msgflags |= PURPLE_MESSAGE_SEND; 121 msgflags |= PURPLE_MESSAGE_SEND;
121 122
122 if (PURPLE_IS_IM_CONVERSATION(conv)) { 123 if (PURPLE_IS_IM_CONVERSATION(conv)) {
123 msg = purple_message_new_outgoing( 124 msg = purple_message_new_outgoing(
128 129
129 if (!purple_message_is_empty(msg)) { 130 if (!purple_message_is_empty(msg)) {
130 131
131 err = purple_serv_send_im(gc, msg); 132 err = purple_serv_send_im(gc, msg);
132 133
133 if ((err > 0) && (displayed != NULL)) 134 if ((err > 0) && (displayed != NULL)) {
135 /* revert the contents in case sending-im-msg changed it */
136 purple_message_set_contents(msg, displayed);
134 purple_conversation_write_message(conv, msg); 137 purple_conversation_write_message(conv, msg);
138 }
135 139
136 purple_signal_emit(purple_conversations_get_handle(), 140 purple_signal_emit(purple_conversations_get_handle(),
137 "sent-im-msg", account, msg); 141 "sent-im-msg", account, msg);
138 } 142 }
139 } 143 }
185 } 189 }
186 } 190 }
187 } 191 }
188 192
189 g_free(displayed); 193 g_free(displayed);
190 g_free(sent);
191 } 194 }
192 195
193 static void 196 static void
194 open_log(PurpleConversation *conv) 197 open_log(PurpleConversation *conv)
195 { 198 {

mercurial