annotate finch/gntconv.c @ 19415:2128daf52d31

Reattach the gtk-ui to a conversation when the user wants to reopen the conversation from pidgin.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sat, 25 Aug 2007 04:53:45 +0000
parents 9c03677be7c5
children a277162b976e 6759eb4387a5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1 /**
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2 * @file gntconv.c GNT Conversation API
16194
0f0832c13fcb Rename the Doxygen group from gntui to finch and define the finch group
Richard Laager <rlaager@wiktel.com>
parents: 16128
diff changeset
3 * @ingroup finch
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4 *
15871
66dff3dfdea6 Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
5 * finch
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6 *
15871
66dff3dfdea6 Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
7 * Finch is the legal property of its developers, whose names are too numerous
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8 * to list here. Please refer to the COPYRIGHT file distributed with this
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9 * source distribution.
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10 *
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
11 * This program is free software; you can redistribute it and/or modify
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
12 * it under the terms of the GNU General Public License as published by
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
13 * the Free Software Foundation; either version 2 of the License, or
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
14 * (at your option) any later version.
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
15 *
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
16 * This program is distributed in the hope that it will be useful,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
19 * GNU General Public License for more details.
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
20 *
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
21 * You should have received a copy of the GNU General Public License
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
22 * along with this program; if not, write to the Free Software
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
24 */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
25 #include <string.h>
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
26
18210
b8572b937c09 #include reorganizations to allow compiling with glib < 2.8 using the
Stu Tomlinson <stu@nosnilmot.com>
parents: 18100
diff changeset
27 #include "finch.h"
b8572b937c09 #include reorganizations to allow compiling with glib < 2.8 using the
Stu Tomlinson <stu@nosnilmot.com>
parents: 18100
diff changeset
28
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
29 #include <cmds.h>
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
30 #include <idle.h>
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
31 #include <prefs.h>
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
32 #include <util.h>
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
33
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
34 #include "gntaccount.h"
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
35 #include "gntblist.h"
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
36 #include "gntconv.h"
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
37 #include "gntdebug.h"
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
38 #include "gntplugin.h"
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
39 #include "gntprefs.h"
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
40 #include "gntstatus.h"
16903
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
41 #include "gntpounce.h"
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
42
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
43 #include "gnt.h"
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
44 #include "gntbox.h"
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
45 #include "gntentry.h"
16904
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
46 #include "gntlabel.h"
16903
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
47 #include "gntmenu.h"
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
48 #include "gntmenuitem.h"
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
49 #include "gntmenuitemcheck.h"
16904
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
50 #include "gnttextview.h"
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
51 #include "gnttree.h"
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
52 #include "gntutils.h"
16903
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
53 #include "gntwindow.h"
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
54
16427
4999bbc52881 Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@gmail.com>
parents: 16194
diff changeset
55 #define PREF_ROOT "/finch/conversations"
16904
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
56 #define PREF_CHAT PREF_ROOT "/chats"
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
57 #define PREF_USERLIST PREF_CHAT "/userlist"
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
58
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
59 #include "config.h"
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
60
17032
d6e855aedc30 Notify when you leave a chat, after /part or /kick.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16989
diff changeset
61 static void finch_write_common(PurpleConversation *conv, const char *who,
d6e855aedc30 Notify when you leave a chat, after /part or /kick.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16989
diff changeset
62 const char *message, PurpleMessageFlags flags, time_t mtime);
19321
39d3a81a5850 Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18637
diff changeset
63 static void generate_send_to_menu(FinchConv *ggc);
17032
d6e855aedc30 Notify when you leave a chat, after /part or /kick.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16989
diff changeset
64
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
65 static void
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
66 send_typing_notification(GntWidget *w, FinchConv *ggconv)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
67 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
68 const char *text = gnt_entry_get_text(GNT_ENTRY(ggconv->entry));
17529
289ac53f753f Do not send typing notification if you are typing a /-command.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17275
diff changeset
69 gboolean empty = (!text || !*text || (*text == '/'));
16427
4999bbc52881 Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@gmail.com>
parents: 16194
diff changeset
70 if (purple_prefs_get_bool("/finch/conversations/notify_typing")) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
71 PurpleConversation *conv = ggconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
72 PurpleConvIm *im = PURPLE_CONV_IM(conv);
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
73 if (!empty) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
74 gboolean send = (purple_conv_im_get_send_typed_timeout(im) == 0);
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
75
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
76 purple_conv_im_stop_send_typed_timeout(im);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
77 purple_conv_im_start_send_typed_timeout(im);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
78 if (send || (purple_conv_im_get_type_again(im) != 0 &&
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
79 time(NULL) > purple_conv_im_get_type_again(im))) {
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
80 unsigned int timeout;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
81 timeout = serv_send_typing(purple_conversation_get_gc(conv),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
82 purple_conversation_get_name(conv),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
83 PURPLE_TYPING);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
84 purple_conv_im_set_type_again(im, timeout);
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
85 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
86 } else {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
87 purple_conv_im_stop_send_typed_timeout(im);
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
88
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
89 serv_send_typing(purple_conversation_get_gc(conv),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
90 purple_conversation_get_name(conv),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
91 PURPLE_NOT_TYPING);
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
92 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
93 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
94 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
95
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
96 static gboolean
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
97 entry_key_pressed(GntWidget *w, const char *key, FinchConv *ggconv)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
98 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
99 if (key[0] == '\r' && key[1] == 0)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
100 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
101 const char *text = gnt_entry_get_text(GNT_ENTRY(ggconv->entry));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
102 if (*text == '/')
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
103 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
104 PurpleConversation *conv = ggconv->active_conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
105 PurpleCmdStatus status;
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
106 const char *cmdline = text + 1;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
107 char *error = NULL, *escape;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
108
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
109 escape = g_markup_escape_text(cmdline, -1);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
110 status = purple_cmd_do_command(conv, cmdline, escape, &error);
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
111 g_free(escape);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
112
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
113 switch (status)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
114 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
115 case PURPLE_CMD_STATUS_OK:
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
116 break;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
117 case PURPLE_CMD_STATUS_NOT_FOUND:
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
118 purple_conversation_write(conv, "", _("No such command."),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
119 PURPLE_MESSAGE_NO_LOG, time(NULL));
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
120 break;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
121 case PURPLE_CMD_STATUS_WRONG_ARGS:
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
122 purple_conversation_write(conv, "", _("Syntax Error: You typed the wrong number of arguments "
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
123 "to that command."),
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
124 PURPLE_MESSAGE_NO_LOG, time(NULL));
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
125 break;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
126 case PURPLE_CMD_STATUS_FAILED:
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
127 purple_conversation_write(conv, "", error ? error : _("Your command failed for an unknown reason."),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
128 PURPLE_MESSAGE_NO_LOG, time(NULL));
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
129 break;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
130 case PURPLE_CMD_STATUS_WRONG_TYPE:
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
131 if(purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
132 purple_conversation_write(conv, "", _("That command only works in chats, not IMs."),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
133 PURPLE_MESSAGE_NO_LOG, time(NULL));
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
134 else
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
135 purple_conversation_write(conv, "", _("That command only works in IMs, not chats."),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
136 PURPLE_MESSAGE_NO_LOG, time(NULL));
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
137 break;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
138 case PURPLE_CMD_STATUS_WRONG_PRPL:
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
139 purple_conversation_write(conv, "", _("That command doesn't work on this protocol."),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
140 PURPLE_MESSAGE_NO_LOG, time(NULL));
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
141 break;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
142 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
143 g_free(error);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
144 }
19370
9c03677be7c5 Notify the user if a message is not sent in a conversation because he's disconnected.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19321
diff changeset
145 else if (!purple_account_is_connected(ggconv->active_conv->account))
9c03677be7c5 Notify the user if a message is not sent in a conversation because he's disconnected.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19321
diff changeset
146 {
9c03677be7c5 Notify the user if a message is not sent in a conversation because he's disconnected.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19321
diff changeset
147 purple_conversation_write(ggconv->active_conv, "", _("Message was not sent, because you are not signed on."),
9c03677be7c5 Notify the user if a message is not sent in a conversation because he's disconnected.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19321
diff changeset
148 PURPLE_MESSAGE_ERROR | PURPLE_MESSAGE_NO_LOG, time(NULL));
9c03677be7c5 Notify the user if a message is not sent in a conversation because he's disconnected.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19321
diff changeset
149 }
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
150 else
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
151 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
152 char *escape = g_markup_escape_text(text, -1);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
153 char *apos = purple_strreplace(escape, "&apos;", "'");
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
154 g_free(escape);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
155 escape = apos;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
156 switch (purple_conversation_get_type(ggconv->active_conv))
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
157 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
158 case PURPLE_CONV_TYPE_IM:
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
159 purple_conv_im_send_with_flags(PURPLE_CONV_IM(ggconv->active_conv), escape, PURPLE_MESSAGE_SEND);
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
160 break;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
161 case PURPLE_CONV_TYPE_CHAT:
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
162 purple_conv_chat_send(PURPLE_CONV_CHAT(ggconv->active_conv), escape);
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
163 break;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
164 default:
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
165 g_free(escape);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
166 g_return_val_if_reached(FALSE);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
167 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
168 g_free(escape);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
169 purple_idle_touch();
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
170 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
171 gnt_entry_add_to_history(GNT_ENTRY(ggconv->entry), text);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
172 gnt_entry_clear(GNT_ENTRY(ggconv->entry));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
173 return TRUE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
174 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
175
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
176 return FALSE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
177 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
178
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
179 static void
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
180 closing_window(GntWidget *window, FinchConv *ggconv)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
181 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
182 GList *list = ggconv->list;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
183 ggconv->window = NULL;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
184 while (list) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
185 PurpleConversation *conv = list->data;
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
186 list = list->next;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
187 purple_conversation_destroy(conv);
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
188 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
189 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
190
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
191 static void
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
192 size_changed_cb(GntWidget *widget, int width, int height)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
193 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
194 int w, h;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
195 gnt_widget_get_size(widget, &w, &h);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
196 purple_prefs_set_int(PREF_ROOT "/size/width", w);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
197 purple_prefs_set_int(PREF_ROOT "/size/height", h);
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
198 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
199
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
200 static void
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
201 save_position_cb(GntWidget *w, int x, int y)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
202 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
203 purple_prefs_set_int(PREF_ROOT "/position/x", x);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
204 purple_prefs_set_int(PREF_ROOT "/position/y", y);
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
205 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
206
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
207 static PurpleConversation *
19321
39d3a81a5850 Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18637
diff changeset
208 find_conv_with_contact(PurpleAccount *account, const char *name)
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
209 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
210 PurpleBlistNode *node;
19321
39d3a81a5850 Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18637
diff changeset
211 PurpleBuddy *buddy = purple_find_buddy(account, name);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
212 PurpleConversation *ret = NULL;
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
213
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
214 if (!buddy)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
215 return NULL;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
216
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
217 for (node = ((PurpleBlistNode*)buddy)->parent->child; node; node = node->next) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
218 if (node == (PurpleBlistNode*)buddy)
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
219 continue;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
220 if ((ret = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
221 ((PurpleBuddy*)node)->name, ((PurpleBuddy*)node)->account)) != NULL)
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
222 break;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
223 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
224 return ret;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
225 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
226
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
227 static char *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
228 get_conversation_title(PurpleConversation *conv, PurpleAccount *account)
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
229 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
230 return g_strdup_printf(_("%s (%s -- %s)"), purple_conversation_get_title(conv),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
231 purple_account_get_username(account), purple_account_get_protocol_name(account));
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
232 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
233
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
234 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
235 update_buddy_typing(PurpleAccount *account, const char *who, gpointer null)
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
236 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
237 PurpleConversation *conv;
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
238 FinchConv *ggc;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
239 PurpleConvIm *im = NULL;
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
240 char *title, *str;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
241
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
242 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, who, account);
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
243
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
244 if (!conv)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
245 return;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
246
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
247 im = PURPLE_CONV_IM(conv);
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
248 ggc = conv->ui_data;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
249
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
250 if (purple_conv_im_get_typing_state(im) == PURPLE_TYPING) {
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
251 int scroll;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
252 str = get_conversation_title(conv, account);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
253 title = g_strdup_printf(_("%s [%s]"), str,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
254 gnt_ascii_only() ? "T" : "\342\243\277");
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
255 g_free(str);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
256
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
257 scroll = gnt_text_view_get_lines_below(GNT_TEXT_VIEW(ggc->tv));
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
258 str = g_strdup_printf(_("\n%s is typing..."), purple_conversation_get_name(conv));
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
259 /* Updating is a little buggy. So just remove and add a new one */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
260 gnt_text_view_tag_change(GNT_TEXT_VIEW(ggc->tv), "typing", NULL, TRUE);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
261 gnt_text_view_append_text_with_tag(GNT_TEXT_VIEW(ggc->tv),
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
262 str, GNT_TEXT_FLAG_DIM, "typing");
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
263 g_free(str);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
264 if (scroll <= 1)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
265 gnt_text_view_scroll(GNT_TEXT_VIEW(ggc->tv), 0);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
266 } else {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
267 title = get_conversation_title(conv, account);
18637
3597903cf8ff Just show an empty line, instead of bouncing the text down when the user
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18427
diff changeset
268 gnt_text_view_tag_change(GNT_TEXT_VIEW(ggc->tv), "typing", " ", TRUE);
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
269 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
270 gnt_screen_rename_widget(ggc->window, title);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
271 g_free(title);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
272 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
273
17032
d6e855aedc30 Notify when you leave a chat, after /part or /kick.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16989
diff changeset
274 static void
d6e855aedc30 Notify when you leave a chat, after /part or /kick.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16989
diff changeset
275 chat_left_cb(PurpleConversation *conv, gpointer null)
d6e855aedc30 Notify when you leave a chat, after /part or /kick.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16989
diff changeset
276 {
d6e855aedc30 Notify when you leave a chat, after /part or /kick.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16989
diff changeset
277 finch_write_common(conv, NULL, _("You have left this chat."),
d6e855aedc30 Notify when you leave a chat, after /part or /kick.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16989
diff changeset
278 PURPLE_MESSAGE_SYSTEM, time(NULL));
d6e855aedc30 Notify when you leave a chat, after /part or /kick.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16989
diff changeset
279 }
d6e855aedc30 Notify when you leave a chat, after /part or /kick.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16989
diff changeset
280
19321
39d3a81a5850 Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18637
diff changeset
281 static void
39d3a81a5850 Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18637
diff changeset
282 buddy_signed_on_off(PurpleBuddy *buddy, gpointer null)
39d3a81a5850 Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18637
diff changeset
283 {
39d3a81a5850 Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18637
diff changeset
284 PurpleConversation *conv = find_conv_with_contact(buddy->account, buddy->name);
39d3a81a5850 Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18637
diff changeset
285 if (conv == NULL)
39d3a81a5850 Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18637
diff changeset
286 return;
39d3a81a5850 Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18637
diff changeset
287 generate_send_to_menu(conv->ui_data);
39d3a81a5850 Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18637
diff changeset
288 }
39d3a81a5850 Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18637
diff changeset
289
39d3a81a5850 Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18637
diff changeset
290 static void
39d3a81a5850 Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18637
diff changeset
291 account_signed_on_off(PurpleConnection *gc, gpointer null)
39d3a81a5850 Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18637
diff changeset
292 {
39d3a81a5850 Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18637
diff changeset
293 GList *ims = purple_get_ims();
39d3a81a5850 Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18637
diff changeset
294 while (ims) {
39d3a81a5850 Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18637
diff changeset
295 PurpleConversation *conv = ims->data;
39d3a81a5850 Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18637
diff changeset
296 PurpleConversation *cc = find_conv_with_contact(conv->account, conv->name);
39d3a81a5850 Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18637
diff changeset
297 if (cc)
39d3a81a5850 Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18637
diff changeset
298 generate_send_to_menu(cc->ui_data);
39d3a81a5850 Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18637
diff changeset
299 ims = ims->next;
39d3a81a5850 Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18637
diff changeset
300 }
39d3a81a5850 Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18637
diff changeset
301 }
39d3a81a5850 Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18637
diff changeset
302
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
303 static gpointer
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
304 finch_conv_get_handle()
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
305 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
306 static int handle;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
307 return &handle;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
308 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
309
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
310 static void
16903
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
311 clear_scrollback_cb(GntMenuItem *item, gpointer ggconv)
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
312 {
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
313 FinchConv *ggc = ggconv;
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
314 gnt_text_view_clear(GNT_TEXT_VIEW(ggc->tv));
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
315 }
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
316
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
317 static void
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
318 send_file_cb(GntMenuItem *item, gpointer ggconv)
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
319 {
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
320 FinchConv *ggc = ggconv;
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
321 serv_send_file(purple_conversation_get_gc(ggc->active_conv),
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
322 purple_conversation_get_name(ggc->active_conv), NULL);
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
323 }
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
324
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
325 static void
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
326 add_pounce_cb(GntMenuItem *item, gpointer ggconv)
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
327 {
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
328 FinchConv *ggc = ggconv;
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
329 finch_pounce_editor_show(
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
330 purple_conversation_get_account(ggc->active_conv),
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
331 purple_conversation_get_name(ggc->active_conv), NULL);
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
332 }
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
333
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
334 static void
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
335 get_info_cb(GntMenuItem *item, gpointer ggconv)
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
336 {
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
337 FinchConv *ggc = ggconv;
17275
319bcb73eb4e Use utility functions to get user info. Closes #964.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17104
diff changeset
338 finch_retrieve_user_info(purple_conversation_get_gc(ggc->active_conv),
16903
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
339 purple_conversation_get_name(ggc->active_conv));
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
340 }
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
341
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
342 static void
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
343 toggle_timestamps_cb(GntMenuItem *item, gpointer ggconv)
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
344 {
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
345 purple_prefs_set_bool(PREF_ROOT "/timestamps",
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
346 !purple_prefs_get_bool(PREF_ROOT "/timestamps"));
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
347 }
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
348
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
349 static void
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
350 send_to_cb(GntMenuItem *m, gpointer n)
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
351 {
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
352 PurpleAccount *account = g_object_get_data(G_OBJECT(m), "purple_account");
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
353 gchar *buddy = g_object_get_data(G_OBJECT(m), "purple_buddy_name");
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
354 PurpleConversation *conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, buddy);
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
355 finch_conversation_set_active(conv);
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
356 }
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
357
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
358 static void
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
359 generate_send_to_menu(FinchConv *ggc)
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
360 {
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
361 GntWidget *sub, *menu = ggc->menu;
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
362 GntMenuItem *item;
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
363 GSList *buds;
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
364 GList *list = NULL;
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
365
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
366 buds = purple_find_buddies(ggc->active_conv->account, ggc->active_conv->name);
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
367 if (!buds)
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
368 return;
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
369
19321
39d3a81a5850 Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18637
diff changeset
370 if ((item = ggc->u.im->sendto) == NULL) {
39d3a81a5850 Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18637
diff changeset
371 item = gnt_menuitem_new(_("Send To"));
39d3a81a5850 Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18637
diff changeset
372 gnt_menu_add_item(GNT_MENU(menu), item);
39d3a81a5850 Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18637
diff changeset
373 ggc->u.im->sendto = item;
39d3a81a5850 Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18637
diff changeset
374 }
16903
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
375 sub = gnt_menu_new(GNT_MENU_POPUP);
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
376 gnt_menuitem_set_submenu(item, GNT_MENU(sub));
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
377
19321
39d3a81a5850 Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18637
diff changeset
378 for (; buds; buds = g_slist_delete_link(buds, buds)) {
16903
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
379 PurpleBlistNode *node = (PurpleBlistNode *)purple_buddy_get_contact((PurpleBuddy *)buds->data);
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
380 for (node = node->child; node != NULL; node = node->next) {
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
381 PurpleBuddy *buddy = (PurpleBuddy *)node;
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
382 PurpleAccount *account = purple_buddy_get_account(buddy);
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
383 if (purple_account_is_connected(account)) {
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
384 /* Use the PurplePresence to get unique buddies. */
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
385 PurplePresence *presence = purple_buddy_get_presence(buddy);
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
386 if (!g_list_find(list, presence))
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
387 list = g_list_prepend(list, presence);
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
388 }
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
389 }
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
390 }
19321
39d3a81a5850 Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18637
diff changeset
391 for (list = g_list_reverse(list); list != NULL; list = g_list_delete_link(list, list)) {
16903
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
392 PurplePresence *pre = list->data;
16904
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
393 PurpleBuddy *buddy = purple_presence_get_buddy(pre);
16903
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
394 PurpleAccount *account = purple_buddy_get_account(buddy);
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
395 gchar *name = g_strdup(purple_buddy_get_name(buddy));
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
396 gchar *text = g_strdup_printf("%s (%s)", purple_buddy_get_name(buddy), purple_account_get_username(account));
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
397 item = gnt_menuitem_new(text);
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
398 g_free(text);
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
399 gnt_menu_add_item(GNT_MENU(sub), item);
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
400 gnt_menuitem_set_callback(item, send_to_cb, NULL);
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
401 g_object_set_data(G_OBJECT(item), "purple_account", account);
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
402 g_object_set_data_full(G_OBJECT(item), "purple_buddy_name", name, g_free);
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
403 }
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
404 }
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
405
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
406 static void
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
407 gg_create_menu(FinchConv *ggc)
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
408 {
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
409 GntWidget *menu, *sub;
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
410 GntMenuItem *item;
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
411
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
412 ggc->menu = menu = gnt_menu_new(GNT_MENU_TOPLEVEL);
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
413 gnt_window_set_menu(GNT_WINDOW(ggc->window), GNT_MENU(menu));
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
414
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
415 item = gnt_menuitem_new(_("Conversation"));
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
416 gnt_menu_add_item(GNT_MENU(menu), item);
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
417
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
418 sub = gnt_menu_new(GNT_MENU_POPUP);
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
419 gnt_menuitem_set_submenu(item, GNT_MENU(sub));
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
420
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
421 item = gnt_menuitem_new(_("Clear Scrollback"));
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
422 gnt_menu_add_item(GNT_MENU(sub), item);
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
423 gnt_menuitem_set_callback(item, clear_scrollback_cb, ggc);
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
424
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
425 item = gnt_menuitem_check_new(_("Show Timestamps"));
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
426 gnt_menuitem_check_set_checked(GNT_MENU_ITEM_CHECK(item),
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
427 purple_prefs_get_bool(PREF_ROOT "/timestamps"));
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
428 gnt_menu_add_item(GNT_MENU(sub), item);
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
429 gnt_menuitem_set_callback(item, toggle_timestamps_cb, ggc);
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
430
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
431 if (purple_conversation_get_type(ggc->active_conv) == PURPLE_CONV_TYPE_IM) {
16969
1a336cfc410e Change a string, and make sure non-functional items are not added in the conversation window menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16941
diff changeset
432 PurpleAccount *account = purple_conversation_get_account(ggc->active_conv);
1a336cfc410e Change a string, and make sure non-functional items are not added in the conversation window menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16941
diff changeset
433 PurplePluginProtocolInfo *pinfo = account->gc ? PURPLE_PLUGIN_PROTOCOL_INFO(account->gc->prpl) : NULL;
1a336cfc410e Change a string, and make sure non-functional items are not added in the conversation window menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16941
diff changeset
434
1a336cfc410e Change a string, and make sure non-functional items are not added in the conversation window menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16941
diff changeset
435 if (pinfo && pinfo->get_info) {
1a336cfc410e Change a string, and make sure non-functional items are not added in the conversation window menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16941
diff changeset
436 item = gnt_menuitem_new(_("Get Info"));
1a336cfc410e Change a string, and make sure non-functional items are not added in the conversation window menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16941
diff changeset
437 gnt_menu_add_item(GNT_MENU(sub), item);
1a336cfc410e Change a string, and make sure non-functional items are not added in the conversation window menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16941
diff changeset
438 gnt_menuitem_set_callback(item, get_info_cb, ggc);
1a336cfc410e Change a string, and make sure non-functional items are not added in the conversation window menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16941
diff changeset
439 }
16903
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
440
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
441 item = gnt_menuitem_new(_("Add Buddy Pounce..."));
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
442 gnt_menu_add_item(GNT_MENU(sub), item);
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
443 gnt_menuitem_set_callback(item, add_pounce_cb, ggc);
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
444
16969
1a336cfc410e Change a string, and make sure non-functional items are not added in the conversation window menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16941
diff changeset
445 if (pinfo && pinfo->send_file &&
1a336cfc410e Change a string, and make sure non-functional items are not added in the conversation window menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16941
diff changeset
446 (!pinfo->can_receive_file ||
1a336cfc410e Change a string, and make sure non-functional items are not added in the conversation window menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16941
diff changeset
447 pinfo->can_receive_file(account->gc, purple_conversation_get_name(ggc->active_conv)))) {
1a336cfc410e Change a string, and make sure non-functional items are not added in the conversation window menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16941
diff changeset
448 item = gnt_menuitem_new(_("Send File"));
1a336cfc410e Change a string, and make sure non-functional items are not added in the conversation window menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16941
diff changeset
449 gnt_menu_add_item(GNT_MENU(sub), item);
1a336cfc410e Change a string, and make sure non-functional items are not added in the conversation window menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16941
diff changeset
450 gnt_menuitem_set_callback(item, send_file_cb, ggc);
1a336cfc410e Change a string, and make sure non-functional items are not added in the conversation window menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16941
diff changeset
451 }
16903
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
452
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
453 generate_send_to_menu(ggc);
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
454 }
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
455 }
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
456
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
457 static void
16904
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
458 create_conv_from_userlist(GntWidget *widget, FinchConv *fc)
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
459 {
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
460 PurpleAccount *account = purple_conversation_get_account(fc->active_conv);
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
461 char *name = gnt_tree_get_selection_data(GNT_TREE(widget));
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
462 purple_conversation_new(PURPLE_CONV_TYPE_IM, account, name);
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
463 }
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
464
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
465 static void
18100
f63b3a23280d Provide a 'unseen-count' data for the conversations so the dbus-docklet can use that information.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17529
diff changeset
466 gained_focus_cb(GntWindow *window, FinchConv *fc)
f63b3a23280d Provide a 'unseen-count' data for the conversations so the dbus-docklet can use that information.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17529
diff changeset
467 {
f63b3a23280d Provide a 'unseen-count' data for the conversations so the dbus-docklet can use that information.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17529
diff changeset
468 GList *iter;
f63b3a23280d Provide a 'unseen-count' data for the conversations so the dbus-docklet can use that information.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17529
diff changeset
469 for (iter = fc->list; iter; iter = iter->next) {
f63b3a23280d Provide a 'unseen-count' data for the conversations so the dbus-docklet can use that information.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17529
diff changeset
470 purple_conversation_set_data(iter->data, "unseen-count", 0);
f63b3a23280d Provide a 'unseen-count' data for the conversations so the dbus-docklet can use that information.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17529
diff changeset
471 purple_conversation_update(iter->data, PURPLE_CONV_UPDATE_UNSEEN);
f63b3a23280d Provide a 'unseen-count' data for the conversations so the dbus-docklet can use that information.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17529
diff changeset
472 }
f63b3a23280d Provide a 'unseen-count' data for the conversations so the dbus-docklet can use that information.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17529
diff changeset
473 }
f63b3a23280d Provide a 'unseen-count' data for the conversations so the dbus-docklet can use that information.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17529
diff changeset
474
f63b3a23280d Provide a 'unseen-count' data for the conversations so the dbus-docklet can use that information.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17529
diff changeset
475 static void
18383
9eb2f4d27990 Use the completion-signal to append a ': ' after a tab-completed nick.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18232
diff changeset
476 completion_cb(GntEntry *entry, const char *start, const char *end)
9eb2f4d27990 Use the completion-signal to append a ': ' after a tab-completed nick.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18232
diff changeset
477 {
9eb2f4d27990 Use the completion-signal to append a ': ' after a tab-completed nick.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18232
diff changeset
478 if (start == entry->start)
9eb2f4d27990 Use the completion-signal to append a ': ' after a tab-completed nick.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18232
diff changeset
479 gnt_widget_key_pressed(GNT_WIDGET(entry), ": ");
9eb2f4d27990 Use the completion-signal to append a ': ' after a tab-completed nick.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18232
diff changeset
480 }
9eb2f4d27990 Use the completion-signal to append a ': ' after a tab-completed nick.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18232
diff changeset
481
9eb2f4d27990 Use the completion-signal to append a ': ' after a tab-completed nick.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18232
diff changeset
482 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
483 finch_create_conversation(PurpleConversation *conv)
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
484 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
485 FinchConv *ggc = conv->ui_data;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
486 char *title;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
487 PurpleConversationType type;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
488 PurpleConversation *cc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
489 PurpleAccount *account;
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
490
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
491 if (ggc)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
492 return;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
493
19321
39d3a81a5850 Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18637
diff changeset
494 cc = find_conv_with_contact(conv->account, conv->name);
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
495 if (cc && cc->ui_data)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
496 ggc = cc->ui_data;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
497 else
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
498 ggc = g_new0(FinchConv, 1);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
499
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
500 ggc->list = g_list_prepend(ggc->list, conv);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
501 ggc->active_conv = conv;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
502 conv->ui_data = ggc;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
503
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
504 if (cc && cc->ui_data) {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
505 finch_conversation_set_active(conv);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
506 return;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
507 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
508
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
509 account = purple_conversation_get_account(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
510 type = purple_conversation_get_type(conv);
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
511 title = get_conversation_title(conv, account);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
512
16903
373466e3151a Conversation menus
Richard Nelson <wabz@pidgin.im>
parents: 16427
diff changeset
513 ggc->window = gnt_vwindow_new(FALSE);
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
514 gnt_box_set_title(GNT_BOX(ggc->window), title);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
515 gnt_box_set_toplevel(GNT_BOX(ggc->window), TRUE);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
516 gnt_box_set_pad(GNT_BOX(ggc->window), 0);
18232
2b1af79e768f Plucked revision from finchfeat to give different names to windows for
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18222
diff changeset
517
2b1af79e768f Plucked revision from finchfeat to give different names to windows for
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18222
diff changeset
518 switch(conv->type){
2b1af79e768f Plucked revision from finchfeat to give different names to windows for
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18222
diff changeset
519 case PURPLE_CONV_TYPE_UNKNOWN:
2b1af79e768f Plucked revision from finchfeat to give different names to windows for
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18222
diff changeset
520 gnt_widget_set_name(ggc->window, "conversation-window-unknown" );
2b1af79e768f Plucked revision from finchfeat to give different names to windows for
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18222
diff changeset
521 break;
2b1af79e768f Plucked revision from finchfeat to give different names to windows for
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18222
diff changeset
522 case PURPLE_CONV_TYPE_IM:
2b1af79e768f Plucked revision from finchfeat to give different names to windows for
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18222
diff changeset
523 gnt_widget_set_name(ggc->window, "conversation-window-im" );
2b1af79e768f Plucked revision from finchfeat to give different names to windows for
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18222
diff changeset
524 break;
2b1af79e768f Plucked revision from finchfeat to give different names to windows for
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18222
diff changeset
525 case PURPLE_CONV_TYPE_CHAT:
2b1af79e768f Plucked revision from finchfeat to give different names to windows for
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18222
diff changeset
526 gnt_widget_set_name(ggc->window, "conversation-window-chat" );
2b1af79e768f Plucked revision from finchfeat to give different names to windows for
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18222
diff changeset
527 break;
2b1af79e768f Plucked revision from finchfeat to give different names to windows for
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18222
diff changeset
528 case PURPLE_CONV_TYPE_MISC:
2b1af79e768f Plucked revision from finchfeat to give different names to windows for
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18222
diff changeset
529 gnt_widget_set_name(ggc->window, "conversation-window-misc" );
2b1af79e768f Plucked revision from finchfeat to give different names to windows for
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18222
diff changeset
530 break;
2b1af79e768f Plucked revision from finchfeat to give different names to windows for
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18222
diff changeset
531 case PURPLE_CONV_TYPE_ANY:
2b1af79e768f Plucked revision from finchfeat to give different names to windows for
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18222
diff changeset
532 gnt_widget_set_name(ggc->window, "conversation-window-any" );
2b1af79e768f Plucked revision from finchfeat to give different names to windows for
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18222
diff changeset
533 break;
2b1af79e768f Plucked revision from finchfeat to give different names to windows for
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18222
diff changeset
534 }
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
535
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
536 ggc->tv = gnt_text_view_new();
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
537 gnt_widget_set_name(ggc->tv, "conversation-window-textview");
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
538 gnt_widget_set_size(ggc->tv, purple_prefs_get_int(PREF_ROOT "/size/width"),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
539 purple_prefs_get_int(PREF_ROOT "/size/height"));
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
540
16904
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
541 if (type == PURPLE_CONV_TYPE_CHAT) {
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
542 GntWidget *hbox, *tree;
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
543 FinchConvChat *fc = ggc->u.chat = g_new0(FinchConvChat, 1);
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
544 hbox = gnt_hbox_new(FALSE);
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
545 gnt_box_set_pad(GNT_BOX(hbox), 0);
17083
f2137f75fd10 Show user flags in chat userlist.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17032
diff changeset
546 tree = fc->userlist = gnt_tree_new_with_columns(2);
f2137f75fd10 Show user flags in chat userlist.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17032
diff changeset
547 gnt_tree_set_col_width(GNT_TREE(tree), 0, 1); /* The flag column */
16904
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
548 gnt_tree_set_compare_func(GNT_TREE(tree), (GCompareFunc)g_utf8_collate);
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
549 gnt_tree_set_hash_fns(GNT_TREE(tree), g_str_hash, g_str_equal, g_free);
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
550 GNT_WIDGET_SET_FLAGS(tree, GNT_WIDGET_NO_BORDER);
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
551 gnt_box_add_widget(GNT_BOX(hbox), ggc->tv);
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
552 gnt_box_add_widget(GNT_BOX(hbox), tree);
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
553 gnt_box_add_widget(GNT_BOX(ggc->window), hbox);
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
554 g_signal_connect(G_OBJECT(tree), "activate", G_CALLBACK(create_conv_from_userlist), ggc);
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
555 gnt_widget_set_visible(tree, purple_prefs_get_bool(PREF_USERLIST));
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
556 } else {
19321
39d3a81a5850 Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18637
diff changeset
557 ggc->u.im = g_new0(FinchConvIm, 1);
16904
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
558 gnt_box_add_widget(GNT_BOX(ggc->window), ggc->tv);
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
559 }
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
560
16128
7a2ffa981c1a Allow adding information widgets in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16124
diff changeset
561 ggc->info = gnt_vbox_new(FALSE);
7a2ffa981c1a Allow adding information widgets in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16124
diff changeset
562 gnt_box_add_widget(GNT_BOX(ggc->window), ggc->info);
7a2ffa981c1a Allow adding information widgets in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16124
diff changeset
563
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
564 ggc->entry = gnt_entry_new(NULL);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
565 gnt_box_add_widget(GNT_BOX(ggc->window), ggc->entry);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
566 gnt_widget_set_name(ggc->entry, "conversation-window-entry");
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
567 gnt_entry_set_history_length(GNT_ENTRY(ggc->entry), -1);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
568 gnt_entry_set_word_suggest(GNT_ENTRY(ggc->entry), TRUE);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
569 gnt_entry_set_always_suggest(GNT_ENTRY(ggc->entry), FALSE);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
570
16124
ab3f93232a2d Add a utility function to assist scrolling in a textview.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15871
diff changeset
571 gnt_text_view_attach_scroll_widget(GNT_TEXT_VIEW(ggc->tv), ggc->entry);
18427
be8c4eba38f6 Use the utility function for the conversation and debug windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18383
diff changeset
572 gnt_text_view_attach_pager_widget(GNT_TEXT_VIEW(ggc->tv), ggc->entry);
be8c4eba38f6 Use the utility function for the conversation and debug windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18383
diff changeset
573
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
574 g_signal_connect_after(G_OBJECT(ggc->entry), "key_pressed", G_CALLBACK(entry_key_pressed), ggc);
18383
9eb2f4d27990 Use the completion-signal to append a ': ' after a tab-completed nick.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18232
diff changeset
575 g_signal_connect(G_OBJECT(ggc->entry), "completion", G_CALLBACK(completion_cb), NULL);
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
576 g_signal_connect(G_OBJECT(ggc->window), "destroy", G_CALLBACK(closing_window), ggc);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
577
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
578 gnt_widget_set_position(ggc->window, purple_prefs_get_int(PREF_ROOT "/position/x"),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
579 purple_prefs_get_int(PREF_ROOT "/position/y"));
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
580 gnt_widget_show(ggc->window);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
581
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
582 g_signal_connect(G_OBJECT(ggc->tv), "size_changed", G_CALLBACK(size_changed_cb), NULL);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
583 g_signal_connect(G_OBJECT(ggc->window), "position_set", G_CALLBACK(save_position_cb), NULL);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
584
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
585 if (type == PURPLE_CONV_TYPE_IM) {
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
586 g_signal_connect(G_OBJECT(ggc->entry), "text_changed", G_CALLBACK(send_typing_notification), ggc);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
587 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
588
19321
39d3a81a5850 Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18637
diff changeset
589 gg_create_menu(ggc);
39d3a81a5850 Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18637
diff changeset
590
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
591 g_free(title);
16904
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
592 gnt_box_give_focus_to_child(GNT_BOX(ggc->window), ggc->entry);
18100
f63b3a23280d Provide a 'unseen-count' data for the conversations so the dbus-docklet can use that information.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17529
diff changeset
593 g_signal_connect(G_OBJECT(ggc->window), "gained-focus", G_CALLBACK(gained_focus_cb), ggc);
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
594 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
595
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
596 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
597 finch_destroy_conversation(PurpleConversation *conv)
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
598 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
599 /* do stuff here */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
600 FinchConv *ggc = conv->ui_data;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
601 ggc->list = g_list_remove(ggc->list, conv);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
602 if (ggc->list && conv == ggc->active_conv)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
603 ggc->active_conv = ggc->list->data;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
604
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
605 if (ggc->list == NULL) {
16904
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
606 g_free(ggc->u.chat);
18222
ef65d43190e5 Fix a few runtime warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18210
diff changeset
607 if (ggc->window)
ef65d43190e5 Fix a few runtime warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18210
diff changeset
608 gnt_widget_destroy(ggc->window);
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
609 g_free(ggc);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
610 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
611 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
612
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
613 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
614 finch_write_common(PurpleConversation *conv, const char *who, const char *message,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
615 PurpleMessageFlags flags, time_t mtime)
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
616 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
617 FinchConv *ggconv = conv->ui_data;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
618 char *strip, *newline;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
619 GntTextFormatFlags fl = 0;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
620 int pos;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
621
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
622 g_return_if_fail(ggconv != NULL);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
623
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
624 if (ggconv->active_conv != conv) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
625 if (flags & (PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_RECV))
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
626 finch_conversation_set_active(conv);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
627 else
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
628 return;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
629 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
630
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
631 pos = gnt_text_view_get_lines_below(GNT_TEXT_VIEW(ggconv->tv));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
632
18637
3597903cf8ff Just show an empty line, instead of bouncing the text down when the user
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18427
diff changeset
633 gnt_text_view_tag_change(GNT_TEXT_VIEW(ggconv->tv), "typing", NULL, TRUE);
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
634 gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv), "\n", GNT_TEXT_FLAG_NORMAL);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
635
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
636 /* Unnecessary to print the timestamp for delayed message */
16904
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
637 if (purple_prefs_get_bool("/finch/conversations/timestamps"))
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
638 gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv),
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
639 purple_utf8_strftime("(%H:%M:%S) ", localtime(&mtime)), GNT_TEXT_FLAG_DIM);
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
640
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
641 if (flags & PURPLE_MESSAGE_AUTO_RESP)
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
642 gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv),
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
643 _("<AUTO-REPLY> "), GNT_TEXT_FLAG_BOLD);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
644
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
645 if (who && *who && (flags & (PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_RECV)))
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
646 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
647 char * name = NULL;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
648
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
649 if (purple_message_meify((char*)message, -1))
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
650 name = g_strdup_printf("*** %s ", who);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
651 else
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
652 name = g_strdup_printf("%s: ", who);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
653
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
654 gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv),
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
655 name, GNT_TEXT_FLAG_BOLD);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
656 g_free(name);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
657 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
658 else
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
659 fl = GNT_TEXT_FLAG_DIM;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
660
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
661 if (flags & PURPLE_MESSAGE_ERROR)
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
662 fl |= GNT_TEXT_FLAG_BOLD;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
663 if (flags & PURPLE_MESSAGE_NICK)
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
664 fl |= GNT_TEXT_FLAG_UNDERLINE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
665
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
666 /* XXX: Remove this workaround when textview can parse messages. */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
667 newline = purple_strdup_withhtml(message);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
668 strip = purple_markup_strip_html(newline);
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
669 gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv),
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
670 strip, fl);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
671
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
672 g_free(newline);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
673 g_free(strip);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
674
18637
3597903cf8ff Just show an empty line, instead of bouncing the text down when the user
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18427
diff changeset
675 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM &&
3597903cf8ff Just show an empty line, instead of bouncing the text down when the user
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18427
diff changeset
676 purple_conv_im_get_typing_state(PURPLE_CONV_IM(conv)) == PURPLE_TYPING) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
677 strip = g_strdup_printf(_("\n%s is typing..."), purple_conversation_get_name(conv));
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
678 gnt_text_view_append_text_with_tag(GNT_TEXT_VIEW(ggconv->tv),
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
679 strip, GNT_TEXT_FLAG_DIM, "typing");
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
680 g_free(strip);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
681 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
682
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
683 if (pos <= 1)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
684 gnt_text_view_scroll(GNT_TEXT_VIEW(ggconv->tv), 0);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
685
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
686 if (flags & (PURPLE_MESSAGE_RECV | PURPLE_MESSAGE_NICK | PURPLE_MESSAGE_ERROR))
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
687 gnt_widget_set_urgent(ggconv->tv);
18100
f63b3a23280d Provide a 'unseen-count' data for the conversations so the dbus-docklet can use that information.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17529
diff changeset
688 if (flags & PURPLE_MESSAGE_RECV && !gnt_widget_has_focus(ggconv->window)) {
f63b3a23280d Provide a 'unseen-count' data for the conversations so the dbus-docklet can use that information.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17529
diff changeset
689 int count = GPOINTER_TO_INT(purple_conversation_get_data(conv, "unseen-count"));
f63b3a23280d Provide a 'unseen-count' data for the conversations so the dbus-docklet can use that information.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17529
diff changeset
690 purple_conversation_set_data(conv, "unseen-count", GINT_TO_POINTER(count + 1));
f63b3a23280d Provide a 'unseen-count' data for the conversations so the dbus-docklet can use that information.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17529
diff changeset
691 purple_conversation_update(conv, PURPLE_CONV_UPDATE_UNSEEN);
f63b3a23280d Provide a 'unseen-count' data for the conversations so the dbus-docklet can use that information.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17529
diff changeset
692 }
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
693 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
694
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
695 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
696 finch_write_chat(PurpleConversation *conv, const char *who, const char *message,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
697 PurpleMessageFlags flags, time_t mtime)
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
698 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
699 purple_conversation_write(conv, who, message, flags, mtime);
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
700 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
701
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
702 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
703 finch_write_im(PurpleConversation *conv, const char *who, const char *message,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
704 PurpleMessageFlags flags, time_t mtime)
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
705 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
706 PurpleAccount *account = purple_conversation_get_account(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
707 if (flags & PURPLE_MESSAGE_SEND)
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
708 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
709 who = purple_connection_get_display_name(purple_account_get_connection(account));
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
710 if (!who)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
711 who = purple_account_get_alias(account);
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
712 if (!who)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
713 who = purple_account_get_username(account);
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
714 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
715 else if (flags & PURPLE_MESSAGE_RECV)
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
716 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
717 PurpleBuddy *buddy;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
718 who = purple_conversation_get_name(conv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
719 buddy = purple_find_buddy(account, who);
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
720 if (buddy)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
721 who = purple_buddy_get_contact_alias(buddy);
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
722 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
723
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
724 purple_conversation_write(conv, who, message, flags, mtime);
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
725 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
726
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
727 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
728 finch_write_conv(PurpleConversation *conv, const char *who, const char *alias,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
729 const char *message, PurpleMessageFlags flags, time_t mtime)
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
730 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
731 const char *name;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
732 if (alias && *alias)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
733 name = alias;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
734 else if (who && *who)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
735 name = who;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
736 else
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
737 name = NULL;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
738
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
739 finch_write_common(conv, name, message, flags, mtime);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
740 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
741
17083
f2137f75fd10 Show user flags in chat userlist.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17032
diff changeset
742 static const char *
f2137f75fd10 Show user flags in chat userlist.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17032
diff changeset
743 chat_flag_text(PurpleConvChatBuddyFlags flags)
f2137f75fd10 Show user flags in chat userlist.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17032
diff changeset
744 {
f2137f75fd10 Show user flags in chat userlist.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17032
diff changeset
745 if (flags & PURPLE_CBFLAGS_FOUNDER)
f2137f75fd10 Show user flags in chat userlist.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17032
diff changeset
746 return "~";
f2137f75fd10 Show user flags in chat userlist.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17032
diff changeset
747 if (flags & PURPLE_CBFLAGS_OP)
f2137f75fd10 Show user flags in chat userlist.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17032
diff changeset
748 return "@";
f2137f75fd10 Show user flags in chat userlist.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17032
diff changeset
749 if (flags & PURPLE_CBFLAGS_HALFOP)
f2137f75fd10 Show user flags in chat userlist.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17032
diff changeset
750 return "%";
f2137f75fd10 Show user flags in chat userlist.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17032
diff changeset
751 if (flags & PURPLE_CBFLAGS_VOICE)
f2137f75fd10 Show user flags in chat userlist.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17032
diff changeset
752 return "+";
f2137f75fd10 Show user flags in chat userlist.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17032
diff changeset
753 return " ";
f2137f75fd10 Show user flags in chat userlist.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17032
diff changeset
754 }
f2137f75fd10 Show user flags in chat userlist.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17032
diff changeset
755
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
756 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
757 finch_chat_add_users(PurpleConversation *conv, GList *users, gboolean new_arrivals)
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
758 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
759 FinchConv *ggc = conv->ui_data;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
760 GntEntry *entry = GNT_ENTRY(ggc->entry);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
761
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
762 if (!new_arrivals)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
763 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
764 /* Print the list of users in the room */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
765 GString *string = g_string_new(_("List of users:\n"));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
766 GList *iter;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
767
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
768 for (iter = users; iter; iter = iter->next)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
769 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
770 PurpleConvChatBuddy *cbuddy = iter->data;
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
771 char *str;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
772
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
773 if ((str = cbuddy->alias) == NULL)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
774 str = cbuddy->name;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
775 g_string_append_printf(string, "[ %s ]", str);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
776 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
777
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
778 purple_conversation_write(conv, NULL, string->str,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
779 PURPLE_MESSAGE_SYSTEM, time(NULL));
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
780 g_string_free(string, TRUE);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
781 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
782
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
783 for (; users; users = users->next)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
784 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
785 PurpleConvChatBuddy *cbuddy = users->data;
16904
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
786 GntTree *tree = GNT_TREE(ggc->u.chat->userlist);
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
787 gnt_entry_add_suggest(entry, cbuddy->name);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
788 gnt_entry_add_suggest(entry, cbuddy->alias);
16904
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
789 gnt_tree_add_row_after(tree, g_strdup(cbuddy->name),
17083
f2137f75fd10 Show user flags in chat userlist.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17032
diff changeset
790 gnt_tree_create_row(tree, chat_flag_text(cbuddy->flags), cbuddy->alias), NULL, NULL);
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
791 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
792 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
793
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
794 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
795 finch_chat_rename_user(PurpleConversation *conv, const char *old, const char *new_n, const char *new_a)
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
796 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
797 /* Update the name for string completion */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
798 FinchConv *ggc = conv->ui_data;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
799 GntEntry *entry = GNT_ENTRY(ggc->entry);
16904
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
800 GntTree *tree = GNT_TREE(ggc->u.chat->userlist);
17083
f2137f75fd10 Show user flags in chat userlist.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17032
diff changeset
801 PurpleConvChatBuddy *cb = purple_conv_chat_cb_find(PURPLE_CONV_CHAT(conv), new_n);
f2137f75fd10 Show user flags in chat userlist.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17032
diff changeset
802
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
803 gnt_entry_remove_suggest(entry, old);
17083
f2137f75fd10 Show user flags in chat userlist.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17032
diff changeset
804 gnt_tree_remove(tree, (gpointer)old);
f2137f75fd10 Show user flags in chat userlist.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17032
diff changeset
805
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
806 gnt_entry_add_suggest(entry, new_n);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
807 gnt_entry_add_suggest(entry, new_a);
16904
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
808 gnt_tree_add_row_after(tree, g_strdup(new_n),
17083
f2137f75fd10 Show user flags in chat userlist.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17032
diff changeset
809 gnt_tree_create_row(tree, chat_flag_text(cb->flags), new_a), NULL, NULL);
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
810 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
811
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
812 static void
17104
46f2f86e08e4 Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents: 17083
diff changeset
813 finch_chat_remove_users(PurpleConversation *conv, GList *list)
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
814 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
815 /* Remove the name from string completion */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
816 FinchConv *ggc = conv->ui_data;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
817 GntEntry *entry = GNT_ENTRY(ggc->entry);
16904
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
818 for (; list; list = list->next) {
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
819 GntTree *tree = GNT_TREE(ggc->u.chat->userlist);
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
820 gnt_entry_remove_suggest(entry, list->data);
16904
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
821 gnt_tree_remove(tree, list->data);
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
822 }
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
823 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
824
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
825 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
826 finch_chat_update_user(PurpleConversation *conv, const char *user)
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
827 {
17083
f2137f75fd10 Show user flags in chat userlist.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17032
diff changeset
828 PurpleConvChatBuddy *cb = purple_conv_chat_cb_find(PURPLE_CONV_CHAT(conv), user);
f2137f75fd10 Show user flags in chat userlist.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17032
diff changeset
829 FinchConv *ggc = conv->ui_data;
f2137f75fd10 Show user flags in chat userlist.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17032
diff changeset
830 gnt_tree_change_text(GNT_TREE(ggc->u.chat->userlist), (gpointer)user, 0, chat_flag_text(cb->flags));
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
831 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
832
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
833 static PurpleConversationUiOps conv_ui_ops =
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
834 {
17104
46f2f86e08e4 Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents: 17083
diff changeset
835 finch_create_conversation,
46f2f86e08e4 Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents: 17083
diff changeset
836 finch_destroy_conversation,
46f2f86e08e4 Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents: 17083
diff changeset
837 finch_write_chat,
46f2f86e08e4 Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents: 17083
diff changeset
838 finch_write_im,
46f2f86e08e4 Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents: 17083
diff changeset
839 finch_write_conv,
46f2f86e08e4 Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents: 17083
diff changeset
840 finch_chat_add_users,
46f2f86e08e4 Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents: 17083
diff changeset
841 finch_chat_rename_user,
46f2f86e08e4 Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents: 17083
diff changeset
842 finch_chat_remove_users,
46f2f86e08e4 Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents: 17083
diff changeset
843 finch_chat_update_user,
46f2f86e08e4 Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents: 17083
diff changeset
844 NULL, /* present */
46f2f86e08e4 Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents: 17083
diff changeset
845 NULL, /* has_focus */
46f2f86e08e4 Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents: 17083
diff changeset
846 NULL, /* custom_smiley_add */
46f2f86e08e4 Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents: 17083
diff changeset
847 NULL, /* custom_smiley_write */
46f2f86e08e4 Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents: 17083
diff changeset
848 NULL, /* custom_smiley_close */
46f2f86e08e4 Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents: 17083
diff changeset
849 NULL, /* send_confirm */
46f2f86e08e4 Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents: 17083
diff changeset
850 NULL,
46f2f86e08e4 Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents: 17083
diff changeset
851 NULL,
46f2f86e08e4 Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents: 17083
diff changeset
852 NULL,
46f2f86e08e4 Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents: 17083
diff changeset
853 NULL
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
854 };
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
855
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
856 PurpleConversationUiOps *finch_conv_get_ui_ops()
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
857 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
858 return &conv_ui_ops;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
859 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
860
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
861 /* Xerox */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
862 static PurpleCmdRet
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
863 say_command_cb(PurpleConversation *conv,
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
864 const char *cmd, char **args, char **error, void *data)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
865 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
866 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
867 purple_conv_im_send(PURPLE_CONV_IM(conv), args[0]);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
868 else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
869 purple_conv_chat_send(PURPLE_CONV_CHAT(conv), args[0]);
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
870
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
871 return PURPLE_CMD_RET_OK;
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
872 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
873
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
874 /* Xerox */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
875 static PurpleCmdRet
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
876 me_command_cb(PurpleConversation *conv,
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
877 const char *cmd, char **args, char **error, void *data)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
878 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
879 char *tmp;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
880
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
881 tmp = g_strdup_printf("/me %s", args[0]);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
882
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
883 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
884 purple_conv_im_send(PURPLE_CONV_IM(conv), tmp);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
885 else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
886 purple_conv_chat_send(PURPLE_CONV_CHAT(conv), tmp);
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
887
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
888 g_free(tmp);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
889 return PURPLE_CMD_RET_OK;
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
890 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
891
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
892 /* Xerox */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
893 static PurpleCmdRet
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
894 debug_command_cb(PurpleConversation *conv,
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
895 const char *cmd, char **args, char **error, void *data)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
896 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
897 char *tmp, *markup;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
898 PurpleCmdStatus status;
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
899
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
900 if (!g_ascii_strcasecmp(args[0], "version")) {
16941
00c24829e243 Patch #751 from 'Dustin Howett' to change the output string from /debug version.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16904
diff changeset
901 tmp = g_strdup_printf("me is using Finch v%s.", VERSION);
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
902 markup = g_markup_escape_text(tmp, -1);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
903
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
904 status = purple_cmd_do_command(conv, tmp, markup, error);
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
905
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
906 g_free(tmp);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
907 g_free(markup);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
908 return status;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
909 } else {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
910 purple_conversation_write(conv, NULL, _("Supported debug options are: version"),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
911 PURPLE_MESSAGE_NO_LOG|PURPLE_MESSAGE_ERROR, time(NULL));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
912 return PURPLE_CMD_STATUS_OK;
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
913 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
914 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
915
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
916 /* Xerox */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
917 static PurpleCmdRet
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
918 clear_command_cb(PurpleConversation *conv,
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
919 const char *cmd, char **args, char **error, void *data)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
920 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
921 FinchConv *ggconv = conv->ui_data;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
922 gnt_text_view_clear(GNT_TEXT_VIEW(ggconv->tv));
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
923 return PURPLE_CMD_STATUS_OK;
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
924 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
925
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
926 /* Xerox */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
927 static PurpleCmdRet
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
928 help_command_cb(PurpleConversation *conv,
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
929 const char *cmd, char **args, char **error, void *data)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
930 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
931 GList *l, *text;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
932 GString *s;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
933
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
934 if (args[0] != NULL) {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
935 s = g_string_new("");
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
936 text = purple_cmd_help(conv, args[0]);
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
937
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
938 if (text) {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
939 for (l = text; l; l = l->next)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
940 if (l->next)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
941 g_string_append_printf(s, "%s\n", (char *)l->data);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
942 else
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
943 g_string_append_printf(s, "%s", (char *)l->data);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
944 } else {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
945 g_string_append(s, _("No such command (in this context)."));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
946 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
947 } else {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
948 s = g_string_new(_("Use \"/help &lt;command&gt;\" for help on a specific command.\n"
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
949 "The following commands are available in this context:\n"));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
950
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
951 text = purple_cmd_list(conv);
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
952 for (l = text; l; l = l->next)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
953 if (l->next)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
954 g_string_append_printf(s, "%s, ", (char *)l->data);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
955 else
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
956 g_string_append_printf(s, "%s.", (char *)l->data);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
957 g_list_free(text);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
958 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
959
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
960 purple_conversation_write(conv, NULL, s->str, PURPLE_MESSAGE_NO_LOG, time(NULL));
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
961 g_string_free(s, TRUE);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
962
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
963 return PURPLE_CMD_STATUS_OK;
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
964 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
965
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
966 static PurpleCmdRet
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
967 cmd_show_window(PurpleConversation *conv, const char *cmd, char **args, char **error, gpointer data)
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
968 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
969 void (*callback)() = data;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
970 callback();
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
971 return PURPLE_CMD_STATUS_OK;
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
972 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
973
16904
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
974 static PurpleCmdRet
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
975 users_command_cb(PurpleConversation *conv, const char *cmd, char **args, char **error, gpointer data)
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
976 {
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
977 FinchConv *fc = conv->ui_data;
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
978 FinchConvChat *ch;
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
979 if (!fc)
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
980 return PURPLE_CMD_STATUS_FAILED;
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
981
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
982 ch = fc->u.chat;
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
983 gnt_widget_set_visible(ch->userlist,
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
984 (GNT_WIDGET_IS_FLAG_SET(ch->userlist, GNT_WIDGET_INVISIBLE)));
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
985 gnt_box_readjust(GNT_BOX(fc->window));
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
986 gnt_box_give_focus_to_child(GNT_BOX(fc->window), fc->entry);
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
987 purple_prefs_set_bool(PREF_USERLIST, !(GNT_WIDGET_IS_FLAG_SET(ch->userlist, GNT_WIDGET_INVISIBLE)));
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
988 return PURPLE_CMD_STATUS_OK;
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
989 }
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
990
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
991 void finch_conversation_init()
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
992 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
993 purple_prefs_add_none(PREF_ROOT);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
994 purple_prefs_add_none(PREF_ROOT "/size");
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
995 purple_prefs_add_int(PREF_ROOT "/size/width", 70);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
996 purple_prefs_add_int(PREF_ROOT "/size/height", 20);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
997 purple_prefs_add_none(PREF_ROOT "/position");
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
998 purple_prefs_add_int(PREF_ROOT "/position/x", 0);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
999 purple_prefs_add_int(PREF_ROOT "/position/y", 0);
16904
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
1000 purple_prefs_add_none(PREF_CHAT);
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
1001 purple_prefs_add_bool(PREF_USERLIST, FALSE);
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1002
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1003 /* Xerox the commands */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
1004 purple_cmd_register("say", "S", PURPLE_CMD_P_DEFAULT,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
1005 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM, NULL,
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1006 say_command_cb, _("say &lt;message&gt;: Send a message normally as if you weren't using a command."), NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
1007 purple_cmd_register("me", "S", PURPLE_CMD_P_DEFAULT,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
1008 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM, NULL,
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1009 me_command_cb, _("me &lt;action&gt;: Send an IRC style action to a buddy or chat."), NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
1010 purple_cmd_register("debug", "w", PURPLE_CMD_P_DEFAULT,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
1011 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM, NULL,
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1012 debug_command_cb, _("debug &lt;option&gt;: Send various debug information to the current conversation."), NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
1013 purple_cmd_register("clear", "", PURPLE_CMD_P_DEFAULT,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
1014 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM, NULL,
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1015 clear_command_cb, _("clear: Clears the conversation scrollback."), NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
1016 purple_cmd_register("help", "w", PURPLE_CMD_P_DEFAULT,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
1017 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, NULL,
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1018 help_command_cb, _("help &lt;command&gt;: Help on a specific command."), NULL);
16904
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
1019 purple_cmd_register("users", "", PURPLE_CMD_P_DEFAULT,
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
1020 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, NULL,
b799918b6cdc Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16903
diff changeset
1021 users_command_cb, _("users: Show the list of users in the chat."), NULL);
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1022
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1023 /* Now some commands to bring up some other windows */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
1024 purple_cmd_register("plugins", "", PURPLE_CMD_P_DEFAULT,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
1025 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM, NULL,
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1026 cmd_show_window, _("plugins: Show the plugins window."), finch_plugins_show_all);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
1027 purple_cmd_register("buddylist", "", PURPLE_CMD_P_DEFAULT,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
1028 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM, NULL,
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1029 cmd_show_window, _("buddylist: Show the buddylist."), finch_blist_show);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
1030 purple_cmd_register("accounts", "", PURPLE_CMD_P_DEFAULT,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
1031 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM, NULL,
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1032 cmd_show_window, _("accounts: Show the accounts window."), finch_accounts_show_all);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
1033 purple_cmd_register("debugwin", "", PURPLE_CMD_P_DEFAULT,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
1034 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM, NULL,
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1035 cmd_show_window, _("debugwin: Show the debug window."), finch_debug_window_show);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
1036 purple_cmd_register("prefs", "", PURPLE_CMD_P_DEFAULT,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
1037 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM, NULL,
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1038 cmd_show_window, _("prefs: Show the preference window."), finch_prefs_show_all);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
1039 purple_cmd_register("status", "", PURPLE_CMD_P_DEFAULT,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
1040 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM, NULL,
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1041 cmd_show_window, _("statuses: Show the savedstatuses window."), finch_savedstatus_show_all);
17032
d6e855aedc30 Notify when you leave a chat, after /part or /kick.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16989
diff changeset
1042
d6e855aedc30 Notify when you leave a chat, after /part or /kick.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16989
diff changeset
1043 purple_signal_connect(purple_conversations_get_handle(), "buddy-typing", finch_conv_get_handle(),
d6e855aedc30 Notify when you leave a chat, after /part or /kick.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16989
diff changeset
1044 PURPLE_CALLBACK(update_buddy_typing), NULL);
d6e855aedc30 Notify when you leave a chat, after /part or /kick.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16989
diff changeset
1045 purple_signal_connect(purple_conversations_get_handle(), "buddy-typing-stopped", finch_conv_get_handle(),
d6e855aedc30 Notify when you leave a chat, after /part or /kick.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16989
diff changeset
1046 PURPLE_CALLBACK(update_buddy_typing), NULL);
d6e855aedc30 Notify when you leave a chat, after /part or /kick.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16989
diff changeset
1047 purple_signal_connect(purple_conversations_get_handle(), "chat-left", finch_conv_get_handle(),
d6e855aedc30 Notify when you leave a chat, after /part or /kick.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16989
diff changeset
1048 PURPLE_CALLBACK(chat_left_cb), NULL);
19321
39d3a81a5850 Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18637
diff changeset
1049 purple_signal_connect(purple_blist_get_handle(), "buddy-signed-on", finch_conv_get_handle(),
39d3a81a5850 Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18637
diff changeset
1050 PURPLE_CALLBACK(buddy_signed_on_off), NULL);
39d3a81a5850 Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18637
diff changeset
1051 purple_signal_connect(purple_blist_get_handle(), "buddy-signed-off", finch_conv_get_handle(),
39d3a81a5850 Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18637
diff changeset
1052 PURPLE_CALLBACK(buddy_signed_on_off), NULL);
39d3a81a5850 Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18637
diff changeset
1053 purple_signal_connect(purple_connections_get_handle(), "signed-on", finch_conv_get_handle(),
39d3a81a5850 Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18637
diff changeset
1054 PURPLE_CALLBACK(account_signed_on_off), NULL);
39d3a81a5850 Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18637
diff changeset
1055 purple_signal_connect(purple_connections_get_handle(), "signed-off", finch_conv_get_handle(),
39d3a81a5850 Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18637
diff changeset
1056 PURPLE_CALLBACK(account_signed_on_off), NULL);
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1057 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1058
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1059 void finch_conversation_uninit()
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1060 {
17032
d6e855aedc30 Notify when you leave a chat, after /part or /kick.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16989
diff changeset
1061 purple_signals_disconnect_by_handle(finch_conv_get_handle());
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1062 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1063
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
1064 void finch_conversation_set_active(PurpleConversation *conv)
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1065 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1066 FinchConv *ggconv = conv->ui_data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
1067 PurpleAccount *account;
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1068 char *title;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1069
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1070 g_return_if_fail(ggconv);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1071 g_return_if_fail(g_list_find(ggconv->list, conv));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1072
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1073 ggconv->active_conv = conv;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
1074 account = purple_conversation_get_account(conv);
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1075 title = get_conversation_title(conv, account);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1076 gnt_screen_rename_widget(ggconv->window, title);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1077 g_free(title);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1078 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1079
16128
7a2ffa981c1a Allow adding information widgets in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16124
diff changeset
1080 void finch_conversation_set_info_widget(PurpleConversation *conv, GntWidget *widget)
7a2ffa981c1a Allow adding information widgets in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16124
diff changeset
1081 {
7a2ffa981c1a Allow adding information widgets in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16124
diff changeset
1082 FinchConv *fc = conv->ui_data;
7a2ffa981c1a Allow adding information widgets in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16124
diff changeset
1083 int height, width;
7a2ffa981c1a Allow adding information widgets in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16124
diff changeset
1084
7a2ffa981c1a Allow adding information widgets in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16124
diff changeset
1085 gnt_box_remove_all(GNT_BOX(fc->info));
7a2ffa981c1a Allow adding information widgets in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16124
diff changeset
1086
7a2ffa981c1a Allow adding information widgets in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16124
diff changeset
1087 if (widget) {
7a2ffa981c1a Allow adding information widgets in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16124
diff changeset
1088 gnt_box_add_widget(GNT_BOX(fc->info), widget);
7a2ffa981c1a Allow adding information widgets in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16124
diff changeset
1089 gnt_box_readjust(GNT_BOX(fc->info));
7a2ffa981c1a Allow adding information widgets in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16124
diff changeset
1090 }
7a2ffa981c1a Allow adding information widgets in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16124
diff changeset
1091
7a2ffa981c1a Allow adding information widgets in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16124
diff changeset
1092 gnt_widget_get_size(fc->window, &width, &height);
7a2ffa981c1a Allow adding information widgets in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16124
diff changeset
1093 gnt_box_readjust(GNT_BOX(fc->window));
7a2ffa981c1a Allow adding information widgets in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16124
diff changeset
1094 gnt_screen_resize_widget(fc->window, width, height);
7a2ffa981c1a Allow adding information widgets in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16124
diff changeset
1095 gnt_box_give_focus_to_child(GNT_BOX(fc->window), fc->entry);
7a2ffa981c1a Allow adding information widgets in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16124
diff changeset
1096 }
7a2ffa981c1a Allow adding information widgets in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16124
diff changeset
1097