Sat, 17 Nov 2007 19:44:50 +0000
disapproval of revision '4a89985398004a5cfc7b55b698fbff33d6f53b06'
|
14620
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14612
diff
changeset
|
1 | /** |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14612
diff
changeset
|
2 | * @file gntconv.c GNT Conversation API |
|
16255
fa61ee19f526
Rename the Doxygen group from gntui to finch and define the finch group
Richard Laager <rlaager@pidgin.im>
parents:
16190
diff
changeset
|
3 | * @ingroup finch |
|
20147
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19986
diff
changeset
|
4 | */ |
|
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19986
diff
changeset
|
5 | |
|
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19986
diff
changeset
|
6 | /* finch |
|
14620
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14612
diff
changeset
|
7 | * |
|
15931
716b5fac1895
Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@pidgin.im>
parents:
15906
diff
changeset
|
8 | * Finch is the legal property of its developers, whose names are too numerous |
|
14620
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14612
diff
changeset
|
9 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14612
diff
changeset
|
10 | * source distribution. |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14612
diff
changeset
|
11 | * |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14612
diff
changeset
|
12 | * This program is free software; you can redistribute it and/or modify |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14612
diff
changeset
|
13 | * it under the terms of the GNU General Public License as published by |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14612
diff
changeset
|
14 | * the Free Software Foundation; either version 2 of the License, or |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14612
diff
changeset
|
15 | * (at your option) any later version. |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14612
diff
changeset
|
16 | * |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14612
diff
changeset
|
17 | * This program is distributed in the hope that it will be useful, |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14612
diff
changeset
|
18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14612
diff
changeset
|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14612
diff
changeset
|
20 | * GNU General Public License for more details. |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14612
diff
changeset
|
21 | * |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14612
diff
changeset
|
22 | * You should have received a copy of the GNU General Public License |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14612
diff
changeset
|
23 | * along with this program; if not, write to the Free Software |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19798
diff
changeset
|
24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
14620
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14612
diff
changeset
|
25 | */ |
|
13958
bd1c3bb3f33d
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13949
diff
changeset
|
26 | #include <string.h> |
|
14028
eefce1b0c4e3
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14005
diff
changeset
|
27 | |
|
18273
e61c53184c52
#include reorganizations to allow compiling with glib < 2.8 using the
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
18173
diff
changeset
|
28 | #include "finch.h" |
|
e61c53184c52
#include reorganizations to allow compiling with glib < 2.8 using the
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
18173
diff
changeset
|
29 | |
|
14028
eefce1b0c4e3
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14005
diff
changeset
|
30 | #include <cmds.h> |
|
15821
26ca6a5c7668
Make 'last message sent' idleness work. Should we be doing gaim_idle_touch from somewhere inside libpurple instead?
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15373
diff
changeset
|
31 | #include <idle.h> |
|
14072
4e64a4f18686
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14070
diff
changeset
|
32 | #include <prefs.h> |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
33 | #include <util.h> |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
34 | |
|
14086
732c14687955
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14073
diff
changeset
|
35 | #include "gntaccount.h" |
|
13978
70d7030b7f26
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13969
diff
changeset
|
36 | #include "gntblist.h" |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
37 | #include "gntconv.h" |
|
14086
732c14687955
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14073
diff
changeset
|
38 | #include "gntdebug.h" |
|
732c14687955
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14073
diff
changeset
|
39 | #include "gntplugin.h" |
|
14121
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14109
diff
changeset
|
40 | #include "gntprefs.h" |
|
19612
043dcbf3a36e
Fix #2767 (per-conversation/chat mute option).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19611
diff
changeset
|
41 | #include "gntsound.h" |
|
14188
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14153
diff
changeset
|
42 | #include "gntstatus.h" |
| 16948 | 43 | #include "gntpounce.h" |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
44 | |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
45 | #include "gnt.h" |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
46 | #include "gntbox.h" |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
47 | #include "gntentry.h" |
|
16949
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
48 | #include "gntlabel.h" |
| 16948 | 49 | #include "gntmenu.h" |
| 50 | #include "gntmenuitem.h" | |
| 51 | #include "gntmenuitemcheck.h" | |
|
16949
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
52 | #include "gnttextview.h" |
|
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
53 | #include "gnttree.h" |
|
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
54 | #include "gntutils.h" |
| 16948 | 55 | #include "gntwindow.h" |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
56 | |
|
16478
19107605c565
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents:
16255
diff
changeset
|
57 | #define PREF_ROOT "/finch/conversations" |
|
16949
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
58 | #define PREF_CHAT PREF_ROOT "/chats" |
|
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
59 | #define PREF_USERLIST PREF_CHAT "/userlist" |
|
14072
4e64a4f18686
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14070
diff
changeset
|
60 | |
|
14253
b63ebf84c42b
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
14188
diff
changeset
|
61 | #include "config.h" |
|
b63ebf84c42b
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
14188
diff
changeset
|
62 | |
|
17076
9968d75058a4
Notify when you leave a chat, after /part or /kick.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17028
diff
changeset
|
63 | static void finch_write_common(PurpleConversation *conv, const char *who, |
|
9968d75058a4
Notify when you leave a chat, after /part or /kick.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17028
diff
changeset
|
64 | const char *message, PurpleMessageFlags flags, time_t mtime); |
|
19449
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
65 | static void generate_send_to_menu(FinchConv *ggc); |
|
17076
9968d75058a4
Notify when you leave a chat, after /part or /kick.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17028
diff
changeset
|
66 | |
|
19986
7c725191167c
Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
67 | static PurpleBlistNode * |
|
7c725191167c
Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
68 | get_conversation_blist_node(PurpleConversation *conv) |
|
7c725191167c
Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
69 | { |
|
7c725191167c
Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
70 | PurpleBlistNode *node = NULL; |
|
7c725191167c
Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
71 | |
|
7c725191167c
Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
72 | switch (purple_conversation_get_type(conv)) { |
|
7c725191167c
Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
73 | case PURPLE_CONV_TYPE_IM: |
|
7c725191167c
Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
74 | node = (PurpleBlistNode*)purple_find_buddy(conv->account, conv->name); |
|
7c725191167c
Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
75 | node = node ? node->parent : NULL; |
|
7c725191167c
Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
76 | break; |
|
7c725191167c
Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
77 | case PURPLE_CONV_TYPE_CHAT: |
|
7c725191167c
Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
78 | node = (PurpleBlistNode*)purple_blist_find_chat(conv->account, conv->name); |
|
7c725191167c
Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
79 | break; |
|
7c725191167c
Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
80 | default: |
|
7c725191167c
Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
81 | break; |
|
7c725191167c
Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
82 | } |
|
7c725191167c
Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
83 | return node; |
|
7c725191167c
Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
84 | } |
|
7c725191167c
Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
85 | |
|
15373
8483019d6961
[gaim-migrate @ 18102]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15262
diff
changeset
|
86 | static void |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15841
diff
changeset
|
87 | send_typing_notification(GntWidget *w, FinchConv *ggconv) |
|
15262
8f97f9047232
[gaim-migrate @ 17990]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15250
diff
changeset
|
88 | { |
|
15373
8483019d6961
[gaim-migrate @ 18102]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15262
diff
changeset
|
89 | const char *text = gnt_entry_get_text(GNT_ENTRY(ggconv->entry)); |
|
17854
7c5d9ee6846a
Do not send typing notification if you are typing a /-command.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17360
diff
changeset
|
90 | gboolean empty = (!text || !*text || (*text == '/')); |
|
16478
19107605c565
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents:
16255
diff
changeset
|
91 | if (purple_prefs_get_bool("/finch/conversations/notify_typing")) { |
| 15884 | 92 | PurpleConversation *conv = ggconv->active_conv; |
| 93 | PurpleConvIm *im = PURPLE_CONV_IM(conv); | |
|
15373
8483019d6961
[gaim-migrate @ 18102]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15262
diff
changeset
|
94 | if (!empty) { |
| 15884 | 95 | gboolean send = (purple_conv_im_get_send_typed_timeout(im) == 0); |
|
15262
8f97f9047232
[gaim-migrate @ 17990]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15250
diff
changeset
|
96 | |
| 15884 | 97 | purple_conv_im_stop_send_typed_timeout(im); |
| 98 | purple_conv_im_start_send_typed_timeout(im); | |
| 99 | if (send || (purple_conv_im_get_type_again(im) != 0 && | |
| 100 | time(NULL) > purple_conv_im_get_type_again(im))) { | |
|
15262
8f97f9047232
[gaim-migrate @ 17990]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15250
diff
changeset
|
101 | unsigned int timeout; |
| 15884 | 102 | timeout = serv_send_typing(purple_conversation_get_gc(conv), |
| 103 | purple_conversation_get_name(conv), | |
| 104 | PURPLE_TYPING); | |
| 105 | purple_conv_im_set_type_again(im, timeout); | |
|
15262
8f97f9047232
[gaim-migrate @ 17990]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15250
diff
changeset
|
106 | } |
|
15373
8483019d6961
[gaim-migrate @ 18102]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15262
diff
changeset
|
107 | } else { |
| 15884 | 108 | purple_conv_im_stop_send_typed_timeout(im); |
|
15373
8483019d6961
[gaim-migrate @ 18102]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15262
diff
changeset
|
109 | |
| 15884 | 110 | serv_send_typing(purple_conversation_get_gc(conv), |
| 111 | purple_conversation_get_name(conv), | |
| 112 | PURPLE_NOT_TYPING); | |
|
15262
8f97f9047232
[gaim-migrate @ 17990]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15250
diff
changeset
|
113 | } |
|
8f97f9047232
[gaim-migrate @ 17990]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15250
diff
changeset
|
114 | } |
|
8f97f9047232
[gaim-migrate @ 17990]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15250
diff
changeset
|
115 | } |
|
8f97f9047232
[gaim-migrate @ 17990]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15250
diff
changeset
|
116 | |
|
21271
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
117 | static void |
|
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
118 | entry_key_pressed(GntWidget *w, FinchConv *ggconv) |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
119 | { |
|
21271
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
120 | const char *text = gnt_entry_get_text(GNT_ENTRY(ggconv->entry)); |
|
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
121 | if (*text == '/') |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
122 | { |
|
21271
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
123 | PurpleConversation *conv = ggconv->active_conv; |
|
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
124 | PurpleCmdStatus status; |
|
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
125 | const char *cmdline = text + 1; |
|
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
126 | char *error = NULL, *escape; |
|
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
127 | |
|
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
128 | escape = g_markup_escape_text(cmdline, -1); |
|
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
129 | status = purple_cmd_do_command(conv, cmdline, escape, &error); |
|
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
130 | g_free(escape); |
|
14028
eefce1b0c4e3
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14005
diff
changeset
|
131 | |
|
21271
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
132 | switch (status) |
|
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
133 | { |
|
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
134 | case PURPLE_CMD_STATUS_OK: |
|
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
135 | break; |
|
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
136 | case PURPLE_CMD_STATUS_NOT_FOUND: |
|
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
137 | purple_conversation_write(conv, "", _("No such command."), |
|
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
138 | PURPLE_MESSAGE_NO_LOG, time(NULL)); |
|
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
139 | break; |
|
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
140 | case PURPLE_CMD_STATUS_WRONG_ARGS: |
|
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
141 | purple_conversation_write(conv, "", _("Syntax Error: You typed the wrong number of arguments " |
|
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
142 | "to that command."), |
|
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
143 | PURPLE_MESSAGE_NO_LOG, time(NULL)); |
|
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
144 | break; |
|
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
145 | case PURPLE_CMD_STATUS_FAILED: |
|
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
146 | purple_conversation_write(conv, "", error ? error : _("Your command failed for an unknown reason."), |
|
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
147 | PURPLE_MESSAGE_NO_LOG, time(NULL)); |
|
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
148 | break; |
|
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
149 | case PURPLE_CMD_STATUS_WRONG_TYPE: |
|
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
150 | if(purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) |
|
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
151 | purple_conversation_write(conv, "", _("That command only works in chats, not IMs."), |
| 15884 | 152 | PURPLE_MESSAGE_NO_LOG, time(NULL)); |
|
21271
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
153 | else |
|
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
154 | purple_conversation_write(conv, "", _("That command only works in IMs, not chats."), |
| 15884 | 155 | PURPLE_MESSAGE_NO_LOG, time(NULL)); |
|
21271
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
156 | break; |
|
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
157 | case PURPLE_CMD_STATUS_WRONG_PRPL: |
|
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
158 | purple_conversation_write(conv, "", _("That command doesn't work on this protocol."), |
|
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
159 | PURPLE_MESSAGE_NO_LOG, time(NULL)); |
|
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
160 | break; |
|
14000
aab306afdc43
[gaim-migrate @ 16469]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13993
diff
changeset
|
161 | } |
|
21271
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
162 | g_free(error); |
|
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
163 | } |
|
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
164 | else if (!purple_account_is_connected(ggconv->active_conv->account)) |
|
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
165 | { |
|
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
166 | purple_conversation_write(ggconv->active_conv, "", _("Message was not sent, because you are not signed on."), |
|
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
167 | PURPLE_MESSAGE_ERROR | PURPLE_MESSAGE_NO_LOG, time(NULL)); |
|
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
168 | } |
|
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
169 | else |
|
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
170 | { |
|
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
171 | char *escape = g_markup_escape_text(text, -1); |
|
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
172 | char *apos = purple_strreplace(escape, "'", "'"); |
|
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
173 | g_free(escape); |
|
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
174 | escape = apos; |
|
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
175 | switch (purple_conversation_get_type(ggconv->active_conv)) |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
176 | { |
|
21271
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
177 | case PURPLE_CONV_TYPE_IM: |
|
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
178 | purple_conv_im_send_with_flags(PURPLE_CONV_IM(ggconv->active_conv), escape, PURPLE_MESSAGE_SEND); |
|
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
179 | break; |
|
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
180 | case PURPLE_CONV_TYPE_CHAT: |
|
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
181 | purple_conv_chat_send(PURPLE_CONV_CHAT(ggconv->active_conv), escape); |
|
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
182 | break; |
|
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
183 | default: |
|
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
184 | g_free(escape); |
|
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
185 | g_return_if_reached(); |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
186 | } |
|
21271
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
187 | g_free(escape); |
|
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
188 | purple_idle_touch(); |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
189 | } |
|
21271
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
190 | gnt_entry_add_to_history(GNT_ENTRY(ggconv->entry), text); |
|
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
191 | gnt_entry_clear(GNT_ENTRY(ggconv->entry)); |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
192 | } |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
193 | |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
194 | static void |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15841
diff
changeset
|
195 | closing_window(GntWidget *window, FinchConv *ggconv) |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
196 | { |
|
14450
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
197 | GList *list = ggconv->list; |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
198 | ggconv->window = NULL; |
|
14450
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
199 | while (list) { |
| 15884 | 200 | PurpleConversation *conv = list->data; |
|
14450
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
201 | list = list->next; |
| 15884 | 202 | purple_conversation_destroy(conv); |
|
14450
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
203 | } |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
204 | } |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
205 | |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
206 | static void |
|
14923
ccb42b285510
[gaim-migrate @ 17630]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14884
diff
changeset
|
207 | size_changed_cb(GntWidget *widget, int width, int height) |
|
14072
4e64a4f18686
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14070
diff
changeset
|
208 | { |
|
14923
ccb42b285510
[gaim-migrate @ 17630]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14884
diff
changeset
|
209 | int w, h; |
|
ccb42b285510
[gaim-migrate @ 17630]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14884
diff
changeset
|
210 | gnt_widget_get_size(widget, &w, &h); |
| 15884 | 211 | purple_prefs_set_int(PREF_ROOT "/size/width", w); |
| 212 | purple_prefs_set_int(PREF_ROOT "/size/height", h); | |
|
14072
4e64a4f18686
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14070
diff
changeset
|
213 | } |
|
4e64a4f18686
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14070
diff
changeset
|
214 | |
|
4e64a4f18686
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14070
diff
changeset
|
215 | static void |
|
4e64a4f18686
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14070
diff
changeset
|
216 | save_position_cb(GntWidget *w, int x, int y) |
|
4e64a4f18686
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14070
diff
changeset
|
217 | { |
| 15884 | 218 | purple_prefs_set_int(PREF_ROOT "/position/x", x); |
| 219 | purple_prefs_set_int(PREF_ROOT "/position/y", y); | |
|
14072
4e64a4f18686
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14070
diff
changeset
|
220 | } |
|
4e64a4f18686
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14070
diff
changeset
|
221 | |
| 15884 | 222 | static PurpleConversation * |
|
19449
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
223 | find_conv_with_contact(PurpleAccount *account, const char *name) |
|
14450
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
224 | { |
| 15884 | 225 | PurpleBlistNode *node; |
|
19449
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
226 | PurpleBuddy *buddy = purple_find_buddy(account, name); |
| 15884 | 227 | PurpleConversation *ret = NULL; |
|
14450
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
228 | |
|
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
229 | if (!buddy) |
|
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
230 | return NULL; |
|
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
231 | |
| 15884 | 232 | for (node = ((PurpleBlistNode*)buddy)->parent->child; node; node = node->next) { |
| 233 | if (node == (PurpleBlistNode*)buddy) | |
|
14450
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
234 | continue; |
| 15884 | 235 | if ((ret = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, |
| 236 | ((PurpleBuddy*)node)->name, ((PurpleBuddy*)node)->account)) != NULL) | |
|
14450
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
237 | break; |
|
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
238 | } |
|
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
239 | return ret; |
|
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
240 | } |
|
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
241 | |
| 14612 | 242 | static char * |
| 15884 | 243 | get_conversation_title(PurpleConversation *conv, PurpleAccount *account) |
| 14612 | 244 | { |
| 15884 | 245 | return g_strdup_printf(_("%s (%s -- %s)"), purple_conversation_get_title(conv), |
| 246 | purple_account_get_username(account), purple_account_get_protocol_name(account)); | |
| 14612 | 247 | } |
| 248 | ||
| 249 | static void | |
| 15884 | 250 | update_buddy_typing(PurpleAccount *account, const char *who, gpointer null) |
| 14612 | 251 | { |
| 15884 | 252 | PurpleConversation *conv; |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15841
diff
changeset
|
253 | FinchConv *ggc; |
| 15884 | 254 | PurpleConvIm *im = NULL; |
|
15233
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14939
diff
changeset
|
255 | char *title, *str; |
| 14612 | 256 | |
| 15884 | 257 | conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, who, account); |
| 14612 | 258 | |
| 259 | if (!conv) | |
| 260 | return; | |
| 261 | ||
| 15884 | 262 | im = PURPLE_CONV_IM(conv); |
|
15233
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14939
diff
changeset
|
263 | ggc = conv->ui_data; |
|
14750
1dad59ae254d
[gaim-migrate @ 17440]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
14620
diff
changeset
|
264 | |
| 15884 | 265 | if (purple_conv_im_get_typing_state(im) == PURPLE_TYPING) { |
|
15233
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14939
diff
changeset
|
266 | int scroll; |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14939
diff
changeset
|
267 | str = get_conversation_title(conv, account); |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14939
diff
changeset
|
268 | title = g_strdup_printf(_("%s [%s]"), str, |
| 14612 | 269 | gnt_ascii_only() ? "T" : "\342\243\277"); |
|
15233
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14939
diff
changeset
|
270 | g_free(str); |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14939
diff
changeset
|
271 | |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14939
diff
changeset
|
272 | scroll = gnt_text_view_get_lines_below(GNT_TEXT_VIEW(ggc->tv)); |
| 15884 | 273 | str = g_strdup_printf(_("\n%s is typing..."), purple_conversation_get_name(conv)); |
|
15262
8f97f9047232
[gaim-migrate @ 17990]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15250
diff
changeset
|
274 | /* Updating is a little buggy. So just remove and add a new one */ |
|
8f97f9047232
[gaim-migrate @ 17990]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15250
diff
changeset
|
275 | gnt_text_view_tag_change(GNT_TEXT_VIEW(ggc->tv), "typing", NULL, TRUE); |
|
8f97f9047232
[gaim-migrate @ 17990]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15250
diff
changeset
|
276 | gnt_text_view_append_text_with_tag(GNT_TEXT_VIEW(ggc->tv), |
|
8f97f9047232
[gaim-migrate @ 17990]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15250
diff
changeset
|
277 | str, GNT_TEXT_FLAG_DIM, "typing"); |
|
15233
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14939
diff
changeset
|
278 | g_free(str); |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14939
diff
changeset
|
279 | if (scroll <= 1) |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14939
diff
changeset
|
280 | gnt_text_view_scroll(GNT_TEXT_VIEW(ggc->tv), 0); |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14939
diff
changeset
|
281 | } else { |
| 14612 | 282 | title = get_conversation_title(conv, account); |
|
18935
902fd1b53149
Just show an empty line, instead of bouncing the text down when the user
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18605
diff
changeset
|
283 | gnt_text_view_tag_change(GNT_TEXT_VIEW(ggc->tv), "typing", " ", TRUE); |
|
15233
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14939
diff
changeset
|
284 | } |
| 14612 | 285 | gnt_screen_rename_widget(ggc->window, title); |
| 286 | g_free(title); | |
| 287 | } | |
| 288 | ||
|
17076
9968d75058a4
Notify when you leave a chat, after /part or /kick.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17028
diff
changeset
|
289 | static void |
|
9968d75058a4
Notify when you leave a chat, after /part or /kick.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17028
diff
changeset
|
290 | chat_left_cb(PurpleConversation *conv, gpointer null) |
|
9968d75058a4
Notify when you leave a chat, after /part or /kick.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17028
diff
changeset
|
291 | { |
|
9968d75058a4
Notify when you leave a chat, after /part or /kick.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17028
diff
changeset
|
292 | finch_write_common(conv, NULL, _("You have left this chat."), |
|
9968d75058a4
Notify when you leave a chat, after /part or /kick.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17028
diff
changeset
|
293 | PURPLE_MESSAGE_SYSTEM, time(NULL)); |
|
9968d75058a4
Notify when you leave a chat, after /part or /kick.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17028
diff
changeset
|
294 | } |
|
9968d75058a4
Notify when you leave a chat, after /part or /kick.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17028
diff
changeset
|
295 | |
|
19449
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
296 | static void |
|
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
297 | buddy_signed_on_off(PurpleBuddy *buddy, gpointer null) |
|
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
298 | { |
|
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
299 | PurpleConversation *conv = find_conv_with_contact(buddy->account, buddy->name); |
|
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
300 | if (conv == NULL) |
|
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
301 | return; |
|
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
302 | generate_send_to_menu(conv->ui_data); |
|
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
303 | } |
|
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
304 | |
|
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
305 | static void |
|
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
306 | account_signed_on_off(PurpleConnection *gc, gpointer null) |
|
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
307 | { |
|
20315
21fbfe31160a
If there's a chat open when an account gets disconnected because of an error,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19986
diff
changeset
|
308 | GList *list = purple_get_ims(); |
|
21fbfe31160a
If there's a chat open when an account gets disconnected because of an error,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19986
diff
changeset
|
309 | while (list) { |
|
21fbfe31160a
If there's a chat open when an account gets disconnected because of an error,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19986
diff
changeset
|
310 | PurpleConversation *conv = list->data; |
|
19449
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
311 | PurpleConversation *cc = find_conv_with_contact(conv->account, conv->name); |
|
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
312 | if (cc) |
|
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
313 | generate_send_to_menu(cc->ui_data); |
|
20315
21fbfe31160a
If there's a chat open when an account gets disconnected because of an error,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19986
diff
changeset
|
314 | list = list->next; |
|
21fbfe31160a
If there's a chat open when an account gets disconnected because of an error,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19986
diff
changeset
|
315 | } |
|
21fbfe31160a
If there's a chat open when an account gets disconnected because of an error,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19986
diff
changeset
|
316 | |
|
21fbfe31160a
If there's a chat open when an account gets disconnected because of an error,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19986
diff
changeset
|
317 | if (PURPLE_CONNECTION_IS_CONNECTED(gc)) { |
|
21fbfe31160a
If there's a chat open when an account gets disconnected because of an error,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19986
diff
changeset
|
318 | /* We just signed on. Let's see if there's any chat that we have open, |
|
21fbfe31160a
If there's a chat open when an account gets disconnected because of an error,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19986
diff
changeset
|
319 | * and hadn't left before the disconnect. */ |
|
21fbfe31160a
If there's a chat open when an account gets disconnected because of an error,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19986
diff
changeset
|
320 | list = purple_get_chats(); |
|
21fbfe31160a
If there's a chat open when an account gets disconnected because of an error,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19986
diff
changeset
|
321 | while (list) { |
|
21fbfe31160a
If there's a chat open when an account gets disconnected because of an error,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19986
diff
changeset
|
322 | PurpleConversation *conv = list->data; |
|
21fbfe31160a
If there's a chat open when an account gets disconnected because of an error,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19986
diff
changeset
|
323 | PurpleChat *chat; |
|
20622
30e148be3e2c
Fix #104 (Reconnect to network should reconnect chats also). This has been
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20330
diff
changeset
|
324 | GHashTable *comps = NULL; |
|
20315
21fbfe31160a
If there's a chat open when an account gets disconnected because of an error,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19986
diff
changeset
|
325 | |
|
21fbfe31160a
If there's a chat open when an account gets disconnected because of an error,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19986
diff
changeset
|
326 | list = list->next; |
|
21fbfe31160a
If there's a chat open when an account gets disconnected because of an error,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19986
diff
changeset
|
327 | if (conv->account != gc->account || |
|
21fbfe31160a
If there's a chat open when an account gets disconnected because of an error,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19986
diff
changeset
|
328 | !purple_conversation_get_data(conv, "want-to-rejoin")) |
|
21fbfe31160a
If there's a chat open when an account gets disconnected because of an error,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19986
diff
changeset
|
329 | continue; |
|
21fbfe31160a
If there's a chat open when an account gets disconnected because of an error,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19986
diff
changeset
|
330 | |
|
21fbfe31160a
If there's a chat open when an account gets disconnected because of an error,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19986
diff
changeset
|
331 | chat = purple_blist_find_chat(conv->account, conv->name); |
|
21fbfe31160a
If there's a chat open when an account gets disconnected because of an error,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19986
diff
changeset
|
332 | if (chat == NULL) { |
|
21fbfe31160a
If there's a chat open when an account gets disconnected because of an error,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19986
diff
changeset
|
333 | if (PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info_defaults != NULL) |
|
20622
30e148be3e2c
Fix #104 (Reconnect to network should reconnect chats also). This has been
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20330
diff
changeset
|
334 | comps = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info_defaults(gc, conv->name); |
|
30e148be3e2c
Fix #104 (Reconnect to network should reconnect chats also). This has been
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20330
diff
changeset
|
335 | } else { |
|
30e148be3e2c
Fix #104 (Reconnect to network should reconnect chats also). This has been
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20330
diff
changeset
|
336 | comps = chat->components; |
|
20315
21fbfe31160a
If there's a chat open when an account gets disconnected because of an error,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19986
diff
changeset
|
337 | } |
|
20622
30e148be3e2c
Fix #104 (Reconnect to network should reconnect chats also). This has been
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20330
diff
changeset
|
338 | serv_join_chat(gc, comps); |
|
30e148be3e2c
Fix #104 (Reconnect to network should reconnect chats also). This has been
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20330
diff
changeset
|
339 | if (chat == NULL && comps != NULL) |
|
30e148be3e2c
Fix #104 (Reconnect to network should reconnect chats also). This has been
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20330
diff
changeset
|
340 | g_hash_table_destroy(comps); |
|
20315
21fbfe31160a
If there's a chat open when an account gets disconnected because of an error,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19986
diff
changeset
|
341 | } |
|
19449
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
342 | } |
|
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
343 | } |
|
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
344 | |
| 14612 | 345 | static gpointer |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15841
diff
changeset
|
346 | finch_conv_get_handle() |
| 14612 | 347 | { |
| 348 | static int handle; | |
| 349 | return &handle; | |
| 350 | } | |
| 351 | ||
|
14072
4e64a4f18686
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14070
diff
changeset
|
352 | static void |
| 16948 | 353 | clear_scrollback_cb(GntMenuItem *item, gpointer ggconv) |
| 354 | { | |
| 355 | FinchConv *ggc = ggconv; | |
| 356 | gnt_text_view_clear(GNT_TEXT_VIEW(ggc->tv)); | |
| 357 | } | |
| 358 | ||
| 359 | static void | |
| 360 | send_file_cb(GntMenuItem *item, gpointer ggconv) | |
| 361 | { | |
| 362 | FinchConv *ggc = ggconv; | |
| 363 | serv_send_file(purple_conversation_get_gc(ggc->active_conv), | |
| 364 | purple_conversation_get_name(ggc->active_conv), NULL); | |
| 365 | } | |
| 366 | ||
| 367 | static void | |
| 368 | add_pounce_cb(GntMenuItem *item, gpointer ggconv) | |
| 369 | { | |
| 370 | FinchConv *ggc = ggconv; | |
| 371 | finch_pounce_editor_show( | |
| 372 | purple_conversation_get_account(ggc->active_conv), | |
| 373 | purple_conversation_get_name(ggc->active_conv), NULL); | |
| 374 | } | |
| 375 | ||
| 376 | static void | |
| 377 | get_info_cb(GntMenuItem *item, gpointer ggconv) | |
| 378 | { | |
| 379 | FinchConv *ggc = ggconv; | |
|
17360
4b04b2ee459a
Use utility functions to get user info. Closes #964.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17164
diff
changeset
|
380 | finch_retrieve_user_info(purple_conversation_get_gc(ggc->active_conv), |
| 16948 | 381 | purple_conversation_get_name(ggc->active_conv)); |
| 382 | } | |
| 383 | ||
| 384 | static void | |
| 385 | toggle_timestamps_cb(GntMenuItem *item, gpointer ggconv) | |
| 386 | { | |
| 387 | purple_prefs_set_bool(PREF_ROOT "/timestamps", | |
| 388 | !purple_prefs_get_bool(PREF_ROOT "/timestamps")); | |
| 389 | } | |
| 390 | ||
| 391 | static void | |
|
19610
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
392 | toggle_logging_cb(GntMenuItem *item, gpointer ggconv) |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
393 | { |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
394 | FinchConv *fc = ggconv; |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
395 | PurpleConversation *conv = fc->active_conv; |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
396 | gboolean logging = gnt_menuitem_check_get_checked(GNT_MENU_ITEM_CHECK(item)); |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
397 | GList *iter; |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
398 | |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
399 | if (logging == purple_conversation_is_logging(conv)) |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
400 | return; |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
401 | |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
402 | /* Xerox */ |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
403 | if (logging) { |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
404 | /* Enable logging first so the message below can be logged. */ |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
405 | purple_conversation_set_logging(conv, TRUE); |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
406 | |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
407 | purple_conversation_write(conv, NULL, |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
408 | _("Logging started. Future messages in this conversation will be logged."), |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
409 | conv->logs ? (PURPLE_MESSAGE_SYSTEM) : |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
410 | (PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LOG), |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
411 | time(NULL)); |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
412 | } else { |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
413 | purple_conversation_write(conv, NULL, |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
414 | _("Logging stopped. Future messages in this conversation will not be logged."), |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
415 | conv->logs ? (PURPLE_MESSAGE_SYSTEM) : |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
416 | (PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LOG), |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
417 | time(NULL)); |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
418 | |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
419 | /* Disable the logging second, so that the above message can be logged. */ |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
420 | purple_conversation_set_logging(conv, FALSE); |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
421 | } |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
422 | |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
423 | /* Each conversation with the same person will have the same logging setting */ |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
424 | for (iter = fc->list; iter; iter = iter->next) { |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
425 | if (iter->data == conv) |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
426 | continue; |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
427 | purple_conversation_set_logging(iter->data, logging); |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
428 | } |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
429 | } |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
430 | |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
431 | static void |
|
19612
043dcbf3a36e
Fix #2767 (per-conversation/chat mute option).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19611
diff
changeset
|
432 | toggle_sound_cb(GntMenuItem *item, gpointer ggconv) |
|
043dcbf3a36e
Fix #2767 (per-conversation/chat mute option).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19611
diff
changeset
|
433 | { |
|
043dcbf3a36e
Fix #2767 (per-conversation/chat mute option).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19611
diff
changeset
|
434 | FinchConv *fc = ggconv; |
|
19986
7c725191167c
Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
435 | PurpleBlistNode *node = get_conversation_blist_node(fc->active_conv); |
|
19612
043dcbf3a36e
Fix #2767 (per-conversation/chat mute option).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19611
diff
changeset
|
436 | fc->flags ^= FINCH_CONV_NO_SOUND; |
|
19986
7c725191167c
Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
437 | if (node) |
|
7c725191167c
Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
438 | purple_blist_node_set_bool(node, "gnt-mute-sound", !!(fc->flags & FINCH_CONV_NO_SOUND)); |
|
19612
043dcbf3a36e
Fix #2767 (per-conversation/chat mute option).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19611
diff
changeset
|
439 | } |
|
043dcbf3a36e
Fix #2767 (per-conversation/chat mute option).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19611
diff
changeset
|
440 | |
|
043dcbf3a36e
Fix #2767 (per-conversation/chat mute option).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19611
diff
changeset
|
441 | static void |
| 16948 | 442 | send_to_cb(GntMenuItem *m, gpointer n) |
| 443 | { | |
| 444 | PurpleAccount *account = g_object_get_data(G_OBJECT(m), "purple_account"); | |
| 445 | gchar *buddy = g_object_get_data(G_OBJECT(m), "purple_buddy_name"); | |
| 446 | PurpleConversation *conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, buddy); | |
| 447 | finch_conversation_set_active(conv); | |
| 448 | } | |
| 449 | ||
| 450 | static void | |
| 451 | generate_send_to_menu(FinchConv *ggc) | |
| 452 | { | |
| 453 | GntWidget *sub, *menu = ggc->menu; | |
| 454 | GntMenuItem *item; | |
| 455 | GSList *buds; | |
| 456 | GList *list = NULL; | |
| 457 | ||
| 458 | buds = purple_find_buddies(ggc->active_conv->account, ggc->active_conv->name); | |
| 459 | if (!buds) | |
| 460 | return; | |
| 461 | ||
|
19449
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
462 | if ((item = ggc->u.im->sendto) == NULL) { |
|
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
463 | item = gnt_menuitem_new(_("Send To")); |
|
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
464 | gnt_menu_add_item(GNT_MENU(menu), item); |
|
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
465 | ggc->u.im->sendto = item; |
|
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
466 | } |
| 16948 | 467 | sub = gnt_menu_new(GNT_MENU_POPUP); |
| 468 | gnt_menuitem_set_submenu(item, GNT_MENU(sub)); | |
| 469 | ||
|
19449
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
470 | for (; buds; buds = g_slist_delete_link(buds, buds)) { |
| 16948 | 471 | PurpleBlistNode *node = (PurpleBlistNode *)purple_buddy_get_contact((PurpleBuddy *)buds->data); |
| 472 | for (node = node->child; node != NULL; node = node->next) { | |
| 473 | PurpleBuddy *buddy = (PurpleBuddy *)node; | |
| 474 | PurpleAccount *account = purple_buddy_get_account(buddy); | |
| 475 | if (purple_account_is_connected(account)) { | |
| 476 | /* Use the PurplePresence to get unique buddies. */ | |
| 477 | PurplePresence *presence = purple_buddy_get_presence(buddy); | |
| 478 | if (!g_list_find(list, presence)) | |
| 479 | list = g_list_prepend(list, presence); | |
| 480 | } | |
| 481 | } | |
| 482 | } | |
|
19449
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
483 | for (list = g_list_reverse(list); list != NULL; list = g_list_delete_link(list, list)) { |
| 16948 | 484 | PurplePresence *pre = list->data; |
|
16949
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
485 | PurpleBuddy *buddy = purple_presence_get_buddy(pre); |
| 16948 | 486 | PurpleAccount *account = purple_buddy_get_account(buddy); |
| 487 | gchar *name = g_strdup(purple_buddy_get_name(buddy)); | |
| 488 | gchar *text = g_strdup_printf("%s (%s)", purple_buddy_get_name(buddy), purple_account_get_username(account)); | |
| 489 | item = gnt_menuitem_new(text); | |
| 490 | g_free(text); | |
| 491 | gnt_menu_add_item(GNT_MENU(sub), item); | |
| 492 | gnt_menuitem_set_callback(item, send_to_cb, NULL); | |
| 493 | g_object_set_data(G_OBJECT(item), "purple_account", account); | |
| 494 | g_object_set_data_full(G_OBJECT(item), "purple_buddy_name", name, g_free); | |
| 495 | } | |
| 496 | } | |
| 497 | ||
| 498 | static void | |
| 499 | gg_create_menu(FinchConv *ggc) | |
| 500 | { | |
| 501 | GntWidget *menu, *sub; | |
| 502 | GntMenuItem *item; | |
| 503 | ||
| 504 | ggc->menu = menu = gnt_menu_new(GNT_MENU_TOPLEVEL); | |
| 505 | gnt_window_set_menu(GNT_WINDOW(ggc->window), GNT_MENU(menu)); | |
| 506 | ||
| 507 | item = gnt_menuitem_new(_("Conversation")); | |
| 508 | gnt_menu_add_item(GNT_MENU(menu), item); | |
| 509 | ||
| 510 | sub = gnt_menu_new(GNT_MENU_POPUP); | |
| 511 | gnt_menuitem_set_submenu(item, GNT_MENU(sub)); | |
| 512 | ||
| 513 | item = gnt_menuitem_new(_("Clear Scrollback")); | |
| 514 | gnt_menu_add_item(GNT_MENU(sub), item); | |
| 515 | gnt_menuitem_set_callback(item, clear_scrollback_cb, ggc); | |
| 516 | ||
| 517 | item = gnt_menuitem_check_new(_("Show Timestamps")); | |
| 518 | gnt_menuitem_check_set_checked(GNT_MENU_ITEM_CHECK(item), | |
| 519 | purple_prefs_get_bool(PREF_ROOT "/timestamps")); | |
| 520 | gnt_menu_add_item(GNT_MENU(sub), item); | |
| 521 | gnt_menuitem_set_callback(item, toggle_timestamps_cb, ggc); | |
| 522 | ||
| 523 | if (purple_conversation_get_type(ggc->active_conv) == PURPLE_CONV_TYPE_IM) { | |
|
17018
18b76ac05780
Change a string, and make sure non-functional items are not added in the conversation window menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16986
diff
changeset
|
524 | PurpleAccount *account = purple_conversation_get_account(ggc->active_conv); |
|
18b76ac05780
Change a string, and make sure non-functional items are not added in the conversation window menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16986
diff
changeset
|
525 | PurplePluginProtocolInfo *pinfo = account->gc ? PURPLE_PLUGIN_PROTOCOL_INFO(account->gc->prpl) : NULL; |
|
18b76ac05780
Change a string, and make sure non-functional items are not added in the conversation window menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16986
diff
changeset
|
526 | |
|
18b76ac05780
Change a string, and make sure non-functional items are not added in the conversation window menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16986
diff
changeset
|
527 | if (pinfo && pinfo->get_info) { |
|
18b76ac05780
Change a string, and make sure non-functional items are not added in the conversation window menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16986
diff
changeset
|
528 | item = gnt_menuitem_new(_("Get Info")); |
|
18b76ac05780
Change a string, and make sure non-functional items are not added in the conversation window menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16986
diff
changeset
|
529 | gnt_menu_add_item(GNT_MENU(sub), item); |
|
18b76ac05780
Change a string, and make sure non-functional items are not added in the conversation window menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16986
diff
changeset
|
530 | gnt_menuitem_set_callback(item, get_info_cb, ggc); |
|
18b76ac05780
Change a string, and make sure non-functional items are not added in the conversation window menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16986
diff
changeset
|
531 | } |
| 16948 | 532 | |
| 533 | item = gnt_menuitem_new(_("Add Buddy Pounce...")); | |
| 534 | gnt_menu_add_item(GNT_MENU(sub), item); | |
| 535 | gnt_menuitem_set_callback(item, add_pounce_cb, ggc); | |
| 536 | ||
|
17018
18b76ac05780
Change a string, and make sure non-functional items are not added in the conversation window menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16986
diff
changeset
|
537 | if (pinfo && pinfo->send_file && |
|
18b76ac05780
Change a string, and make sure non-functional items are not added in the conversation window menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16986
diff
changeset
|
538 | (!pinfo->can_receive_file || |
|
18b76ac05780
Change a string, and make sure non-functional items are not added in the conversation window menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16986
diff
changeset
|
539 | pinfo->can_receive_file(account->gc, purple_conversation_get_name(ggc->active_conv)))) { |
|
18b76ac05780
Change a string, and make sure non-functional items are not added in the conversation window menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16986
diff
changeset
|
540 | item = gnt_menuitem_new(_("Send File")); |
|
18b76ac05780
Change a string, and make sure non-functional items are not added in the conversation window menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16986
diff
changeset
|
541 | gnt_menu_add_item(GNT_MENU(sub), item); |
|
18b76ac05780
Change a string, and make sure non-functional items are not added in the conversation window menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16986
diff
changeset
|
542 | gnt_menuitem_set_callback(item, send_file_cb, ggc); |
|
18b76ac05780
Change a string, and make sure non-functional items are not added in the conversation window menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16986
diff
changeset
|
543 | } |
| 16948 | 544 | |
| 545 | generate_send_to_menu(ggc); | |
| 546 | } | |
|
19610
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
547 | |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
548 | item = gnt_menuitem_check_new(_("Enable Logging")); |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
549 | gnt_menuitem_check_set_checked(GNT_MENU_ITEM_CHECK(item), |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
550 | purple_conversation_is_logging(ggc->active_conv)); |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
551 | gnt_menu_add_item(GNT_MENU(sub), item); |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
552 | gnt_menuitem_set_callback(item, toggle_logging_cb, ggc); |
|
19612
043dcbf3a36e
Fix #2767 (per-conversation/chat mute option).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19611
diff
changeset
|
553 | |
|
043dcbf3a36e
Fix #2767 (per-conversation/chat mute option).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19611
diff
changeset
|
554 | item = gnt_menuitem_check_new(_("Enable Sounds")); |
|
043dcbf3a36e
Fix #2767 (per-conversation/chat mute option).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19611
diff
changeset
|
555 | gnt_menuitem_check_set_checked(GNT_MENU_ITEM_CHECK(item), |
|
043dcbf3a36e
Fix #2767 (per-conversation/chat mute option).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19611
diff
changeset
|
556 | !(ggc->flags & FINCH_CONV_NO_SOUND)); |
|
043dcbf3a36e
Fix #2767 (per-conversation/chat mute option).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19611
diff
changeset
|
557 | gnt_menu_add_item(GNT_MENU(sub), item); |
|
043dcbf3a36e
Fix #2767 (per-conversation/chat mute option).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19611
diff
changeset
|
558 | gnt_menuitem_set_callback(item, toggle_sound_cb, ggc); |
| 16948 | 559 | } |
| 560 | ||
| 561 | static void | |
|
16949
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
562 | create_conv_from_userlist(GntWidget *widget, FinchConv *fc) |
|
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
563 | { |
|
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
564 | PurpleAccount *account = purple_conversation_get_account(fc->active_conv); |
|
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
565 | char *name = gnt_tree_get_selection_data(GNT_TREE(widget)); |
|
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
566 | purple_conversation_new(PURPLE_CONV_TYPE_IM, account, name); |
|
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
567 | } |
|
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
568 | |
|
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
569 | static void |
|
18173
2e65bc9fa310
Provide a 'unseen-count' data for the conversations so the dbus-docklet can use that information.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17854
diff
changeset
|
570 | gained_focus_cb(GntWindow *window, FinchConv *fc) |
|
2e65bc9fa310
Provide a 'unseen-count' data for the conversations so the dbus-docklet can use that information.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17854
diff
changeset
|
571 | { |
|
2e65bc9fa310
Provide a 'unseen-count' data for the conversations so the dbus-docklet can use that information.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17854
diff
changeset
|
572 | GList *iter; |
|
2e65bc9fa310
Provide a 'unseen-count' data for the conversations so the dbus-docklet can use that information.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17854
diff
changeset
|
573 | for (iter = fc->list; iter; iter = iter->next) { |
|
2e65bc9fa310
Provide a 'unseen-count' data for the conversations so the dbus-docklet can use that information.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17854
diff
changeset
|
574 | purple_conversation_set_data(iter->data, "unseen-count", 0); |
|
2e65bc9fa310
Provide a 'unseen-count' data for the conversations so the dbus-docklet can use that information.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17854
diff
changeset
|
575 | purple_conversation_update(iter->data, PURPLE_CONV_UPDATE_UNSEEN); |
|
2e65bc9fa310
Provide a 'unseen-count' data for the conversations so the dbus-docklet can use that information.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17854
diff
changeset
|
576 | } |
|
2e65bc9fa310
Provide a 'unseen-count' data for the conversations so the dbus-docklet can use that information.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17854
diff
changeset
|
577 | } |
|
2e65bc9fa310
Provide a 'unseen-count' data for the conversations so the dbus-docklet can use that information.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17854
diff
changeset
|
578 | |
|
2e65bc9fa310
Provide a 'unseen-count' data for the conversations so the dbus-docklet can use that information.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17854
diff
changeset
|
579 | static void |
|
18423
83cabde8668d
Use the completion-signal to append a ': ' after a tab-completed nick.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18305
diff
changeset
|
580 | completion_cb(GntEntry *entry, const char *start, const char *end) |
|
83cabde8668d
Use the completion-signal to append a ': ' after a tab-completed nick.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18305
diff
changeset
|
581 | { |
|
83cabde8668d
Use the completion-signal to append a ': ' after a tab-completed nick.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18305
diff
changeset
|
582 | if (start == entry->start) |
|
83cabde8668d
Use the completion-signal to append a ': ' after a tab-completed nick.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18305
diff
changeset
|
583 | gnt_widget_key_pressed(GNT_WIDGET(entry), ": "); |
|
83cabde8668d
Use the completion-signal to append a ': ' after a tab-completed nick.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18305
diff
changeset
|
584 | } |
|
83cabde8668d
Use the completion-signal to append a ': ' after a tab-completed nick.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18305
diff
changeset
|
585 | |
|
83cabde8668d
Use the completion-signal to append a ': ' after a tab-completed nick.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18305
diff
changeset
|
586 | static void |
| 15884 | 587 | finch_create_conversation(PurpleConversation *conv) |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
588 | { |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15841
diff
changeset
|
589 | FinchConv *ggc = conv->ui_data; |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
590 | char *title; |
| 15884 | 591 | PurpleConversationType type; |
| 592 | PurpleConversation *cc; | |
| 593 | PurpleAccount *account; | |
|
19986
7c725191167c
Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
594 | PurpleBlistNode *convnode = NULL; |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
595 | |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
596 | if (ggc) |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
597 | return; |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
598 | |
|
19449
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
599 | cc = find_conv_with_contact(conv->account, conv->name); |
|
14450
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
600 | if (cc && cc->ui_data) |
|
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
601 | ggc = cc->ui_data; |
|
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
602 | else |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15841
diff
changeset
|
603 | ggc = g_new0(FinchConv, 1); |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
604 | |
|
19610
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
605 | /* Each conversation with the same person will have the same logging setting */ |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
606 | if (ggc->list) { |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
607 | purple_conversation_set_logging(conv, |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
608 | purple_conversation_is_logging(ggc->list->data)); |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
609 | } |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
610 | |
|
14450
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
611 | ggc->list = g_list_prepend(ggc->list, conv); |
|
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
612 | ggc->active_conv = conv; |
|
14047
764a70ebfdc5
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14033
diff
changeset
|
613 | conv->ui_data = ggc; |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
614 | |
|
14450
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
615 | if (cc && cc->ui_data) { |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15841
diff
changeset
|
616 | finch_conversation_set_active(conv); |
|
14450
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
617 | return; |
|
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
618 | } |
|
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
619 | |
| 15884 | 620 | account = purple_conversation_get_account(conv); |
| 621 | type = purple_conversation_get_type(conv); | |
| 14612 | 622 | title = get_conversation_title(conv, account); |
| 623 | ||
| 16948 | 624 | ggc->window = gnt_vwindow_new(FALSE); |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
625 | gnt_box_set_title(GNT_BOX(ggc->window), title); |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
626 | gnt_box_set_toplevel(GNT_BOX(ggc->window), TRUE); |
|
13978
70d7030b7f26
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13969
diff
changeset
|
627 | gnt_box_set_pad(GNT_BOX(ggc->window), 0); |
|
18305
7301814a6124
Plucked revision from finchfeat to give different names to windows for
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18301
diff
changeset
|
628 | |
|
7301814a6124
Plucked revision from finchfeat to give different names to windows for
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18301
diff
changeset
|
629 | switch(conv->type){ |
|
7301814a6124
Plucked revision from finchfeat to give different names to windows for
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18301
diff
changeset
|
630 | case PURPLE_CONV_TYPE_UNKNOWN: |
|
7301814a6124
Plucked revision from finchfeat to give different names to windows for
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18301
diff
changeset
|
631 | gnt_widget_set_name(ggc->window, "conversation-window-unknown" ); |
|
7301814a6124
Plucked revision from finchfeat to give different names to windows for
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18301
diff
changeset
|
632 | break; |
|
7301814a6124
Plucked revision from finchfeat to give different names to windows for
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18301
diff
changeset
|
633 | case PURPLE_CONV_TYPE_IM: |
|
7301814a6124
Plucked revision from finchfeat to give different names to windows for
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18301
diff
changeset
|
634 | gnt_widget_set_name(ggc->window, "conversation-window-im" ); |
|
7301814a6124
Plucked revision from finchfeat to give different names to windows for
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18301
diff
changeset
|
635 | break; |
|
7301814a6124
Plucked revision from finchfeat to give different names to windows for
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18301
diff
changeset
|
636 | case PURPLE_CONV_TYPE_CHAT: |
|
7301814a6124
Plucked revision from finchfeat to give different names to windows for
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18301
diff
changeset
|
637 | gnt_widget_set_name(ggc->window, "conversation-window-chat" ); |
|
7301814a6124
Plucked revision from finchfeat to give different names to windows for
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18301
diff
changeset
|
638 | break; |
|
7301814a6124
Plucked revision from finchfeat to give different names to windows for
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18301
diff
changeset
|
639 | case PURPLE_CONV_TYPE_MISC: |
|
7301814a6124
Plucked revision from finchfeat to give different names to windows for
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18301
diff
changeset
|
640 | gnt_widget_set_name(ggc->window, "conversation-window-misc" ); |
|
7301814a6124
Plucked revision from finchfeat to give different names to windows for
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18301
diff
changeset
|
641 | break; |
|
7301814a6124
Plucked revision from finchfeat to give different names to windows for
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18301
diff
changeset
|
642 | case PURPLE_CONV_TYPE_ANY: |
|
7301814a6124
Plucked revision from finchfeat to give different names to windows for
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18301
diff
changeset
|
643 | gnt_widget_set_name(ggc->window, "conversation-window-any" ); |
|
7301814a6124
Plucked revision from finchfeat to give different names to windows for
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18301
diff
changeset
|
644 | break; |
|
7301814a6124
Plucked revision from finchfeat to give different names to windows for
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18301
diff
changeset
|
645 | } |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
646 | |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
647 | ggc->tv = gnt_text_view_new(); |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
648 | gnt_widget_set_name(ggc->tv, "conversation-window-textview"); |
| 15884 | 649 | gnt_widget_set_size(ggc->tv, purple_prefs_get_int(PREF_ROOT "/size/width"), |
| 650 | purple_prefs_get_int(PREF_ROOT "/size/height")); | |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
651 | |
|
16949
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
652 | if (type == PURPLE_CONV_TYPE_CHAT) { |
|
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
653 | GntWidget *hbox, *tree; |
|
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
654 | FinchConvChat *fc = ggc->u.chat = g_new0(FinchConvChat, 1); |
|
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
655 | hbox = gnt_hbox_new(FALSE); |
|
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
656 | gnt_box_set_pad(GNT_BOX(hbox), 0); |
|
17115
7295bc64f5fa
Show user flags in chat userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17076
diff
changeset
|
657 | tree = fc->userlist = gnt_tree_new_with_columns(2); |
|
7295bc64f5fa
Show user flags in chat userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17076
diff
changeset
|
658 | gnt_tree_set_col_width(GNT_TREE(tree), 0, 1); /* The flag column */ |
|
16949
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
659 | gnt_tree_set_compare_func(GNT_TREE(tree), (GCompareFunc)g_utf8_collate); |
|
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
660 | gnt_tree_set_hash_fns(GNT_TREE(tree), g_str_hash, g_str_equal, g_free); |
|
19798
73b881a6c1f9
Use the proper column for searching users in the chat userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19672
diff
changeset
|
661 | gnt_tree_set_search_column(GNT_TREE(tree), 1); |
|
16949
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
662 | GNT_WIDGET_SET_FLAGS(tree, GNT_WIDGET_NO_BORDER); |
|
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
663 | gnt_box_add_widget(GNT_BOX(hbox), ggc->tv); |
|
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
664 | gnt_box_add_widget(GNT_BOX(hbox), tree); |
|
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
665 | gnt_box_add_widget(GNT_BOX(ggc->window), hbox); |
|
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
666 | g_signal_connect(G_OBJECT(tree), "activate", G_CALLBACK(create_conv_from_userlist), ggc); |
|
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
667 | gnt_widget_set_visible(tree, purple_prefs_get_bool(PREF_USERLIST)); |
|
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
668 | } else { |
|
19449
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
669 | ggc->u.im = g_new0(FinchConvIm, 1); |
|
16949
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
670 | gnt_box_add_widget(GNT_BOX(ggc->window), ggc->tv); |
|
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
671 | } |
|
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
672 | |
|
16190
435e34f11655
Allow adding information widgets in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16186
diff
changeset
|
673 | ggc->info = gnt_vbox_new(FALSE); |
|
435e34f11655
Allow adding information widgets in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16186
diff
changeset
|
674 | gnt_box_add_widget(GNT_BOX(ggc->window), ggc->info); |
|
435e34f11655
Allow adding information widgets in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16186
diff
changeset
|
675 | |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
676 | ggc->entry = gnt_entry_new(NULL); |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
677 | gnt_box_add_widget(GNT_BOX(ggc->window), ggc->entry); |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
678 | gnt_widget_set_name(ggc->entry, "conversation-window-entry"); |
|
14153
9da98052a4e1
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14122
diff
changeset
|
679 | gnt_entry_set_history_length(GNT_ENTRY(ggc->entry), -1); |
|
9da98052a4e1
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14122
diff
changeset
|
680 | gnt_entry_set_word_suggest(GNT_ENTRY(ggc->entry), TRUE); |
|
9da98052a4e1
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14122
diff
changeset
|
681 | gnt_entry_set_always_suggest(GNT_ENTRY(ggc->entry), FALSE); |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
682 | |
|
16186
73cb5b43aaf9
Add a utility function to assist scrolling in a textview.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15931
diff
changeset
|
683 | gnt_text_view_attach_scroll_widget(GNT_TEXT_VIEW(ggc->tv), ggc->entry); |
|
18605
76230f659c3f
Use the utility function for the conversation and debug windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18423
diff
changeset
|
684 | gnt_text_view_attach_pager_widget(GNT_TEXT_VIEW(ggc->tv), ggc->entry); |
|
76230f659c3f
Use the utility function for the conversation and debug windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18423
diff
changeset
|
685 | |
|
21271
2b594093a1ca
I feel good when I am able to send messages, instead of just typing them.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20791
diff
changeset
|
686 | g_signal_connect_after(G_OBJECT(ggc->entry), "activate", G_CALLBACK(entry_key_pressed), ggc); |
|
18423
83cabde8668d
Use the completion-signal to append a ': ' after a tab-completed nick.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18305
diff
changeset
|
687 | g_signal_connect(G_OBJECT(ggc->entry), "completion", G_CALLBACK(completion_cb), NULL); |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
688 | g_signal_connect(G_OBJECT(ggc->window), "destroy", G_CALLBACK(closing_window), ggc); |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
689 | |
| 15884 | 690 | gnt_widget_set_position(ggc->window, purple_prefs_get_int(PREF_ROOT "/position/x"), |
| 691 | purple_prefs_get_int(PREF_ROOT "/position/y")); | |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
692 | gnt_widget_show(ggc->window); |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
693 | |
|
14072
4e64a4f18686
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14070
diff
changeset
|
694 | g_signal_connect(G_OBJECT(ggc->tv), "size_changed", G_CALLBACK(size_changed_cb), NULL); |
|
4e64a4f18686
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14070
diff
changeset
|
695 | g_signal_connect(G_OBJECT(ggc->window), "position_set", G_CALLBACK(save_position_cb), NULL); |
|
4e64a4f18686
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14070
diff
changeset
|
696 | |
| 15884 | 697 | if (type == PURPLE_CONV_TYPE_IM) { |
|
15841
f2c4347c1597
Typing notifications are relevant only for IMs.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15821
diff
changeset
|
698 | g_signal_connect(G_OBJECT(ggc->entry), "text_changed", G_CALLBACK(send_typing_notification), ggc); |
|
f2c4347c1597
Typing notifications are relevant only for IMs.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15821
diff
changeset
|
699 | } |
| 14612 | 700 | |
|
19986
7c725191167c
Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
701 | convnode = get_conversation_blist_node(conv); |
|
7c725191167c
Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
702 | if ((convnode && purple_blist_node_get_bool(convnode, "gnt-mute-sound")) || |
|
7c725191167c
Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
703 | !finch_sound_is_enabled()) |
|
19612
043dcbf3a36e
Fix #2767 (per-conversation/chat mute option).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19611
diff
changeset
|
704 | ggc->flags |= FINCH_CONV_NO_SOUND; |
|
043dcbf3a36e
Fix #2767 (per-conversation/chat mute option).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19611
diff
changeset
|
705 | |
|
19449
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
706 | gg_create_menu(ggc); |
|
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
707 | |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
708 | g_free(title); |
|
16949
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
709 | gnt_box_give_focus_to_child(GNT_BOX(ggc->window), ggc->entry); |
|
18173
2e65bc9fa310
Provide a 'unseen-count' data for the conversations so the dbus-docklet can use that information.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17854
diff
changeset
|
710 | g_signal_connect(G_OBJECT(ggc->window), "gained-focus", G_CALLBACK(gained_focus_cb), ggc); |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
711 | } |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
712 | |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
713 | static void |
| 15884 | 714 | finch_destroy_conversation(PurpleConversation *conv) |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
715 | { |
|
14450
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
716 | /* do stuff here */ |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15841
diff
changeset
|
717 | FinchConv *ggc = conv->ui_data; |
|
14450
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
718 | ggc->list = g_list_remove(ggc->list, conv); |
|
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
719 | if (ggc->list && conv == ggc->active_conv) |
|
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
720 | ggc->active_conv = ggc->list->data; |
|
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
721 | |
|
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
722 | if (ggc->list == NULL) { |
|
16949
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
723 | g_free(ggc->u.chat); |
|
18301
1988607deed3
Fix a few runtime warnings.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18273
diff
changeset
|
724 | if (ggc->window) |
|
1988607deed3
Fix a few runtime warnings.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18273
diff
changeset
|
725 | gnt_widget_destroy(ggc->window); |
|
14450
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
726 | g_free(ggc); |
|
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
727 | } |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
728 | } |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
729 | |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
730 | static void |
| 15884 | 731 | finch_write_common(PurpleConversation *conv, const char *who, const char *message, |
| 732 | PurpleMessageFlags flags, time_t mtime) | |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
733 | { |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15841
diff
changeset
|
734 | FinchConv *ggconv = conv->ui_data; |
|
14073
db4207d73bd7
[gaim-migrate @ 16603]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14072
diff
changeset
|
735 | char *strip, *newline; |
|
13993
8c12e7d15b40
[gaim-migrate @ 16458]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13989
diff
changeset
|
736 | GntTextFormatFlags fl = 0; |
|
14092
191e12cbe464
[gaim-migrate @ 16632]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
737 | int pos; |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
738 | |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
739 | g_return_if_fail(ggconv != NULL); |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
740 | |
|
14450
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
741 | if (ggconv->active_conv != conv) { |
| 15884 | 742 | if (flags & (PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_RECV)) |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15841
diff
changeset
|
743 | finch_conversation_set_active(conv); |
|
14450
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
744 | else |
|
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
745 | return; |
|
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
746 | } |
|
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
747 | |
|
14284
6c99565d0f50
[gaim-migrate @ 16903]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14253
diff
changeset
|
748 | pos = gnt_text_view_get_lines_below(GNT_TEXT_VIEW(ggconv->tv)); |
|
6c99565d0f50
[gaim-migrate @ 16903]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14253
diff
changeset
|
749 | |
|
18935
902fd1b53149
Just show an empty line, instead of bouncing the text down when the user
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18605
diff
changeset
|
750 | gnt_text_view_tag_change(GNT_TEXT_VIEW(ggconv->tv), "typing", NULL, TRUE); |
|
14777
c0ad17caf8ad
[gaim-migrate @ 17469]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14750
diff
changeset
|
751 | gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv), "\n", GNT_TEXT_FLAG_NORMAL); |
|
14284
6c99565d0f50
[gaim-migrate @ 16903]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14253
diff
changeset
|
752 | |
|
14296
ac12fbad24f7
[gaim-migrate @ 16916]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14284
diff
changeset
|
753 | /* Unnecessary to print the timestamp for delayed message */ |
|
16949
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
754 | if (purple_prefs_get_bool("/finch/conversations/timestamps")) |
|
14122
daf2aaa61829
[gaim-migrate @ 16678]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
755 | gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv), |
| 15884 | 756 | purple_utf8_strftime("(%H:%M:%S) ", localtime(&mtime)), GNT_TEXT_FLAG_DIM); |
|
14427
8af0c81db5b9
[gaim-migrate @ 17071]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14413
diff
changeset
|
757 | |
| 15884 | 758 | if (flags & PURPLE_MESSAGE_AUTO_RESP) |
|
14483
82b73e12ce27
[gaim-migrate @ 17129]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14470
diff
changeset
|
759 | gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv), |
|
82b73e12ce27
[gaim-migrate @ 17129]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14470
diff
changeset
|
760 | _("<AUTO-REPLY> "), GNT_TEXT_FLAG_BOLD); |
|
82b73e12ce27
[gaim-migrate @ 17129]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14470
diff
changeset
|
761 | |
|
20625
de0fcfa2bbc1
Show 'buzz'/'nudge' etc. messages differently from regular messages.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20622
diff
changeset
|
762 | if (who && *who && (flags & (PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_RECV)) && |
|
de0fcfa2bbc1
Show 'buzz'/'nudge' etc. messages differently from regular messages.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20622
diff
changeset
|
763 | !(flags & PURPLE_MESSAGE_NOTIFY)) |
|
13959
49d3a87c2679
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13958
diff
changeset
|
764 | { |
|
14427
8af0c81db5b9
[gaim-migrate @ 17071]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14413
diff
changeset
|
765 | char * name = NULL; |
|
8af0c81db5b9
[gaim-migrate @ 17071]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14413
diff
changeset
|
766 | |
| 15884 | 767 | if (purple_message_meify((char*)message, -1)) |
|
14427
8af0c81db5b9
[gaim-migrate @ 17071]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14413
diff
changeset
|
768 | name = g_strdup_printf("*** %s ", who); |
|
8af0c81db5b9
[gaim-migrate @ 17071]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14413
diff
changeset
|
769 | else |
|
8af0c81db5b9
[gaim-migrate @ 17071]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14413
diff
changeset
|
770 | name = g_strdup_printf("%s: ", who); |
|
8af0c81db5b9
[gaim-migrate @ 17071]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14413
diff
changeset
|
771 | |
|
13959
49d3a87c2679
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13958
diff
changeset
|
772 | gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv), |
|
49d3a87c2679
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13958
diff
changeset
|
773 | name, GNT_TEXT_FLAG_BOLD); |
|
49d3a87c2679
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13958
diff
changeset
|
774 | g_free(name); |
|
49d3a87c2679
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13958
diff
changeset
|
775 | } |
|
49d3a87c2679
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13958
diff
changeset
|
776 | else |
|
49d3a87c2679
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13958
diff
changeset
|
777 | fl = GNT_TEXT_FLAG_DIM; |
|
49d3a87c2679
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13958
diff
changeset
|
778 | |
| 15884 | 779 | if (flags & PURPLE_MESSAGE_ERROR) |
|
13959
49d3a87c2679
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13958
diff
changeset
|
780 | fl |= GNT_TEXT_FLAG_BOLD; |
| 15884 | 781 | if (flags & PURPLE_MESSAGE_NICK) |
|
13959
49d3a87c2679
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13958
diff
changeset
|
782 | fl |= GNT_TEXT_FLAG_UNDERLINE; |
|
49d3a87c2679
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13958
diff
changeset
|
783 | |
|
14073
db4207d73bd7
[gaim-migrate @ 16603]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14072
diff
changeset
|
784 | /* XXX: Remove this workaround when textview can parse messages. */ |
| 15884 | 785 | newline = purple_strdup_withhtml(message); |
| 786 | strip = purple_markup_strip_html(newline); | |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
787 | gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv), |
|
13959
49d3a87c2679
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13958
diff
changeset
|
788 | strip, fl); |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
789 | |
|
14073
db4207d73bd7
[gaim-migrate @ 16603]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14072
diff
changeset
|
790 | g_free(newline); |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
791 | g_free(strip); |
|
13959
49d3a87c2679
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13958
diff
changeset
|
792 | |
|
18935
902fd1b53149
Just show an empty line, instead of bouncing the text down when the user
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18605
diff
changeset
|
793 | if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM && |
|
902fd1b53149
Just show an empty line, instead of bouncing the text down when the user
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18605
diff
changeset
|
794 | purple_conv_im_get_typing_state(PURPLE_CONV_IM(conv)) == PURPLE_TYPING) { |
| 15884 | 795 | strip = g_strdup_printf(_("\n%s is typing..."), purple_conversation_get_name(conv)); |
|
15233
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14939
diff
changeset
|
796 | gnt_text_view_append_text_with_tag(GNT_TEXT_VIEW(ggconv->tv), |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14939
diff
changeset
|
797 | strip, GNT_TEXT_FLAG_DIM, "typing"); |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14939
diff
changeset
|
798 | g_free(strip); |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14939
diff
changeset
|
799 | } |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14939
diff
changeset
|
800 | |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14939
diff
changeset
|
801 | if (pos <= 1) |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14939
diff
changeset
|
802 | gnt_text_view_scroll(GNT_TEXT_VIEW(ggconv->tv), 0); |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14939
diff
changeset
|
803 | |
| 15884 | 804 | if (flags & (PURPLE_MESSAGE_RECV | PURPLE_MESSAGE_NICK | PURPLE_MESSAGE_ERROR)) |
|
13969
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13959
diff
changeset
|
805 | gnt_widget_set_urgent(ggconv->tv); |
|
18173
2e65bc9fa310
Provide a 'unseen-count' data for the conversations so the dbus-docklet can use that information.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17854
diff
changeset
|
806 | if (flags & PURPLE_MESSAGE_RECV && !gnt_widget_has_focus(ggconv->window)) { |
|
2e65bc9fa310
Provide a 'unseen-count' data for the conversations so the dbus-docklet can use that information.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17854
diff
changeset
|
807 | int count = GPOINTER_TO_INT(purple_conversation_get_data(conv, "unseen-count")); |
|
2e65bc9fa310
Provide a 'unseen-count' data for the conversations so the dbus-docklet can use that information.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17854
diff
changeset
|
808 | purple_conversation_set_data(conv, "unseen-count", GINT_TO_POINTER(count + 1)); |
|
2e65bc9fa310
Provide a 'unseen-count' data for the conversations so the dbus-docklet can use that information.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17854
diff
changeset
|
809 | purple_conversation_update(conv, PURPLE_CONV_UPDATE_UNSEEN); |
|
2e65bc9fa310
Provide a 'unseen-count' data for the conversations so the dbus-docklet can use that information.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17854
diff
changeset
|
810 | } |
|
13959
49d3a87c2679
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13958
diff
changeset
|
811 | } |
|
49d3a87c2679
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13958
diff
changeset
|
812 | |
|
49d3a87c2679
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13958
diff
changeset
|
813 | static void |
| 15884 | 814 | finch_write_chat(PurpleConversation *conv, const char *who, const char *message, |
| 815 | PurpleMessageFlags flags, time_t mtime) | |
|
13959
49d3a87c2679
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13958
diff
changeset
|
816 | { |
| 15884 | 817 | purple_conversation_write(conv, who, message, flags, mtime); |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
818 | } |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
819 | |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
820 | static void |
| 15884 | 821 | finch_write_im(PurpleConversation *conv, const char *who, const char *message, |
| 822 | PurpleMessageFlags flags, time_t mtime) | |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
823 | { |
| 15884 | 824 | PurpleAccount *account = purple_conversation_get_account(conv); |
| 825 | if (flags & PURPLE_MESSAGE_SEND) | |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
826 | { |
| 15884 | 827 | who = purple_connection_get_display_name(purple_account_get_connection(account)); |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
828 | if (!who) |
| 15884 | 829 | who = purple_account_get_alias(account); |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
830 | if (!who) |
| 15884 | 831 | who = purple_account_get_username(account); |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
832 | } |
| 15884 | 833 | else if (flags & PURPLE_MESSAGE_RECV) |
| 14070 | 834 | { |
| 15884 | 835 | PurpleBuddy *buddy; |
| 836 | who = purple_conversation_get_name(conv); | |
| 837 | buddy = purple_find_buddy(account, who); | |
| 14070 | 838 | if (buddy) |
| 15884 | 839 | who = purple_buddy_get_contact_alias(buddy); |
| 14070 | 840 | } |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
841 | |
| 15884 | 842 | purple_conversation_write(conv, who, message, flags, mtime); |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
843 | } |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
844 | |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
845 | static void |
| 15884 | 846 | finch_write_conv(PurpleConversation *conv, const char *who, const char *alias, |
| 847 | const char *message, PurpleMessageFlags flags, time_t mtime) | |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
848 | { |
|
13959
49d3a87c2679
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13958
diff
changeset
|
849 | const char *name; |
|
49d3a87c2679
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13958
diff
changeset
|
850 | if (alias && *alias) |
|
49d3a87c2679
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13958
diff
changeset
|
851 | name = alias; |
|
49d3a87c2679
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13958
diff
changeset
|
852 | else if (who && *who) |
|
49d3a87c2679
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13958
diff
changeset
|
853 | name = who; |
|
49d3a87c2679
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13958
diff
changeset
|
854 | else |
|
49d3a87c2679
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13958
diff
changeset
|
855 | name = NULL; |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
856 | |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15841
diff
changeset
|
857 | finch_write_common(conv, name, message, flags, mtime); |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
858 | } |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
859 | |
|
17115
7295bc64f5fa
Show user flags in chat userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17076
diff
changeset
|
860 | static const char * |
|
7295bc64f5fa
Show user flags in chat userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17076
diff
changeset
|
861 | chat_flag_text(PurpleConvChatBuddyFlags flags) |
|
7295bc64f5fa
Show user flags in chat userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17076
diff
changeset
|
862 | { |
|
7295bc64f5fa
Show user flags in chat userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17076
diff
changeset
|
863 | if (flags & PURPLE_CBFLAGS_FOUNDER) |
|
7295bc64f5fa
Show user flags in chat userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17076
diff
changeset
|
864 | return "~"; |
|
7295bc64f5fa
Show user flags in chat userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17076
diff
changeset
|
865 | if (flags & PURPLE_CBFLAGS_OP) |
|
7295bc64f5fa
Show user flags in chat userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17076
diff
changeset
|
866 | return "@"; |
|
7295bc64f5fa
Show user flags in chat userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17076
diff
changeset
|
867 | if (flags & PURPLE_CBFLAGS_HALFOP) |
|
7295bc64f5fa
Show user flags in chat userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17076
diff
changeset
|
868 | return "%"; |
|
7295bc64f5fa
Show user flags in chat userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17076
diff
changeset
|
869 | if (flags & PURPLE_CBFLAGS_VOICE) |
|
7295bc64f5fa
Show user flags in chat userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17076
diff
changeset
|
870 | return "+"; |
|
7295bc64f5fa
Show user flags in chat userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17076
diff
changeset
|
871 | return " "; |
|
7295bc64f5fa
Show user flags in chat userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17076
diff
changeset
|
872 | } |
|
7295bc64f5fa
Show user flags in chat userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17076
diff
changeset
|
873 | |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
874 | static void |
| 15884 | 875 | finch_chat_add_users(PurpleConversation *conv, GList *users, gboolean new_arrivals) |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
876 | { |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15841
diff
changeset
|
877 | FinchConv *ggc = conv->ui_data; |
|
14153
9da98052a4e1
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14122
diff
changeset
|
878 | GntEntry *entry = GNT_ENTRY(ggc->entry); |
|
9da98052a4e1
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14122
diff
changeset
|
879 | |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
880 | if (!new_arrivals) |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
881 | { |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
882 | /* Print the list of users in the room */ |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
883 | GString *string = g_string_new(_("List of users:\n")); |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
884 | GList *iter; |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
885 | |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
886 | for (iter = users; iter; iter = iter->next) |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
887 | { |
| 15884 | 888 | PurpleConvChatBuddy *cbuddy = iter->data; |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
889 | char *str; |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
890 | |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
891 | if ((str = cbuddy->alias) == NULL) |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
892 | str = cbuddy->name; |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
893 | g_string_append_printf(string, "[ %s ]", str); |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
894 | } |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
895 | |
| 15884 | 896 | purple_conversation_write(conv, NULL, string->str, |
| 897 | PURPLE_MESSAGE_SYSTEM, time(NULL)); | |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
898 | g_string_free(string, TRUE); |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
899 | } |
|
14153
9da98052a4e1
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14122
diff
changeset
|
900 | |
|
9da98052a4e1
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14122
diff
changeset
|
901 | for (; users; users = users->next) |
|
9da98052a4e1
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14122
diff
changeset
|
902 | { |
| 15884 | 903 | PurpleConvChatBuddy *cbuddy = users->data; |
|
16949
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
904 | GntTree *tree = GNT_TREE(ggc->u.chat->userlist); |
|
14153
9da98052a4e1
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14122
diff
changeset
|
905 | gnt_entry_add_suggest(entry, cbuddy->name); |
|
9da98052a4e1
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14122
diff
changeset
|
906 | gnt_entry_add_suggest(entry, cbuddy->alias); |
|
16949
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
907 | gnt_tree_add_row_after(tree, g_strdup(cbuddy->name), |
|
17115
7295bc64f5fa
Show user flags in chat userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17076
diff
changeset
|
908 | gnt_tree_create_row(tree, chat_flag_text(cbuddy->flags), cbuddy->alias), NULL, NULL); |
|
14153
9da98052a4e1
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14122
diff
changeset
|
909 | } |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
910 | } |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
911 | |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
912 | static void |
| 15884 | 913 | finch_chat_rename_user(PurpleConversation *conv, const char *old, const char *new_n, const char *new_a) |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
914 | { |
|
14318
07aba2cdc261
[gaim-migrate @ 16938]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14296
diff
changeset
|
915 | /* Update the name for string completion */ |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15841
diff
changeset
|
916 | FinchConv *ggc = conv->ui_data; |
|
14153
9da98052a4e1
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14122
diff
changeset
|
917 | GntEntry *entry = GNT_ENTRY(ggc->entry); |
|
16949
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
918 | GntTree *tree = GNT_TREE(ggc->u.chat->userlist); |
|
17115
7295bc64f5fa
Show user flags in chat userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17076
diff
changeset
|
919 | PurpleConvChatBuddy *cb = purple_conv_chat_cb_find(PURPLE_CONV_CHAT(conv), new_n); |
|
7295bc64f5fa
Show user flags in chat userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17076
diff
changeset
|
920 | |
|
14153
9da98052a4e1
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14122
diff
changeset
|
921 | gnt_entry_remove_suggest(entry, old); |
|
17115
7295bc64f5fa
Show user flags in chat userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17076
diff
changeset
|
922 | gnt_tree_remove(tree, (gpointer)old); |
|
7295bc64f5fa
Show user flags in chat userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17076
diff
changeset
|
923 | |
|
14153
9da98052a4e1
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14122
diff
changeset
|
924 | gnt_entry_add_suggest(entry, new_n); |
|
9da98052a4e1
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14122
diff
changeset
|
925 | gnt_entry_add_suggest(entry, new_a); |
|
16949
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
926 | gnt_tree_add_row_after(tree, g_strdup(new_n), |
|
17115
7295bc64f5fa
Show user flags in chat userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17076
diff
changeset
|
927 | gnt_tree_create_row(tree, chat_flag_text(cb->flags), new_a), NULL, NULL); |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
928 | } |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
929 | |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
930 | static void |
|
17164
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
17115
diff
changeset
|
931 | finch_chat_remove_users(PurpleConversation *conv, GList *list) |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
932 | { |
|
14318
07aba2cdc261
[gaim-migrate @ 16938]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14296
diff
changeset
|
933 | /* Remove the name from string completion */ |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15841
diff
changeset
|
934 | FinchConv *ggc = conv->ui_data; |
|
14153
9da98052a4e1
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14122
diff
changeset
|
935 | GntEntry *entry = GNT_ENTRY(ggc->entry); |
|
16949
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
936 | for (; list; list = list->next) { |
|
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
937 | GntTree *tree = GNT_TREE(ggc->u.chat->userlist); |
|
14153
9da98052a4e1
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14122
diff
changeset
|
938 | gnt_entry_remove_suggest(entry, list->data); |
|
16949
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
939 | gnt_tree_remove(tree, list->data); |
|
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
940 | } |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
941 | } |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
942 | |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
943 | static void |
| 15884 | 944 | finch_chat_update_user(PurpleConversation *conv, const char *user) |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
945 | { |
|
17115
7295bc64f5fa
Show user flags in chat userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17076
diff
changeset
|
946 | PurpleConvChatBuddy *cb = purple_conv_chat_cb_find(PURPLE_CONV_CHAT(conv), user); |
|
7295bc64f5fa
Show user flags in chat userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17076
diff
changeset
|
947 | FinchConv *ggc = conv->ui_data; |
|
7295bc64f5fa
Show user flags in chat userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17076
diff
changeset
|
948 | gnt_tree_change_text(GNT_TREE(ggc->u.chat->userlist), (gpointer)user, 0, chat_flag_text(cb->flags)); |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
949 | } |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
950 | |
|
19611
1ea4a579fbfa
Add two missing conversation-uiops functions. (has_focus and present)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19610
diff
changeset
|
951 | static void |
|
1ea4a579fbfa
Add two missing conversation-uiops functions. (has_focus and present)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19610
diff
changeset
|
952 | finch_conv_present(PurpleConversation *conv) |
|
1ea4a579fbfa
Add two missing conversation-uiops functions. (has_focus and present)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19610
diff
changeset
|
953 | { |
|
1ea4a579fbfa
Add two missing conversation-uiops functions. (has_focus and present)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19610
diff
changeset
|
954 | FinchConv *fc = FINCH_CONV(conv); |
|
1ea4a579fbfa
Add two missing conversation-uiops functions. (has_focus and present)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19610
diff
changeset
|
955 | if (fc && fc->window) |
|
20780
c48390a2851d
void functions shouldn't 'return'. Thanks tmcmahon2. Fixes #3151 (gntconv.c fails to compile in Solaris 9)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20625
diff
changeset
|
956 | gnt_window_present(fc->window); |
|
19611
1ea4a579fbfa
Add two missing conversation-uiops functions. (has_focus and present)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19610
diff
changeset
|
957 | } |
|
1ea4a579fbfa
Add two missing conversation-uiops functions. (has_focus and present)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19610
diff
changeset
|
958 | |
|
1ea4a579fbfa
Add two missing conversation-uiops functions. (has_focus and present)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19610
diff
changeset
|
959 | static gboolean |
|
1ea4a579fbfa
Add two missing conversation-uiops functions. (has_focus and present)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19610
diff
changeset
|
960 | finch_conv_has_focus(PurpleConversation *conv) |
|
1ea4a579fbfa
Add two missing conversation-uiops functions. (has_focus and present)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19610
diff
changeset
|
961 | { |
|
1ea4a579fbfa
Add two missing conversation-uiops functions. (has_focus and present)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19610
diff
changeset
|
962 | FinchConv *fc = FINCH_CONV(conv); |
|
1ea4a579fbfa
Add two missing conversation-uiops functions. (has_focus and present)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19610
diff
changeset
|
963 | if (fc && fc->window) |
|
1ea4a579fbfa
Add two missing conversation-uiops functions. (has_focus and present)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19610
diff
changeset
|
964 | return gnt_widget_has_focus(fc->window); |
|
1ea4a579fbfa
Add two missing conversation-uiops functions. (has_focus and present)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19610
diff
changeset
|
965 | return FALSE; |
|
1ea4a579fbfa
Add two missing conversation-uiops functions. (has_focus and present)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19610
diff
changeset
|
966 | } |
|
1ea4a579fbfa
Add two missing conversation-uiops functions. (has_focus and present)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19610
diff
changeset
|
967 | |
| 15884 | 968 | static PurpleConversationUiOps conv_ui_ops = |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
969 | { |
|
17164
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
17115
diff
changeset
|
970 | finch_create_conversation, |
|
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
17115
diff
changeset
|
971 | finch_destroy_conversation, |
|
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
17115
diff
changeset
|
972 | finch_write_chat, |
|
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
17115
diff
changeset
|
973 | finch_write_im, |
|
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
17115
diff
changeset
|
974 | finch_write_conv, |
|
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
17115
diff
changeset
|
975 | finch_chat_add_users, |
|
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
17115
diff
changeset
|
976 | finch_chat_rename_user, |
|
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
17115
diff
changeset
|
977 | finch_chat_remove_users, |
|
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
17115
diff
changeset
|
978 | finch_chat_update_user, |
|
19611
1ea4a579fbfa
Add two missing conversation-uiops functions. (has_focus and present)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19610
diff
changeset
|
979 | finch_conv_present, /* present */ |
|
1ea4a579fbfa
Add two missing conversation-uiops functions. (has_focus and present)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19610
diff
changeset
|
980 | finch_conv_has_focus, /* has_focus */ |
|
17164
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
17115
diff
changeset
|
981 | NULL, /* custom_smiley_add */ |
|
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
17115
diff
changeset
|
982 | NULL, /* custom_smiley_write */ |
|
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
17115
diff
changeset
|
983 | NULL, /* custom_smiley_close */ |
|
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
17115
diff
changeset
|
984 | NULL, /* send_confirm */ |
|
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
17115
diff
changeset
|
985 | NULL, |
|
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
17115
diff
changeset
|
986 | NULL, |
|
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
17115
diff
changeset
|
987 | NULL, |
|
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
17115
diff
changeset
|
988 | NULL |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
989 | }; |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
990 | |
| 15884 | 991 | PurpleConversationUiOps *finch_conv_get_ui_ops() |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
992 | { |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
993 | return &conv_ui_ops; |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
994 | } |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
995 | |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
996 | /* Xerox */ |
| 15884 | 997 | static PurpleCmdRet |
| 998 | say_command_cb(PurpleConversation *conv, | |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
999 | const char *cmd, char **args, char **error, void *data) |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1000 | { |
| 15884 | 1001 | if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) |
| 1002 | purple_conv_im_send(PURPLE_CONV_IM(conv), args[0]); | |
| 1003 | else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) | |
| 1004 | purple_conv_chat_send(PURPLE_CONV_CHAT(conv), args[0]); | |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1005 | |
| 15884 | 1006 | return PURPLE_CMD_RET_OK; |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1007 | } |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1008 | |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1009 | /* Xerox */ |
| 15884 | 1010 | static PurpleCmdRet |
| 1011 | me_command_cb(PurpleConversation *conv, | |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1012 | const char *cmd, char **args, char **error, void *data) |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1013 | { |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1014 | char *tmp; |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1015 | |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1016 | tmp = g_strdup_printf("/me %s", args[0]); |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1017 | |
| 15884 | 1018 | if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) |
| 1019 | purple_conv_im_send(PURPLE_CONV_IM(conv), tmp); | |
| 1020 | else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) | |
| 1021 | purple_conv_chat_send(PURPLE_CONV_CHAT(conv), tmp); | |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1022 | |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1023 | g_free(tmp); |
| 15884 | 1024 | return PURPLE_CMD_RET_OK; |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1025 | } |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1026 | |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1027 | /* Xerox */ |
| 15884 | 1028 | static PurpleCmdRet |
| 1029 | debug_command_cb(PurpleConversation *conv, | |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1030 | const char *cmd, char **args, char **error, void *data) |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1031 | { |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1032 | char *tmp, *markup; |
| 15884 | 1033 | PurpleCmdStatus status; |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1034 | |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1035 | if (!g_ascii_strcasecmp(args[0], "version")) { |
|
21106
b85fbef13eed
Add a --with-extraversion option to ./configure so packagers can fine tune
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21076
diff
changeset
|
1036 | tmp = g_strdup_printf("me is using Finch v%s.", DISPLAY_VERSION); |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1037 | markup = g_markup_escape_text(tmp, -1); |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1038 | |
| 15884 | 1039 | status = purple_cmd_do_command(conv, tmp, markup, error); |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1040 | |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1041 | g_free(tmp); |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1042 | g_free(markup); |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1043 | return status; |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1044 | } else { |
| 15884 | 1045 | purple_conversation_write(conv, NULL, _("Supported debug options are: version"), |
| 1046 | PURPLE_MESSAGE_NO_LOG|PURPLE_MESSAGE_ERROR, time(NULL)); | |
| 1047 | return PURPLE_CMD_STATUS_OK; | |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1048 | } |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1049 | } |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1050 | |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1051 | /* Xerox */ |
| 15884 | 1052 | static PurpleCmdRet |
| 1053 | clear_command_cb(PurpleConversation *conv, | |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1054 | const char *cmd, char **args, char **error, void *data) |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1055 | { |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15841
diff
changeset
|
1056 | FinchConv *ggconv = conv->ui_data; |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1057 | gnt_text_view_clear(GNT_TEXT_VIEW(ggconv->tv)); |
|
19599
5d2c452fbc12
Clear the message history in the /clear callback.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
1058 | purple_conversation_clear_message_history(conv); |
| 15884 | 1059 | return PURPLE_CMD_STATUS_OK; |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1060 | } |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1061 | |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1062 | /* Xerox */ |
| 15884 | 1063 | static PurpleCmdRet |
| 1064 | help_command_cb(PurpleConversation *conv, | |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1065 | const char *cmd, char **args, char **error, void *data) |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1066 | { |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1067 | GList *l, *text; |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1068 | GString *s; |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1069 | |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1070 | if (args[0] != NULL) { |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1071 | s = g_string_new(""); |
| 15884 | 1072 | text = purple_cmd_help(conv, args[0]); |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1073 | |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1074 | if (text) { |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1075 | for (l = text; l; l = l->next) |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1076 | if (l->next) |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1077 | g_string_append_printf(s, "%s\n", (char *)l->data); |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1078 | else |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1079 | g_string_append_printf(s, "%s", (char *)l->data); |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1080 | } else { |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1081 | g_string_append(s, _("No such command (in this context).")); |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1082 | } |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1083 | } else { |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1084 | s = g_string_new(_("Use \"/help <command>\" for help on a specific command.\n" |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1085 | "The following commands are available in this context:\n")); |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1086 | |
| 15884 | 1087 | text = purple_cmd_list(conv); |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1088 | for (l = text; l; l = l->next) |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1089 | if (l->next) |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1090 | g_string_append_printf(s, "%s, ", (char *)l->data); |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1091 | else |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1092 | g_string_append_printf(s, "%s.", (char *)l->data); |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1093 | g_list_free(text); |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1094 | } |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1095 | |
| 15884 | 1096 | purple_conversation_write(conv, NULL, s->str, PURPLE_MESSAGE_NO_LOG, time(NULL)); |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1097 | g_string_free(s, TRUE); |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1098 | |
| 15884 | 1099 | return PURPLE_CMD_STATUS_OK; |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1100 | } |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1101 | |
| 15884 | 1102 | static PurpleCmdRet |
| 1103 | cmd_show_window(PurpleConversation *conv, const char *cmd, char **args, char **error, gpointer data) | |
|
14086
732c14687955
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14073
diff
changeset
|
1104 | { |
|
732c14687955
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14073
diff
changeset
|
1105 | void (*callback)() = data; |
|
732c14687955
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14073
diff
changeset
|
1106 | callback(); |
| 15884 | 1107 | return PURPLE_CMD_STATUS_OK; |
|
14086
732c14687955
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14073
diff
changeset
|
1108 | } |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1109 | |
|
16949
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
1110 | static PurpleCmdRet |
|
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
1111 | users_command_cb(PurpleConversation *conv, const char *cmd, char **args, char **error, gpointer data) |
|
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
1112 | { |
|
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
1113 | FinchConv *fc = conv->ui_data; |
|
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
1114 | FinchConvChat *ch; |
|
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
1115 | if (!fc) |
|
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
1116 | return PURPLE_CMD_STATUS_FAILED; |
|
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
1117 | |
|
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
1118 | ch = fc->u.chat; |
|
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
1119 | gnt_widget_set_visible(ch->userlist, |
|
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
1120 | (GNT_WIDGET_IS_FLAG_SET(ch->userlist, GNT_WIDGET_INVISIBLE))); |
|
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
1121 | gnt_box_readjust(GNT_BOX(fc->window)); |
|
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
1122 | gnt_box_give_focus_to_child(GNT_BOX(fc->window), fc->entry); |
|
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
1123 | purple_prefs_set_bool(PREF_USERLIST, !(GNT_WIDGET_IS_FLAG_SET(ch->userlist, GNT_WIDGET_INVISIBLE))); |
|
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
1124 | return PURPLE_CMD_STATUS_OK; |
|
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
1125 | } |
|
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
1126 | |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15841
diff
changeset
|
1127 | void finch_conversation_init() |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1128 | { |
| 15884 | 1129 | purple_prefs_add_none(PREF_ROOT); |
| 1130 | purple_prefs_add_none(PREF_ROOT "/size"); | |
| 1131 | purple_prefs_add_int(PREF_ROOT "/size/width", 70); | |
| 1132 | purple_prefs_add_int(PREF_ROOT "/size/height", 20); | |
| 1133 | purple_prefs_add_none(PREF_ROOT "/position"); | |
| 1134 | purple_prefs_add_int(PREF_ROOT "/position/x", 0); | |
| 1135 | purple_prefs_add_int(PREF_ROOT "/position/y", 0); | |
|
16949
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
1136 | purple_prefs_add_none(PREF_CHAT); |
|
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
1137 | purple_prefs_add_bool(PREF_USERLIST, FALSE); |
|
14072
4e64a4f18686
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14070
diff
changeset
|
1138 | |
|
4e64a4f18686
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14070
diff
changeset
|
1139 | /* Xerox the commands */ |
| 15884 | 1140 | purple_cmd_register("say", "S", PURPLE_CMD_P_DEFAULT, |
| 1141 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM, NULL, | |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1142 | say_command_cb, _("say <message>: Send a message normally as if you weren't using a command."), NULL); |
| 15884 | 1143 | purple_cmd_register("me", "S", PURPLE_CMD_P_DEFAULT, |
| 1144 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM, NULL, | |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1145 | me_command_cb, _("me <action>: Send an IRC style action to a buddy or chat."), NULL); |
| 15884 | 1146 | purple_cmd_register("debug", "w", PURPLE_CMD_P_DEFAULT, |
| 1147 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM, NULL, | |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1148 | debug_command_cb, _("debug <option>: Send various debug information to the current conversation."), NULL); |
| 15884 | 1149 | purple_cmd_register("clear", "", PURPLE_CMD_P_DEFAULT, |
| 1150 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM, NULL, | |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1151 | clear_command_cb, _("clear: Clears the conversation scrollback."), NULL); |
| 15884 | 1152 | purple_cmd_register("help", "w", PURPLE_CMD_P_DEFAULT, |
| 1153 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, NULL, | |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1154 | help_command_cb, _("help <command>: Help on a specific command."), NULL); |
|
16949
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
1155 | purple_cmd_register("users", "", PURPLE_CMD_P_DEFAULT, |
|
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
1156 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, NULL, |
|
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
1157 | users_command_cb, _("users: Show the list of users in the chat."), NULL); |
|
14086
732c14687955
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14073
diff
changeset
|
1158 | |
|
732c14687955
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14073
diff
changeset
|
1159 | /* Now some commands to bring up some other windows */ |
| 15884 | 1160 | purple_cmd_register("plugins", "", PURPLE_CMD_P_DEFAULT, |
| 1161 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM, NULL, | |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15841
diff
changeset
|
1162 | cmd_show_window, _("plugins: Show the plugins window."), finch_plugins_show_all); |
| 15884 | 1163 | purple_cmd_register("buddylist", "", PURPLE_CMD_P_DEFAULT, |
| 1164 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM, NULL, | |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15841
diff
changeset
|
1165 | cmd_show_window, _("buddylist: Show the buddylist."), finch_blist_show); |
| 15884 | 1166 | purple_cmd_register("accounts", "", PURPLE_CMD_P_DEFAULT, |
| 1167 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM, NULL, | |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15841
diff
changeset
|
1168 | cmd_show_window, _("accounts: Show the accounts window."), finch_accounts_show_all); |
| 15884 | 1169 | purple_cmd_register("debugwin", "", PURPLE_CMD_P_DEFAULT, |
| 1170 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM, NULL, | |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15841
diff
changeset
|
1171 | cmd_show_window, _("debugwin: Show the debug window."), finch_debug_window_show); |
| 15884 | 1172 | purple_cmd_register("prefs", "", PURPLE_CMD_P_DEFAULT, |
| 1173 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM, NULL, | |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15841
diff
changeset
|
1174 | cmd_show_window, _("prefs: Show the preference window."), finch_prefs_show_all); |
| 15884 | 1175 | purple_cmd_register("status", "", PURPLE_CMD_P_DEFAULT, |
| 1176 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM, NULL, | |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15841
diff
changeset
|
1177 | cmd_show_window, _("statuses: Show the savedstatuses window."), finch_savedstatus_show_all); |
|
17076
9968d75058a4
Notify when you leave a chat, after /part or /kick.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17028
diff
changeset
|
1178 | |
|
9968d75058a4
Notify when you leave a chat, after /part or /kick.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17028
diff
changeset
|
1179 | purple_signal_connect(purple_conversations_get_handle(), "buddy-typing", finch_conv_get_handle(), |
|
9968d75058a4
Notify when you leave a chat, after /part or /kick.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17028
diff
changeset
|
1180 | PURPLE_CALLBACK(update_buddy_typing), NULL); |
|
9968d75058a4
Notify when you leave a chat, after /part or /kick.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17028
diff
changeset
|
1181 | purple_signal_connect(purple_conversations_get_handle(), "buddy-typing-stopped", finch_conv_get_handle(), |
|
9968d75058a4
Notify when you leave a chat, after /part or /kick.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17028
diff
changeset
|
1182 | PURPLE_CALLBACK(update_buddy_typing), NULL); |
|
9968d75058a4
Notify when you leave a chat, after /part or /kick.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17028
diff
changeset
|
1183 | purple_signal_connect(purple_conversations_get_handle(), "chat-left", finch_conv_get_handle(), |
|
9968d75058a4
Notify when you leave a chat, after /part or /kick.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17028
diff
changeset
|
1184 | PURPLE_CALLBACK(chat_left_cb), NULL); |
|
19449
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
1185 | purple_signal_connect(purple_blist_get_handle(), "buddy-signed-on", finch_conv_get_handle(), |
|
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
1186 | PURPLE_CALLBACK(buddy_signed_on_off), NULL); |
|
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
1187 | purple_signal_connect(purple_blist_get_handle(), "buddy-signed-off", finch_conv_get_handle(), |
|
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
1188 | PURPLE_CALLBACK(buddy_signed_on_off), NULL); |
|
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
1189 | purple_signal_connect(purple_connections_get_handle(), "signed-on", finch_conv_get_handle(), |
|
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
1190 | PURPLE_CALLBACK(account_signed_on_off), NULL); |
|
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
1191 | purple_signal_connect(purple_connections_get_handle(), "signed-off", finch_conv_get_handle(), |
|
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
1192 | PURPLE_CALLBACK(account_signed_on_off), NULL); |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1193 | } |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1194 | |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15841
diff
changeset
|
1195 | void finch_conversation_uninit() |
|
13969
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13959
diff
changeset
|
1196 | { |
|
17076
9968d75058a4
Notify when you leave a chat, after /part or /kick.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17028
diff
changeset
|
1197 | purple_signals_disconnect_by_handle(finch_conv_get_handle()); |
|
13969
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13959
diff
changeset
|
1198 | } |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13959
diff
changeset
|
1199 | |
| 15884 | 1200 | void finch_conversation_set_active(PurpleConversation *conv) |
|
14450
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
1201 | { |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15841
diff
changeset
|
1202 | FinchConv *ggconv = conv->ui_data; |
| 15884 | 1203 | PurpleAccount *account; |
|
14470
352d47a0724d
[gaim-migrate @ 17116]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14450
diff
changeset
|
1204 | char *title; |
|
14450
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
1205 | |
|
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
1206 | g_return_if_fail(ggconv); |
|
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
1207 | g_return_if_fail(g_list_find(ggconv->list, conv)); |
|
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
1208 | |
|
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
1209 | ggconv->active_conv = conv; |
| 15884 | 1210 | account = purple_conversation_get_account(conv); |
| 14612 | 1211 | title = get_conversation_title(conv, account); |
|
14470
352d47a0724d
[gaim-migrate @ 17116]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14450
diff
changeset
|
1212 | gnt_screen_rename_widget(ggconv->window, title); |
|
352d47a0724d
[gaim-migrate @ 17116]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14450
diff
changeset
|
1213 | g_free(title); |
|
14450
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
1214 | } |
|
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
1215 | |
|
16190
435e34f11655
Allow adding information widgets in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16186
diff
changeset
|
1216 | void finch_conversation_set_info_widget(PurpleConversation *conv, GntWidget *widget) |
|
435e34f11655
Allow adding information widgets in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16186
diff
changeset
|
1217 | { |
|
435e34f11655
Allow adding information widgets in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16186
diff
changeset
|
1218 | FinchConv *fc = conv->ui_data; |
|
435e34f11655
Allow adding information widgets in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16186
diff
changeset
|
1219 | int height, width; |
|
435e34f11655
Allow adding information widgets in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16186
diff
changeset
|
1220 | |
|
435e34f11655
Allow adding information widgets in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16186
diff
changeset
|
1221 | gnt_box_remove_all(GNT_BOX(fc->info)); |
|
435e34f11655
Allow adding information widgets in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16186
diff
changeset
|
1222 | |
|
435e34f11655
Allow adding information widgets in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16186
diff
changeset
|
1223 | if (widget) { |
|
435e34f11655
Allow adding information widgets in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16186
diff
changeset
|
1224 | gnt_box_add_widget(GNT_BOX(fc->info), widget); |
|
435e34f11655
Allow adding information widgets in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16186
diff
changeset
|
1225 | gnt_box_readjust(GNT_BOX(fc->info)); |
|
435e34f11655
Allow adding information widgets in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16186
diff
changeset
|
1226 | } |
|
435e34f11655
Allow adding information widgets in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16186
diff
changeset
|
1227 | |
|
435e34f11655
Allow adding information widgets in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16186
diff
changeset
|
1228 | gnt_widget_get_size(fc->window, &width, &height); |
|
435e34f11655
Allow adding information widgets in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16186
diff
changeset
|
1229 | gnt_box_readjust(GNT_BOX(fc->window)); |
|
435e34f11655
Allow adding information widgets in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16186
diff
changeset
|
1230 | gnt_screen_resize_widget(fc->window, width, height); |
|
435e34f11655
Allow adding information widgets in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16186
diff
changeset
|
1231 | gnt_box_give_focus_to_child(GNT_BOX(fc->window), fc->entry); |
|
435e34f11655
Allow adding information widgets in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16186
diff
changeset
|
1232 | } |
|
435e34f11655
Allow adding information widgets in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16186
diff
changeset
|
1233 |