comparison src/conversation.c @ 8076:504d98d14c25

[gaim-migrate @ 8775] CTRL+(1 through 8) and SHIFT+CTRL+(1 through 8) no longer insert smileys twice CTRL+(1 through 8) and SHIFT+CTRL+(1 through 8) inserts WYSIWYG smileys instead of text Removed some functions in from gtkconv.c that I don't think we need that I think Chip said were left over from a simpler way of life This may break some key commands or something in the text entry window of convos. Lemme know if it does Love me tender committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sun, 11 Jan 2004 21:36:17 +0000
parents fa6395637e2c
children ab0750ac5154
comparison
equal deleted inserted replaced
8075:41e973dbca03 8076:504d98d14c25
183 common_send(GaimConversation *conv, const char *message) 183 common_send(GaimConversation *conv, const char *message)
184 { 184 {
185 GaimConversationType type; 185 GaimConversationType type;
186 GaimConnection *gc; 186 GaimConnection *gc;
187 GaimConversationUiOps *ops; 187 GaimConversationUiOps *ops;
188 char *buffy = NULL; 188 char *displayed = NULL, *sent = NULL;
189 int plugin_return; 189 int plugin_return;
190 int err = 0; 190 int err = 0;
191 GList *first; 191 GList *first;
192 192
193 if (strlen(message) == 0) 193 if (strlen(message) == 0)
210 conv->send_history = g_list_prepend(first, NULL); 210 conv->send_history = g_list_prepend(first, NULL);
211 211
212 if ((gc->flags & GAIM_CONNECTION_HTML) && 212 if ((gc->flags & GAIM_CONNECTION_HTML) &&
213 gaim_prefs_get_bool("/core/conversations/send_urls_as_links")) { 213 gaim_prefs_get_bool("/core/conversations/send_urls_as_links")) {
214 214
215 buffy = gaim_markup_linkify(message); 215 displayed = gaim_markup_linkify(message);
216 } 216 }
217 else 217 else
218 buffy = g_strdup(message); 218 displayed = g_strdup(message);
219 219
220 plugin_return = 220 plugin_return =
221 GPOINTER_TO_INT(gaim_signal_emit_return_1( 221 GPOINTER_TO_INT(gaim_signal_emit_return_1(
222 gaim_conversations_get_handle(), 222 gaim_conversations_get_handle(),
223 (type == GAIM_CONV_IM 223 (type == GAIM_CONV_IM ? "writing-im-msg" : "writing-chat-msg"),
224 ? "displaying-im-msg" : "displaying-chat-msg"), 224 gaim_conversation_get_account(conv), conv, &displayed));
225 gaim_conversation_get_account(conv), conv, &buffy)); 225
226 226 if (displayed == NULL)
227 if (buffy == NULL)
228 return; 227 return;
229 228
230 if (plugin_return) { 229 if (plugin_return) {
231 g_free(buffy); 230 g_free(displayed);
231 return;
232 }
233
234 gaim_signal_emit(gaim_conversations_get_handle(),
235 (type == GAIM_CONV_IM ? "wrote-im-msg" : "wrote-chat-msg"),
236 gaim_conversation_get_account(conv), conv, displayed);
237
238 sent = g_strdup(displayed);
239
240 plugin_return =
241 GPOINTER_TO_INT(gaim_signal_emit_return_1(
242 gaim_conversations_get_handle(), (type == GAIM_CONV_IM ?
243 "displaying-im-msg" : "displaying-chat-msg"),
244 gaim_conversation_get_account(conv), conv, &displayed));
245
246 if (displayed == NULL) {
247 g_free(sent);
248 return;
249 }
250
251 if (plugin_return) {
252 g_free(displayed);
253 g_free(sent);
232 return; 254 return;
233 } 255 }
234 256
235 gaim_signal_emit(gaim_conversations_get_handle(), 257 gaim_signal_emit(gaim_conversations_get_handle(),
236 (type == GAIM_CONV_IM ? "displayed-im-msg" : "displayed-chat-msg"), 258 (type == GAIM_CONV_IM ? "displayed-im-msg" : "displayed-chat-msg"),
237 gaim_conversation_get_account(conv), conv, buffy); 259 gaim_conversation_get_account(conv), conv, displayed);
238 260
239 if (type == GAIM_CONV_IM) { 261 if (type == GAIM_CONV_IM) {
240 GaimConvIm *im = GAIM_CONV_IM(conv); 262 GaimConvIm *im = GAIM_CONV_IM(conv);
241 263
242 gaim_signal_emit(gaim_conversations_get_handle(), "sending-im-msg", 264 gaim_signal_emit(gaim_conversations_get_handle(), "sending-im-msg",
243 gaim_conversation_get_account(conv), 265 gaim_conversation_get_account(conv),
244 gaim_conversation_get_name(conv), &buffy); 266 gaim_conversation_get_name(conv), &sent);
245 267
246 if (buffy != NULL && buffy[0] != '\0') { 268 if (sent != NULL && sent[0] != '\0') {
247 GaimConvImFlags imflags = 0; 269 GaimConvImFlags imflags = 0;
248 GaimMessageFlags msgflags = GAIM_MESSAGE_SEND; 270 GaimMessageFlags msgflags = GAIM_MESSAGE_SEND;
249 271
250 if (im->images != NULL) { 272 if (im->images != NULL) {
251 imflags |= GAIM_CONV_IM_IMAGES; 273 imflags |= GAIM_CONV_IM_IMAGES;
252 msgflags |= GAIM_MESSAGE_IMAGES; 274 msgflags |= GAIM_MESSAGE_IMAGES;
253 } 275 }
254 276
255 err = serv_send_im(gc, gaim_conversation_get_name(conv), 277 err = serv_send_im(gc, gaim_conversation_get_name(conv),
256 buffy, imflags); 278 sent, imflags);
257 279
258 if (err > 0) 280 if (err > 0)
259 gaim_conv_im_write(im, NULL, buffy, msgflags, time(NULL)); 281 gaim_conv_im_write(im, NULL, displayed, msgflags, time(NULL));
260 282
261 if (im->images != NULL) { 283 if (im->images != NULL) {
262 GSList *tempy; 284 GSList *tempy;
263 int image; 285 int image;
264 286
274 im->images = NULL; 296 im->images = NULL;
275 } 297 }
276 298
277 gaim_signal_emit(gaim_conversations_get_handle(), "sent-im-msg", 299 gaim_signal_emit(gaim_conversations_get_handle(), "sent-im-msg",
278 gaim_conversation_get_account(conv), 300 gaim_conversation_get_account(conv),
279 gaim_conversation_get_name(conv), buffy); 301 gaim_conversation_get_name(conv), sent);
280 } 302 }
281 } 303 }
282 else { 304 else {
283 gaim_signal_emit(gaim_conversations_get_handle(), "sending-chat-msg", 305 gaim_signal_emit(gaim_conversations_get_handle(), "sending-chat-msg",
284 gaim_conversation_get_account(conv), &buffy, 306 gaim_conversation_get_account(conv), &sent,
285 gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv))); 307 gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)));
286 308
287 if (buffy != NULL && buffy[0] != '\0') { 309 if (sent != NULL && sent[0] != '\0') {
288 err = serv_chat_send(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), buffy); 310 err = serv_chat_send(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), sent);
289 311
290 gaim_signal_emit(gaim_conversations_get_handle(), "sent-chat-msg", 312 gaim_signal_emit(gaim_conversations_get_handle(), "sent-chat-msg",
291 gaim_conversation_get_account(conv), buffy, 313 gaim_conversation_get_account(conv), sent,
292 gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv))); 314 gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)));
293 } 315 }
294 } 316 }
295 317
296 if (err < 0) { 318 if (err < 0) {
317 else if (gc->away) { 339 else if (gc->away) {
318 serv_set_away(gc, GAIM_AWAY_CUSTOM, NULL); 340 serv_set_away(gc, GAIM_AWAY_CUSTOM, NULL);
319 } 341 }
320 } 342 }
321 } 343 }
344
345 g_free(displayed);
346 g_free(sent);
322 } 347 }
323 348
324 static void 349 static void
325 update_conv_indexes(GaimConvWindow *win) 350 update_conv_indexes(GaimConvWindow *win)
326 { 351 {