comparison libpurple/conversation.c @ 18052:627f9d40ca1b

propagate from branch 'im.pidgin.pidgin' (head 5f583403bf6a3522123918b975ce234ffd86f3b4) to branch 'im.pidgin.pidgin.2.1.0' (head a3f0a9ddc360d16c2a0bb1dbde9cccec230882e9)
author Luke Schierer <lschiere@pidgin.im>
date Wed, 06 Jun 2007 12:20:11 +0000
parents 25d808baa395 2f9eabdc6011
children 4ca97b26a8fb
comparison
equal deleted inserted replaced
17763:6d0bc0b23440 18052:627f9d40ca1b
19 * along with this program; if not, write to the Free Software 19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */ 21 */
22 #include "internal.h" 22 #include "internal.h"
23 #include "blist.h" 23 #include "blist.h"
24 #include "cmds.h"
24 #include "conversation.h" 25 #include "conversation.h"
25 #include "dbus-maybe.h" 26 #include "dbus-maybe.h"
26 #include "debug.h" 27 #include "debug.h"
27 #include "imgstore.h" 28 #include "imgstore.h"
28 #include "notify.h" 29 #include "notify.h"
106 g_return_if_fail(account != NULL); 107 g_return_if_fail(account != NULL);
107 g_return_if_fail(gc != NULL); 108 g_return_if_fail(gc != NULL);
108 109
109 type = purple_conversation_get_type(conv); 110 type = purple_conversation_get_type(conv);
110 111
111 /* Always linkfy the text for display */ 112 /* Always linkfy the text for display, unless we're
112 displayed = purple_markup_linkify(message); 113 * explicitly asked to do otheriwse*/
114 if(msgflags & PURPLE_MESSAGE_NO_LINKIFY)
115 displayed = g_strdup(message);
116 else
117 displayed = purple_markup_linkify(message);
113 118
114 if ((conv->features & PURPLE_CONNECTION_HTML) && 119 if ((conv->features & PURPLE_CONNECTION_HTML) &&
115 !(msgflags & PURPLE_MESSAGE_RAW)) 120 !(msgflags & PURPLE_MESSAGE_RAW))
116 { 121 {
117 sent = g_strdup(displayed); 122 sent = g_strdup(displayed);
1008 purple_conv_im_stop_typing_timeout(im); 1013 purple_conv_im_stop_typing_timeout(im);
1009 1014
1010 conv = purple_conv_im_get_conversation(im); 1015 conv = purple_conv_im_get_conversation(im);
1011 name = purple_conversation_get_name(conv); 1016 name = purple_conversation_get_name(conv);
1012 1017
1013 im->typing_timeout = purple_timeout_add(timeout * 1000, reset_typing_cb, conv); 1018 im->typing_timeout = purple_timeout_add_seconds(timeout, reset_typing_cb, conv);
1014 } 1019 }
1015 1020
1016 void 1021 void
1017 purple_conv_im_stop_typing_timeout(PurpleConvIm *im) 1022 purple_conv_im_stop_typing_timeout(PurpleConvIm *im)
1018 { 1023 {
1576 escaped, escaped2); 1581 escaped, escaped2);
1577 g_free(escaped2); 1582 g_free(escaped2);
1578 } 1583 }
1579 g_free(escaped); 1584 g_free(escaped);
1580 1585
1581 purple_conversation_write(conv, NULL, tmp, PURPLE_MESSAGE_SYSTEM, time(NULL)); 1586 purple_conversation_write(conv, NULL, tmp,
1587 PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LINKIFY,
1588 time(NULL));
1582 g_free(tmp); 1589 g_free(tmp);
1583 } 1590 }
1584 1591
1585 purple_signal_emit(purple_conversations_get_handle(), 1592 purple_signal_emit(purple_conversations_get_handle(),
1586 "chat-buddy-joined", conv, user, flag, new_arrivals); 1593 "chat-buddy-joined", conv, user, flag, new_arrivals);
1702 _("%s is now known as %s"), escaped, escaped2); 1709 _("%s is now known as %s"), escaped, escaped2);
1703 g_free(escaped); 1710 g_free(escaped);
1704 g_free(escaped2); 1711 g_free(escaped2);
1705 } 1712 }
1706 1713
1707 purple_conversation_write(conv, NULL, tmp, PURPLE_MESSAGE_SYSTEM, time(NULL)); 1714 purple_conversation_write(conv, NULL, tmp,
1715 PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LINKIFY,
1716 time(NULL));
1708 } 1717 }
1709 } 1718 }
1710 1719
1711 void 1720 void
1712 purple_conv_chat_remove_user(PurpleConvChat *chat, const char *user, const char *reason) 1721 purple_conv_chat_remove_user(PurpleConvChat *chat, const char *user, const char *reason)
1779 escaped, escaped2); 1788 escaped, escaped2);
1780 g_free(escaped2); 1789 g_free(escaped2);
1781 } 1790 }
1782 g_free(escaped); 1791 g_free(escaped);
1783 1792
1784 purple_conversation_write(conv, NULL, tmp, PURPLE_MESSAGE_SYSTEM, time(NULL)); 1793 purple_conversation_write(conv, NULL, tmp,
1794 PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LINKIFY,
1795 time(NULL));
1785 g_free(tmp); 1796 g_free(tmp);
1786 } 1797 }
1787 1798
1788 purple_signal_emit(purple_conversations_get_handle(), "chat-buddy-left", 1799 purple_signal_emit(purple_conversations_get_handle(), "chat-buddy-left",
1789 conv, user, reason); 1800 conv, user, reason);
1989 purple_conv_chat_cb_get_name(PurpleConvChatBuddy *cb) 2000 purple_conv_chat_cb_get_name(PurpleConvChatBuddy *cb)
1990 { 2001 {
1991 g_return_val_if_fail(cb != NULL, NULL); 2002 g_return_val_if_fail(cb != NULL, NULL);
1992 2003
1993 return cb->name; 2004 return cb->name;
2005 }
2006
2007 GList *
2008 purple_conversation_get_extended_menu(PurpleConversation *conv)
2009 {
2010 GList *menu = NULL;
2011
2012 g_return_val_if_fail(conv != NULL, NULL);
2013
2014 purple_signal_emit(purple_conversations_get_handle(),
2015 "conversation-extended-menu", conv, &menu);
2016 return menu;
2017 }
2018
2019 gboolean
2020 purple_conversation_do_command(PurpleConversation *conv, const gchar *cmdline,
2021 const gchar *markup, gchar **error)
2022 {
2023 char *mark = (markup && *markup) ? NULL : g_markup_escape_text(cmdline, -1), *err = NULL;
2024 PurpleCmdStatus status = purple_cmd_do_command(conv, cmdline, mark ? mark : markup, error ? error : &err);
2025 g_free(mark);
2026 g_free(err);
2027 return (status == PURPLE_CMD_STATUS_OK);
1994 } 2028 }
1995 2029
1996 void * 2030 void *
1997 purple_conversations_get_handle(void) 2031 purple_conversations_get_handle(void)
1998 { 2032 {
2254 purple_marshal_VOID__POINTER_POINTER_POINTER, NULL, 3, 2288 purple_marshal_VOID__POINTER_POINTER_POINTER, NULL, 3,
2255 purple_value_new(PURPLE_TYPE_SUBTYPE, 2289 purple_value_new(PURPLE_TYPE_SUBTYPE,
2256 PURPLE_SUBTYPE_CONVERSATION), 2290 PURPLE_SUBTYPE_CONVERSATION),
2257 purple_value_new(PURPLE_TYPE_STRING), 2291 purple_value_new(PURPLE_TYPE_STRING),
2258 purple_value_new(PURPLE_TYPE_STRING)); 2292 purple_value_new(PURPLE_TYPE_STRING));
2293
2294 purple_signal_register(handle, "conversation-extended-menu",
2295 purple_marshal_VOID__POINTER_POINTER, NULL, 2,
2296 purple_value_new(PURPLE_TYPE_SUBTYPE,
2297 PURPLE_SUBTYPE_CONVERSATION),
2298 purple_value_new(PURPLE_TYPE_BOXED, "GList **"));
2259 } 2299 }
2260 2300
2261 void 2301 void
2262 purple_conversations_uninit(void) 2302 purple_conversations_uninit(void)
2263 { 2303 {