Thu, 02 Jun 2022 21:06:26 -0500
Prepare for the 2.14.10 release
Testing Done:
Ran `codespell` and `make distcheck`
Reviewed at https://reviews.imfreedom.org/r/1489/
|
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 | */ |
|
14028
eefce1b0c4e3
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14005
diff
changeset
|
26 | |
|
29106
51c7b2177e42
Fix all the remaining files for which internal.h doesn't end up being the first include.
Paul Aurich <darkrain42@pidgin.im>
parents:
28729
diff
changeset
|
27 | #include <internal.h> |
|
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> |
|
28543
1a8becaa2a21
'/debug plugins' will announce the list of loaded plugins.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27829
diff
changeset
|
31 | #include <core.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
|
32 | #include <idle.h> |
|
14072
4e64a4f18686
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14070
diff
changeset
|
33 | #include <prefs.h> |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
34 | #include <util.h> |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
35 | |
|
14086
732c14687955
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14073
diff
changeset
|
36 | #include "gntaccount.h" |
|
13978
70d7030b7f26
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13969
diff
changeset
|
37 | #include "gntblist.h" |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
38 | #include "gntconv.h" |
|
14086
732c14687955
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14073
diff
changeset
|
39 | #include "gntdebug.h" |
|
22376
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22341
diff
changeset
|
40 | #include "gntlog.h" |
|
14086
732c14687955
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14073
diff
changeset
|
41 | #include "gntplugin.h" |
|
23374
70c054708da7
Add an invite menu for chats
Richard Nelson <wabz@pidgin.im>
parents:
22840
diff
changeset
|
42 | #include "gntpounce.h" |
|
14121
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14109
diff
changeset
|
43 | #include "gntprefs.h" |
|
23374
70c054708da7
Add an invite menu for chats
Richard Nelson <wabz@pidgin.im>
parents:
22840
diff
changeset
|
44 | #include "gntrequest.h" |
|
19612
043dcbf3a36e
Fix #2767 (per-conversation/chat mute option).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19611
diff
changeset
|
45 | #include "gntsound.h" |
|
14188
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14153
diff
changeset
|
46 | #include "gntstatus.h" |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
47 | |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
48 | #include "gnt.h" |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
49 | #include "gntbox.h" |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
50 | #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
|
51 | #include "gntlabel.h" |
| 16948 | 52 | #include "gntmenu.h" |
| 53 | #include "gntmenuitem.h" | |
| 54 | #include "gntmenuitemcheck.h" | |
|
21855
fc93ce6595e4
Add color to the conversation window to indicate various message attributes
Richard Nelson <wabz@pidgin.im>
parents:
21453
diff
changeset
|
55 | #include "gntstyle.h" |
|
16949
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
56 | #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
|
57 | #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
|
58 | #include "gntutils.h" |
| 16948 | 59 | #include "gntwindow.h" |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
60 | |
|
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
|
61 | #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
|
62 | #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
|
63 | #define PREF_USERLIST PREF_CHAT "/userlist" |
|
14072
4e64a4f18686
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14070
diff
changeset
|
64 | |
|
14253
b63ebf84c42b
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
14188
diff
changeset
|
65 | #include "config.h" |
|
b63ebf84c42b
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
14188
diff
changeset
|
66 | |
|
17076
9968d75058a4
Notify when you leave a chat, after /part or /kick.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17028
diff
changeset
|
67 | 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
|
68 | 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
|
69 | 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
|
70 | |
|
21855
fc93ce6595e4
Add color to the conversation window to indicate various message attributes
Richard Nelson <wabz@pidgin.im>
parents:
21453
diff
changeset
|
71 | static int color_message_receive; |
|
fc93ce6595e4
Add color to the conversation window to indicate various message attributes
Richard Nelson <wabz@pidgin.im>
parents:
21453
diff
changeset
|
72 | static int color_message_send; |
|
fc93ce6595e4
Add color to the conversation window to indicate various message attributes
Richard Nelson <wabz@pidgin.im>
parents:
21453
diff
changeset
|
73 | static int color_message_highlight; |
|
fc93ce6595e4
Add color to the conversation window to indicate various message attributes
Richard Nelson <wabz@pidgin.im>
parents:
21453
diff
changeset
|
74 | static int color_message_action; |
|
fc93ce6595e4
Add color to the conversation window to indicate various message attributes
Richard Nelson <wabz@pidgin.im>
parents:
21453
diff
changeset
|
75 | static int color_timestamp; |
|
fc93ce6595e4
Add color to the conversation window to indicate various message attributes
Richard Nelson <wabz@pidgin.im>
parents:
21453
diff
changeset
|
76 | |
|
22337
9868137b6724
Update finch to not touch the internals of PurpleConversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22336
diff
changeset
|
77 | static PurpleBuddy * |
|
9868137b6724
Update finch to not touch the internals of PurpleConversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22336
diff
changeset
|
78 | find_buddy_for_conversation(PurpleConversation *conv) |
|
9868137b6724
Update finch to not touch the internals of PurpleConversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22336
diff
changeset
|
79 | { |
|
9868137b6724
Update finch to not touch the internals of PurpleConversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22336
diff
changeset
|
80 | return purple_find_buddy(purple_conversation_get_account(conv), |
|
9868137b6724
Update finch to not touch the internals of PurpleConversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22336
diff
changeset
|
81 | purple_conversation_get_name(conv)); |
|
9868137b6724
Update finch to not touch the internals of PurpleConversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22336
diff
changeset
|
82 | } |
|
9868137b6724
Update finch to not touch the internals of PurpleConversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22336
diff
changeset
|
83 | |
|
9868137b6724
Update finch to not touch the internals of PurpleConversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22336
diff
changeset
|
84 | static PurpleChat * |
|
9868137b6724
Update finch to not touch the internals of PurpleConversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22336
diff
changeset
|
85 | find_chat_for_conversation(PurpleConversation *conv) |
|
9868137b6724
Update finch to not touch the internals of PurpleConversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22336
diff
changeset
|
86 | { |
|
9868137b6724
Update finch to not touch the internals of PurpleConversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22336
diff
changeset
|
87 | return purple_blist_find_chat(purple_conversation_get_account(conv), |
|
9868137b6724
Update finch to not touch the internals of PurpleConversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22336
diff
changeset
|
88 | purple_conversation_get_name(conv)); |
|
9868137b6724
Update finch to not touch the internals of PurpleConversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22336
diff
changeset
|
89 | } |
|
9868137b6724
Update finch to not touch the internals of PurpleConversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22336
diff
changeset
|
90 | |
|
19986
7c725191167c
Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
91 | static PurpleBlistNode * |
|
7c725191167c
Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
92 | 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
|
93 | { |
|
7c725191167c
Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
94 | PurpleBlistNode *node = NULL; |
|
7c725191167c
Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
95 | |
|
7c725191167c
Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
96 | 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
|
97 | case PURPLE_CONV_TYPE_IM: |
|
22337
9868137b6724
Update finch to not touch the internals of PurpleConversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22336
diff
changeset
|
98 | node = (PurpleBlistNode*)find_buddy_for_conversation(conv); |
|
22334
6eec04817c0d
Add API so Finch doesn't need to touch the internals of PurpleBlistNode.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22104
diff
changeset
|
99 | node = node ? purple_blist_node_get_parent(node) : NULL; |
|
19986
7c725191167c
Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
100 | break; |
|
7c725191167c
Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
101 | case PURPLE_CONV_TYPE_CHAT: |
|
22337
9868137b6724
Update finch to not touch the internals of PurpleConversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22336
diff
changeset
|
102 | node = (PurpleBlistNode*)find_chat_for_conversation(conv); |
|
19986
7c725191167c
Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
103 | break; |
|
7c725191167c
Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
104 | default: |
|
7c725191167c
Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
105 | break; |
|
7c725191167c
Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
106 | } |
|
7c725191167c
Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
107 | return node; |
|
7c725191167c
Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
108 | } |
|
7c725191167c
Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
109 | |
|
15373
8483019d6961
[gaim-migrate @ 18102]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15262
diff
changeset
|
110 | static void |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15841
diff
changeset
|
111 | send_typing_notification(GntWidget *w, FinchConv *ggconv) |
|
15262
8f97f9047232
[gaim-migrate @ 17990]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15250
diff
changeset
|
112 | { |
|
15373
8483019d6961
[gaim-migrate @ 18102]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15262
diff
changeset
|
113 | 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
|
114 | 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
|
115 | if (purple_prefs_get_bool("/finch/conversations/notify_typing")) { |
| 15884 | 116 | PurpleConversation *conv = ggconv->active_conv; |
| 117 | PurpleConvIm *im = PURPLE_CONV_IM(conv); | |
|
15373
8483019d6961
[gaim-migrate @ 18102]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15262
diff
changeset
|
118 | if (!empty) { |
| 15884 | 119 | 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
|
120 | |
| 15884 | 121 | purple_conv_im_stop_send_typed_timeout(im); |
| 122 | purple_conv_im_start_send_typed_timeout(im); | |
| 123 | if (send || (purple_conv_im_get_type_again(im) != 0 && | |
| 124 | time(NULL) > purple_conv_im_get_type_again(im))) { | |
|
15262
8f97f9047232
[gaim-migrate @ 17990]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15250
diff
changeset
|
125 | unsigned int timeout; |
| 15884 | 126 | timeout = serv_send_typing(purple_conversation_get_gc(conv), |
| 127 | purple_conversation_get_name(conv), | |
| 128 | PURPLE_TYPING); | |
| 129 | purple_conv_im_set_type_again(im, timeout); | |
|
15262
8f97f9047232
[gaim-migrate @ 17990]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15250
diff
changeset
|
130 | } |
|
15373
8483019d6961
[gaim-migrate @ 18102]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15262
diff
changeset
|
131 | } else { |
| 15884 | 132 | purple_conv_im_stop_send_typed_timeout(im); |
|
15373
8483019d6961
[gaim-migrate @ 18102]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15262
diff
changeset
|
133 | |
| 15884 | 134 | serv_send_typing(purple_conversation_get_gc(conv), |
| 135 | purple_conversation_get_name(conv), | |
| 136 | PURPLE_NOT_TYPING); | |
|
15262
8f97f9047232
[gaim-migrate @ 17990]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15250
diff
changeset
|
137 | } |
|
8f97f9047232
[gaim-migrate @ 17990]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15250
diff
changeset
|
138 | } |
|
8f97f9047232
[gaim-migrate @ 17990]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15250
diff
changeset
|
139 | } |
|
8f97f9047232
[gaim-migrate @ 17990]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15250
diff
changeset
|
140 | |
|
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
|
141 | 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
|
142 | entry_key_pressed(GntWidget *w, FinchConv *ggconv) |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
143 | { |
|
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
|
144 | const char *text = gnt_entry_get_text(GNT_ENTRY(ggconv->entry)); |
|
23503
9a0d740df39f
Send '//message' as '/message', instead of looking for a 'message' command.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23452
diff
changeset
|
145 | if (*text == '/' && *(text + 1) != '/') |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
146 | { |
|
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
|
147 | 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
|
148 | 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
|
149 | 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
|
150 | 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
|
151 | |
|
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
|
152 | 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
|
153 | 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
|
154 | g_free(escape); |
|
14028
eefce1b0c4e3
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14005
diff
changeset
|
155 | |
|
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 | 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
|
157 | { |
|
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 | 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
|
159 | 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
|
160 | 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
|
161 | 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
|
162 | 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
|
163 | 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
|
164 | 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
|
165 | 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
|
166 | "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
|
167 | 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 | 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
|
169 | 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
|
170 | 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
|
171 | 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
|
172 | 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
|
173 | 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
|
174 | 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
|
175 | purple_conversation_write(conv, "", _("That command only works in chats, not IMs."), |
| 15884 | 176 | 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
|
177 | 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
|
178 | purple_conversation_write(conv, "", _("That command only works in IMs, not chats."), |
| 15884 | 179 | 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
|
180 | 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
|
181 | 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
|
182 | 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
|
183 | 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
|
184 | break; |
|
14000
aab306afdc43
[gaim-migrate @ 16469]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13993
diff
changeset
|
185 | } |
|
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
|
186 | 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
|
187 | } |
|
22337
9868137b6724
Update finch to not touch the internals of PurpleConversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22336
diff
changeset
|
188 | else if (!purple_account_is_connected(purple_conversation_get_account(ggconv->active_conv))) |
|
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
|
189 | { |
|
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 | 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
|
191 | 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
|
192 | } |
|
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
|
193 | 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
|
194 | { |
|
27699
8f6edef17bf5
Use purple_markup_escape_text instead of the glib version.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26762
diff
changeset
|
195 | char *escape = purple_markup_escape_text((*text == '/' ? text + 1 : text), -1); |
|
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
|
196 | switch (purple_conversation_get_type(ggconv->active_conv)) |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
197 | { |
|
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
|
198 | 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
|
199 | 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
|
200 | 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
|
201 | 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
|
202 | 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
|
203 | 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
|
204 | 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
|
205 | 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
|
206 | g_return_if_reached(); |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
207 | } |
|
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
|
208 | 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
|
209 | purple_idle_touch(); |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
210 | } |
|
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
|
211 | 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
|
212 | gnt_entry_clear(GNT_ENTRY(ggconv->entry)); |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
213 | } |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
214 | |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
215 | static void |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15841
diff
changeset
|
216 | closing_window(GntWidget *window, FinchConv *ggconv) |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
217 | { |
|
14450
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
218 | GList *list = ggconv->list; |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
219 | ggconv->window = NULL; |
|
14450
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
220 | while (list) { |
| 15884 | 221 | PurpleConversation *conv = list->data; |
|
14450
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
222 | list = list->next; |
| 15884 | 223 | purple_conversation_destroy(conv); |
|
14450
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
224 | } |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
225 | } |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
226 | |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
227 | static void |
|
14923
ccb42b285510
[gaim-migrate @ 17630]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14884
diff
changeset
|
228 | size_changed_cb(GntWidget *widget, int width, int height) |
|
14072
4e64a4f18686
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14070
diff
changeset
|
229 | { |
|
14923
ccb42b285510
[gaim-migrate @ 17630]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14884
diff
changeset
|
230 | int w, h; |
|
ccb42b285510
[gaim-migrate @ 17630]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14884
diff
changeset
|
231 | gnt_widget_get_size(widget, &w, &h); |
| 15884 | 232 | purple_prefs_set_int(PREF_ROOT "/size/width", w); |
| 233 | purple_prefs_set_int(PREF_ROOT "/size/height", h); | |
|
14072
4e64a4f18686
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14070
diff
changeset
|
234 | } |
|
4e64a4f18686
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14070
diff
changeset
|
235 | |
|
4e64a4f18686
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14070
diff
changeset
|
236 | static void |
|
4e64a4f18686
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14070
diff
changeset
|
237 | save_position_cb(GntWidget *w, int x, int y) |
|
4e64a4f18686
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14070
diff
changeset
|
238 | { |
| 15884 | 239 | purple_prefs_set_int(PREF_ROOT "/position/x", x); |
| 240 | purple_prefs_set_int(PREF_ROOT "/position/y", y); | |
|
14072
4e64a4f18686
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14070
diff
changeset
|
241 | } |
|
4e64a4f18686
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14070
diff
changeset
|
242 | |
| 15884 | 243 | static PurpleConversation * |
|
19449
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
244 | find_conv_with_contact(PurpleAccount *account, const char *name) |
|
14450
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
245 | { |
| 15884 | 246 | PurpleBlistNode *node; |
|
19449
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
247 | PurpleBuddy *buddy = purple_find_buddy(account, name); |
| 15884 | 248 | PurpleConversation *ret = NULL; |
|
14450
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
249 | |
|
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
250 | if (!buddy) |
|
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
251 | return NULL; |
|
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
252 | |
|
22334
6eec04817c0d
Add API so Finch doesn't need to touch the internals of PurpleBlistNode.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22104
diff
changeset
|
253 | for (node = purple_blist_node_get_first_child(purple_blist_node_get_parent((PurpleBlistNode*)buddy)); |
|
6eec04817c0d
Add API so Finch doesn't need to touch the internals of PurpleBlistNode.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22104
diff
changeset
|
254 | node; node = purple_blist_node_get_sibling_next(node)) { |
| 15884 | 255 | if (node == (PurpleBlistNode*)buddy) |
|
14450
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
256 | continue; |
| 15884 | 257 | if ((ret = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, |
|
22341
ed341c90116e
Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22339
diff
changeset
|
258 | purple_buddy_get_name((PurpleBuddy*)node), purple_buddy_get_account((PurpleBuddy*)node))) != NULL) |
|
14450
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
259 | break; |
|
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
260 | } |
|
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
261 | return ret; |
|
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
262 | } |
|
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
263 | |
| 14612 | 264 | static char * |
| 15884 | 265 | get_conversation_title(PurpleConversation *conv, PurpleAccount *account) |
| 14612 | 266 | { |
| 15884 | 267 | return g_strdup_printf(_("%s (%s -- %s)"), purple_conversation_get_title(conv), |
| 268 | purple_account_get_username(account), purple_account_get_protocol_name(account)); | |
| 14612 | 269 | } |
| 270 | ||
| 271 | static void | |
| 15884 | 272 | update_buddy_typing(PurpleAccount *account, const char *who, gpointer null) |
| 14612 | 273 | { |
| 15884 | 274 | PurpleConversation *conv; |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15841
diff
changeset
|
275 | FinchConv *ggc; |
| 15884 | 276 | PurpleConvIm *im = NULL; |
|
15233
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14939
diff
changeset
|
277 | char *title, *str; |
| 14612 | 278 | |
| 15884 | 279 | conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, who, account); |
| 14612 | 280 | |
| 281 | if (!conv) | |
| 282 | return; | |
| 283 | ||
| 15884 | 284 | im = PURPLE_CONV_IM(conv); |
|
22339
f68309ed6c0a
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22337
diff
changeset
|
285 | ggc = FINCH_GET_DATA(conv); |
|
14750
1dad59ae254d
[gaim-migrate @ 17440]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
14620
diff
changeset
|
286 | |
| 15884 | 287 | 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
|
288 | int scroll; |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14939
diff
changeset
|
289 | str = get_conversation_title(conv, account); |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14939
diff
changeset
|
290 | title = g_strdup_printf(_("%s [%s]"), str, |
| 14612 | 291 | gnt_ascii_only() ? "T" : "\342\243\277"); |
|
15233
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14939
diff
changeset
|
292 | g_free(str); |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14939
diff
changeset
|
293 | |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14939
diff
changeset
|
294 | scroll = gnt_text_view_get_lines_below(GNT_TEXT_VIEW(ggc->tv)); |
|
22573
54822222d0cc
Patch from Kyle Turman to show the alias when available in the typing notification. Closes #4957.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22556
diff
changeset
|
295 | str = g_strdup_printf(_("\n%s is typing..."), purple_conversation_get_title(conv)); |
|
15262
8f97f9047232
[gaim-migrate @ 17990]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15250
diff
changeset
|
296 | /* 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
|
297 | 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
|
298 | 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
|
299 | str, GNT_TEXT_FLAG_DIM, "typing"); |
|
15233
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14939
diff
changeset
|
300 | g_free(str); |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14939
diff
changeset
|
301 | if (scroll <= 1) |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14939
diff
changeset
|
302 | gnt_text_view_scroll(GNT_TEXT_VIEW(ggc->tv), 0); |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14939
diff
changeset
|
303 | } else { |
| 14612 | 304 | 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
|
305 | 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
|
306 | } |
| 14612 | 307 | gnt_screen_rename_widget(ggc->window, title); |
| 308 | g_free(title); | |
| 309 | } | |
| 310 | ||
|
17076
9968d75058a4
Notify when you leave a chat, after /part or /kick.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17028
diff
changeset
|
311 | static void |
|
9968d75058a4
Notify when you leave a chat, after /part or /kick.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17028
diff
changeset
|
312 | 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
|
313 | { |
|
9968d75058a4
Notify when you leave a chat, after /part or /kick.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17028
diff
changeset
|
314 | 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
|
315 | 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
|
316 | } |
|
9968d75058a4
Notify when you leave a chat, after /part or /kick.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17028
diff
changeset
|
317 | |
|
19449
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
318 | static void |
|
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
319 | 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
|
320 | { |
|
22341
ed341c90116e
Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22339
diff
changeset
|
321 | PurpleConversation *conv = find_conv_with_contact(purple_buddy_get_account(buddy), purple_buddy_get_name(buddy)); |
|
19449
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
322 | if (conv == NULL) |
|
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
323 | return; |
|
22339
f68309ed6c0a
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22337
diff
changeset
|
324 | generate_send_to_menu(FINCH_GET_DATA(conv)); |
|
19449
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
325 | } |
|
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
326 | |
|
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
327 | static void |
|
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
328 | 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
|
329 | { |
|
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
|
330 | 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
|
331 | 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
|
332 | PurpleConversation *conv = list->data; |
|
22337
9868137b6724
Update finch to not touch the internals of PurpleConversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22336
diff
changeset
|
333 | PurpleConversation *cc = find_conv_with_contact( |
|
9868137b6724
Update finch to not touch the internals of PurpleConversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22336
diff
changeset
|
334 | purple_conversation_get_account(conv), purple_conversation_get_name(conv)); |
|
19449
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
335 | if (cc) |
|
22339
f68309ed6c0a
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22337
diff
changeset
|
336 | generate_send_to_menu(FINCH_GET_DATA(cc)); |
|
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 | 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
|
338 | } |
|
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
|
339 | |
|
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
|
340 | 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
|
341 | /* 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
|
342 | * 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
|
343 | 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
|
344 | 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
|
345 | 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
|
346 | 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
|
347 | 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
|
348 | |
|
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
|
349 | list = list->next; |
|
22337
9868137b6724
Update finch to not touch the internals of PurpleConversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22336
diff
changeset
|
350 | if (purple_conversation_get_account(conv) != purple_connection_get_account(gc) || |
|
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
|
351 | !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
|
352 | 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
|
353 | |
|
22337
9868137b6724
Update finch to not touch the internals of PurpleConversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22336
diff
changeset
|
354 | chat = find_chat_for_conversation(conv); |
|
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
|
355 | if (chat == NULL) { |
|
22336
ac905bb0a8ec
Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22335
diff
changeset
|
356 | PurplePluginProtocolInfo *info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); |
|
ac905bb0a8ec
Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22335
diff
changeset
|
357 | if (info->chat_info_defaults != NULL) |
|
22337
9868137b6724
Update finch to not touch the internals of PurpleConversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22336
diff
changeset
|
358 | comps = info->chat_info_defaults(gc, purple_conversation_get_name(conv)); |
|
20622
30e148be3e2c
Fix #104 (Reconnect to network should reconnect chats also). This has been
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20330
diff
changeset
|
359 | } else { |
|
22341
ed341c90116e
Add accessor and update finch to not touch the internals of PurpleBuddy and PurpleChat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22339
diff
changeset
|
360 | comps = purple_chat_get_components(chat); |
|
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
|
361 | } |
|
20622
30e148be3e2c
Fix #104 (Reconnect to network should reconnect chats also). This has been
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20330
diff
changeset
|
362 | 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
|
363 | 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
|
364 | 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
|
365 | } |
|
19449
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
366 | } |
|
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
367 | } |
|
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
368 | |
|
28716
97be946ff188
Rejoin an opened chat after an account reconnects.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28544
diff
changeset
|
369 | static void |
|
97be946ff188
Rejoin an opened chat after an account reconnects.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28544
diff
changeset
|
370 | account_signing_off(PurpleConnection *gc) |
|
97be946ff188
Rejoin an opened chat after an account reconnects.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28544
diff
changeset
|
371 | { |
|
97be946ff188
Rejoin an opened chat after an account reconnects.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28544
diff
changeset
|
372 | GList *list = purple_get_chats(); |
|
28729
93b39c16fb3b
Show the message only for the chats for the account signing off.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28728
diff
changeset
|
373 | PurpleAccount *account = purple_connection_get_account(gc); |
|
28716
97be946ff188
Rejoin an opened chat after an account reconnects.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28544
diff
changeset
|
374 | |
|
97be946ff188
Rejoin an opened chat after an account reconnects.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28544
diff
changeset
|
375 | /* We are about to sign off. See which chats we are currently in, and mark |
|
97be946ff188
Rejoin an opened chat after an account reconnects.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28544
diff
changeset
|
376 | * them for rejoin on reconnect. */ |
|
97be946ff188
Rejoin an opened chat after an account reconnects.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28544
diff
changeset
|
377 | while (list) { |
|
97be946ff188
Rejoin an opened chat after an account reconnects.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28544
diff
changeset
|
378 | PurpleConversation *conv = list->data; |
|
28729
93b39c16fb3b
Show the message only for the chats for the account signing off.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28728
diff
changeset
|
379 | if (!purple_conv_chat_has_left(PURPLE_CONV_CHAT(conv)) && |
|
93b39c16fb3b
Show the message only for the chats for the account signing off.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28728
diff
changeset
|
380 | purple_conversation_get_account(conv) == account) { |
|
28716
97be946ff188
Rejoin an opened chat after an account reconnects.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28544
diff
changeset
|
381 | purple_conversation_set_data(conv, "want-to-rejoin", GINT_TO_POINTER(TRUE)); |
|
97be946ff188
Rejoin an opened chat after an account reconnects.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28544
diff
changeset
|
382 | purple_conversation_write(conv, NULL, _("The account has disconnected and you are no " |
|
97be946ff188
Rejoin an opened chat after an account reconnects.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28544
diff
changeset
|
383 | "longer in this chat. You will be automatically rejoined in the chat when " |
|
97be946ff188
Rejoin an opened chat after an account reconnects.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28544
diff
changeset
|
384 | "the account reconnects."), |
|
97be946ff188
Rejoin an opened chat after an account reconnects.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28544
diff
changeset
|
385 | PURPLE_MESSAGE_SYSTEM, time(NULL)); |
|
97be946ff188
Rejoin an opened chat after an account reconnects.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28544
diff
changeset
|
386 | } |
|
97be946ff188
Rejoin an opened chat after an account reconnects.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28544
diff
changeset
|
387 | list = list->next; |
|
97be946ff188
Rejoin an opened chat after an account reconnects.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28544
diff
changeset
|
388 | } |
|
97be946ff188
Rejoin an opened chat after an account reconnects.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28544
diff
changeset
|
389 | } |
|
97be946ff188
Rejoin an opened chat after an account reconnects.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28544
diff
changeset
|
390 | |
| 14612 | 391 | static gpointer |
|
22104
56970903b8e9
Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@pidgin.im>
parents:
21859
diff
changeset
|
392 | finch_conv_get_handle(void) |
| 14612 | 393 | { |
| 394 | static int handle; | |
| 395 | return &handle; | |
| 396 | } | |
| 397 | ||
|
14072
4e64a4f18686
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14070
diff
changeset
|
398 | static void |
|
31643
805b37d317a2
Add a cleared-message-history conversation signal, and use it in Pidgin and Finch
Paul Aurich <darkrain42@pidgin.im>
parents:
31294
diff
changeset
|
399 | cleared_message_history_cb(PurpleConversation *conv, gpointer data) |
|
805b37d317a2
Add a cleared-message-history conversation signal, and use it in Pidgin and Finch
Paul Aurich <darkrain42@pidgin.im>
parents:
31294
diff
changeset
|
400 | { |
|
805b37d317a2
Add a cleared-message-history conversation signal, and use it in Pidgin and Finch
Paul Aurich <darkrain42@pidgin.im>
parents:
31294
diff
changeset
|
401 | FinchConv *ggc = FINCH_GET_DATA(conv); |
|
805b37d317a2
Add a cleared-message-history conversation signal, and use it in Pidgin and Finch
Paul Aurich <darkrain42@pidgin.im>
parents:
31294
diff
changeset
|
402 | if (ggc) |
|
805b37d317a2
Add a cleared-message-history conversation signal, and use it in Pidgin and Finch
Paul Aurich <darkrain42@pidgin.im>
parents:
31294
diff
changeset
|
403 | gnt_text_view_clear(GNT_TEXT_VIEW(ggc->tv)); |
|
805b37d317a2
Add a cleared-message-history conversation signal, and use it in Pidgin and Finch
Paul Aurich <darkrain42@pidgin.im>
parents:
31294
diff
changeset
|
404 | } |
|
805b37d317a2
Add a cleared-message-history conversation signal, and use it in Pidgin and Finch
Paul Aurich <darkrain42@pidgin.im>
parents:
31294
diff
changeset
|
405 | |
|
805b37d317a2
Add a cleared-message-history conversation signal, and use it in Pidgin and Finch
Paul Aurich <darkrain42@pidgin.im>
parents:
31294
diff
changeset
|
406 | static void |
| 16948 | 407 | clear_scrollback_cb(GntMenuItem *item, gpointer ggconv) |
| 408 | { | |
| 409 | FinchConv *ggc = ggconv; | |
|
31643
805b37d317a2
Add a cleared-message-history conversation signal, and use it in Pidgin and Finch
Paul Aurich <darkrain42@pidgin.im>
parents:
31294
diff
changeset
|
410 | purple_conversation_clear_message_history(ggc->active_conv); |
| 16948 | 411 | } |
| 412 | ||
| 413 | static void | |
| 414 | send_file_cb(GntMenuItem *item, gpointer ggconv) | |
| 415 | { | |
| 416 | FinchConv *ggc = ggconv; | |
| 417 | serv_send_file(purple_conversation_get_gc(ggc->active_conv), | |
| 418 | purple_conversation_get_name(ggc->active_conv), NULL); | |
| 419 | } | |
| 420 | ||
| 421 | static void | |
| 422 | add_pounce_cb(GntMenuItem *item, gpointer ggconv) | |
| 423 | { | |
| 424 | FinchConv *ggc = ggconv; | |
| 425 | finch_pounce_editor_show( | |
| 426 | purple_conversation_get_account(ggc->active_conv), | |
| 427 | purple_conversation_get_name(ggc->active_conv), NULL); | |
| 428 | } | |
| 429 | ||
| 430 | static void | |
| 431 | get_info_cb(GntMenuItem *item, gpointer ggconv) | |
| 432 | { | |
| 433 | FinchConv *ggc = ggconv; | |
|
17360
4b04b2ee459a
Use utility functions to get user info. Closes #964.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17164
diff
changeset
|
434 | finch_retrieve_user_info(purple_conversation_get_gc(ggc->active_conv), |
| 16948 | 435 | purple_conversation_get_name(ggc->active_conv)); |
| 436 | } | |
| 437 | ||
| 438 | static void | |
| 439 | toggle_timestamps_cb(GntMenuItem *item, gpointer ggconv) | |
| 440 | { | |
| 441 | purple_prefs_set_bool(PREF_ROOT "/timestamps", | |
| 442 | !purple_prefs_get_bool(PREF_ROOT "/timestamps")); | |
| 443 | } | |
| 444 | ||
| 445 | static void | |
|
19610
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
446 | toggle_logging_cb(GntMenuItem *item, gpointer ggconv) |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
447 | { |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
448 | FinchConv *fc = ggconv; |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
449 | PurpleConversation *conv = fc->active_conv; |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
450 | 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
|
451 | GList *iter; |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
452 | |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
453 | if (logging == purple_conversation_is_logging(conv)) |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
454 | return; |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
455 | |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
456 | /* Xerox */ |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
457 | if (logging) { |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
458 | /* 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
|
459 | purple_conversation_set_logging(conv, TRUE); |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
460 | |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
461 | purple_conversation_write(conv, NULL, |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
462 | _("Logging started. Future messages in this conversation will be logged."), |
|
22337
9868137b6724
Update finch to not touch the internals of PurpleConversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22336
diff
changeset
|
463 | PURPLE_MESSAGE_SYSTEM, time(NULL)); |
|
19610
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
464 | } else { |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
465 | purple_conversation_write(conv, NULL, |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
466 | _("Logging stopped. Future messages in this conversation will not be logged."), |
|
22337
9868137b6724
Update finch to not touch the internals of PurpleConversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22336
diff
changeset
|
467 | PURPLE_MESSAGE_SYSTEM, time(NULL)); |
|
19610
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
468 | |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
469 | /* 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
|
470 | purple_conversation_set_logging(conv, FALSE); |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
471 | } |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
472 | |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
473 | /* 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
|
474 | 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
|
475 | if (iter->data == conv) |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
476 | continue; |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
477 | purple_conversation_set_logging(iter->data, logging); |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
478 | } |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
479 | } |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
480 | |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
481 | static void |
|
19612
043dcbf3a36e
Fix #2767 (per-conversation/chat mute option).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19611
diff
changeset
|
482 | 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
|
483 | { |
|
043dcbf3a36e
Fix #2767 (per-conversation/chat mute option).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19611
diff
changeset
|
484 | 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
|
485 | 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
|
486 | 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
|
487 | if (node) |
|
7c725191167c
Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
488 | 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
|
489 | } |
|
043dcbf3a36e
Fix #2767 (per-conversation/chat mute option).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19611
diff
changeset
|
490 | |
|
043dcbf3a36e
Fix #2767 (per-conversation/chat mute option).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19611
diff
changeset
|
491 | static void |
| 16948 | 492 | send_to_cb(GntMenuItem *m, gpointer n) |
| 493 | { | |
| 494 | PurpleAccount *account = g_object_get_data(G_OBJECT(m), "purple_account"); | |
| 495 | gchar *buddy = g_object_get_data(G_OBJECT(m), "purple_buddy_name"); | |
| 496 | PurpleConversation *conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, buddy); | |
| 497 | finch_conversation_set_active(conv); | |
| 498 | } | |
| 499 | ||
| 500 | static void | |
|
22376
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22341
diff
changeset
|
501 | view_log_cb(GntMenuItem *n, gpointer ggc) |
|
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22341
diff
changeset
|
502 | { |
|
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22341
diff
changeset
|
503 | FinchConv *fc; |
|
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22341
diff
changeset
|
504 | PurpleConversation *conv; |
|
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22341
diff
changeset
|
505 | PurpleLogType type; |
|
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22341
diff
changeset
|
506 | const char *name; |
|
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22341
diff
changeset
|
507 | PurpleAccount *account; |
|
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22341
diff
changeset
|
508 | GSList *buddies; |
|
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22341
diff
changeset
|
509 | GSList *cur; |
|
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22341
diff
changeset
|
510 | |
|
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22341
diff
changeset
|
511 | fc = ggc; |
|
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22341
diff
changeset
|
512 | conv = fc->active_conv; |
|
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22341
diff
changeset
|
513 | |
|
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22341
diff
changeset
|
514 | if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) |
|
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22341
diff
changeset
|
515 | type = PURPLE_LOG_IM; |
|
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22341
diff
changeset
|
516 | else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) |
|
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22341
diff
changeset
|
517 | type = PURPLE_LOG_CHAT; |
|
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22341
diff
changeset
|
518 | else |
|
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22341
diff
changeset
|
519 | return; |
|
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22341
diff
changeset
|
520 | |
|
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22341
diff
changeset
|
521 | name = purple_conversation_get_name(conv); |
|
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22341
diff
changeset
|
522 | account = purple_conversation_get_account(conv); |
|
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22341
diff
changeset
|
523 | |
|
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22341
diff
changeset
|
524 | buddies = purple_find_buddies(account, name); |
|
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22341
diff
changeset
|
525 | for (cur = buddies; cur != NULL; cur = cur->next) { |
|
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22341
diff
changeset
|
526 | PurpleBlistNode *node = cur->data; |
|
24951
d0837696fd3a
Struct hiding for Finch. PurpleChat:alias and PurpleContact:totalsize are still used.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24456
diff
changeset
|
527 | if ((node != NULL) && |
|
d0837696fd3a
Struct hiding for Finch. PurpleChat:alias and PurpleContact:totalsize are still used.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24456
diff
changeset
|
528 | (purple_blist_node_get_sibling_prev(node) || purple_blist_node_get_sibling_next(node))) { |
|
d0837696fd3a
Struct hiding for Finch. PurpleChat:alias and PurpleContact:totalsize are still used.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24456
diff
changeset
|
529 | finch_log_show_contact((PurpleContact *)purple_blist_node_get_parent(node)); |
|
22376
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22341
diff
changeset
|
530 | g_slist_free(buddies); |
|
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22341
diff
changeset
|
531 | return; |
|
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22341
diff
changeset
|
532 | } |
|
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22341
diff
changeset
|
533 | } |
|
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22341
diff
changeset
|
534 | g_slist_free(buddies); |
|
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22341
diff
changeset
|
535 | |
|
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22341
diff
changeset
|
536 | finch_log_show(type, name, account); |
|
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22341
diff
changeset
|
537 | } |
|
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22341
diff
changeset
|
538 | |
|
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22341
diff
changeset
|
539 | static void |
| 16948 | 540 | generate_send_to_menu(FinchConv *ggc) |
| 541 | { | |
| 542 | GntWidget *sub, *menu = ggc->menu; | |
| 543 | GntMenuItem *item; | |
| 544 | GSList *buds; | |
| 545 | GList *list = NULL; | |
| 546 | ||
|
22337
9868137b6724
Update finch to not touch the internals of PurpleConversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22336
diff
changeset
|
547 | buds = purple_find_buddies(purple_conversation_get_account(ggc->active_conv), |
|
9868137b6724
Update finch to not touch the internals of PurpleConversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22336
diff
changeset
|
548 | purple_conversation_get_name(ggc->active_conv)); |
| 16948 | 549 | if (!buds) |
| 550 | return; | |
| 551 | ||
|
19449
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
552 | 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
|
553 | 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
|
554 | 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
|
555 | 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
|
556 | } |
| 16948 | 557 | sub = gnt_menu_new(GNT_MENU_POPUP); |
| 558 | gnt_menuitem_set_submenu(item, GNT_MENU(sub)); | |
| 559 | ||
|
19449
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
560 | for (; buds; buds = g_slist_delete_link(buds, buds)) { |
|
24974
a81952e9babb
Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@pidgin.im>
parents:
24951
diff
changeset
|
561 | PurpleBlistNode *node = PURPLE_BLIST_NODE(purple_buddy_get_contact(PURPLE_BUDDY(buds->data))); |
|
22334
6eec04817c0d
Add API so Finch doesn't need to touch the internals of PurpleBlistNode.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22104
diff
changeset
|
562 | for (node = purple_blist_node_get_first_child(node); node != NULL; |
|
6eec04817c0d
Add API so Finch doesn't need to touch the internals of PurpleBlistNode.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22104
diff
changeset
|
563 | node = purple_blist_node_get_sibling_next(node)) { |
| 16948 | 564 | PurpleBuddy *buddy = (PurpleBuddy *)node; |
| 565 | PurpleAccount *account = purple_buddy_get_account(buddy); | |
| 566 | if (purple_account_is_connected(account)) { | |
| 567 | /* Use the PurplePresence to get unique buddies. */ | |
| 568 | PurplePresence *presence = purple_buddy_get_presence(buddy); | |
| 569 | if (!g_list_find(list, presence)) | |
| 570 | list = g_list_prepend(list, presence); | |
| 571 | } | |
| 572 | } | |
| 573 | } | |
|
19449
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
574 | for (list = g_list_reverse(list); list != NULL; list = g_list_delete_link(list, list)) { |
| 16948 | 575 | 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
|
576 | PurpleBuddy *buddy = purple_presence_get_buddy(pre); |
| 16948 | 577 | PurpleAccount *account = purple_buddy_get_account(buddy); |
| 578 | gchar *name = g_strdup(purple_buddy_get_name(buddy)); | |
| 579 | gchar *text = g_strdup_printf("%s (%s)", purple_buddy_get_name(buddy), purple_account_get_username(account)); | |
| 580 | item = gnt_menuitem_new(text); | |
| 581 | g_free(text); | |
| 582 | gnt_menu_add_item(GNT_MENU(sub), item); | |
| 583 | gnt_menuitem_set_callback(item, send_to_cb, NULL); | |
| 584 | g_object_set_data(G_OBJECT(item), "purple_account", account); | |
| 585 | g_object_set_data_full(G_OBJECT(item), "purple_buddy_name", name, g_free); | |
| 586 | } | |
| 587 | } | |
| 588 | ||
| 589 | static void | |
|
23374
70c054708da7
Add an invite menu for chats
Richard Nelson <wabz@pidgin.im>
parents:
22840
diff
changeset
|
590 | invite_cb(GntMenuItem *item, gpointer ggconv) |
|
70c054708da7
Add an invite menu for chats
Richard Nelson <wabz@pidgin.im>
parents:
22840
diff
changeset
|
591 | { |
|
26762
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24974
diff
changeset
|
592 | FinchConv *fc = ggconv; |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24974
diff
changeset
|
593 | PurpleConversation *conv = fc->active_conv; |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24974
diff
changeset
|
594 | purple_conv_chat_invite_user(PURPLE_CONV_CHAT(conv), NULL, NULL, TRUE); |
|
23374
70c054708da7
Add an invite menu for chats
Richard Nelson <wabz@pidgin.im>
parents:
22840
diff
changeset
|
595 | } |
|
70c054708da7
Add an invite menu for chats
Richard Nelson <wabz@pidgin.im>
parents:
22840
diff
changeset
|
596 | |
|
70c054708da7
Add an invite menu for chats
Richard Nelson <wabz@pidgin.im>
parents:
22840
diff
changeset
|
597 | static void |
| 16948 | 598 | gg_create_menu(FinchConv *ggc) |
| 599 | { | |
| 600 | GntWidget *menu, *sub; | |
| 601 | GntMenuItem *item; | |
| 602 | ||
| 603 | ggc->menu = menu = gnt_menu_new(GNT_MENU_TOPLEVEL); | |
| 604 | gnt_window_set_menu(GNT_WINDOW(ggc->window), GNT_MENU(menu)); | |
| 605 | ||
| 606 | item = gnt_menuitem_new(_("Conversation")); | |
| 607 | gnt_menu_add_item(GNT_MENU(menu), item); | |
| 608 | ||
| 609 | sub = gnt_menu_new(GNT_MENU_POPUP); | |
| 610 | gnt_menuitem_set_submenu(item, GNT_MENU(sub)); | |
| 611 | ||
| 612 | item = gnt_menuitem_new(_("Clear Scrollback")); | |
| 613 | gnt_menu_add_item(GNT_MENU(sub), item); | |
| 614 | gnt_menuitem_set_callback(item, clear_scrollback_cb, ggc); | |
| 615 | ||
| 616 | item = gnt_menuitem_check_new(_("Show Timestamps")); | |
| 617 | gnt_menuitem_check_set_checked(GNT_MENU_ITEM_CHECK(item), | |
| 618 | purple_prefs_get_bool(PREF_ROOT "/timestamps")); | |
| 619 | gnt_menu_add_item(GNT_MENU(sub), item); | |
| 620 | gnt_menuitem_set_callback(item, toggle_timestamps_cb, ggc); | |
| 621 | ||
| 622 | 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
|
623 | PurpleAccount *account = purple_conversation_get_account(ggc->active_conv); |
|
22335
f6715418a9a8
Update finch to not touch the internals of PurpleAccount. This also includes a change I made to reduce the Cyclomatic Complexity of one of the functions.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22334
diff
changeset
|
624 | PurpleConnection *gc = purple_account_get_connection(account); |
|
22336
ac905bb0a8ec
Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22335
diff
changeset
|
625 | PurplePluginProtocolInfo *pinfo = |
|
ac905bb0a8ec
Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22335
diff
changeset
|
626 | gc ? PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)) : NULL; |
|
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
|
627 | |
|
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
|
628 | 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
|
629 | 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
|
630 | 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
|
631 | 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
|
632 | } |
| 16948 | 633 | |
| 634 | item = gnt_menuitem_new(_("Add Buddy Pounce...")); | |
| 635 | gnt_menu_add_item(GNT_MENU(sub), item); | |
| 636 | gnt_menuitem_set_callback(item, add_pounce_cb, ggc); | |
| 637 | ||
|
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
|
638 | 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
|
639 | (!pinfo->can_receive_file || |
|
22335
f6715418a9a8
Update finch to not touch the internals of PurpleAccount. This also includes a change I made to reduce the Cyclomatic Complexity of one of the functions.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22334
diff
changeset
|
640 | pinfo->can_receive_file(gc, purple_conversation_get_name(ggc->active_conv)))) { |
|
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
|
641 | 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
|
642 | 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
|
643 | 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
|
644 | } |
| 16948 | 645 | |
| 646 | generate_send_to_menu(ggc); | |
|
23374
70c054708da7
Add an invite menu for chats
Richard Nelson <wabz@pidgin.im>
parents:
22840
diff
changeset
|
647 | } else if (purple_conversation_get_type(ggc->active_conv) == PURPLE_CONV_TYPE_CHAT) { |
|
70c054708da7
Add an invite menu for chats
Richard Nelson <wabz@pidgin.im>
parents:
22840
diff
changeset
|
648 | item = gnt_menuitem_new(_("Invite...")); |
|
70c054708da7
Add an invite menu for chats
Richard Nelson <wabz@pidgin.im>
parents:
22840
diff
changeset
|
649 | gnt_menu_add_item(GNT_MENU(sub), item); |
|
70c054708da7
Add an invite menu for chats
Richard Nelson <wabz@pidgin.im>
parents:
22840
diff
changeset
|
650 | gnt_menuitem_set_callback(item, invite_cb, ggc); |
| 16948 | 651 | } |
|
19610
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
652 | |
|
22376
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22341
diff
changeset
|
653 | item = gnt_menuitem_new(_("View Log...")); |
|
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22341
diff
changeset
|
654 | gnt_menu_add_item(GNT_MENU(sub), item); |
|
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22341
diff
changeset
|
655 | gnt_menuitem_set_callback(item, view_log_cb, ggc); |
|
25a17b6b69c2
Add a finch log viewer. This is largely copied from Pidgin.
Richard Nelson <wabz@pidgin.im>
parents:
22341
diff
changeset
|
656 | |
|
19610
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
657 | item = gnt_menuitem_check_new(_("Enable Logging")); |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
658 | 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
|
659 | purple_conversation_is_logging(ggc->active_conv)); |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
660 | 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
|
661 | 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
|
662 | |
|
043dcbf3a36e
Fix #2767 (per-conversation/chat mute option).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19611
diff
changeset
|
663 | 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
|
664 | 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
|
665 | !(ggc->flags & FINCH_CONV_NO_SOUND)); |
|
043dcbf3a36e
Fix #2767 (per-conversation/chat mute option).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19611
diff
changeset
|
666 | 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
|
667 | gnt_menuitem_set_callback(item, toggle_sound_cb, ggc); |
| 16948 | 668 | } |
| 669 | ||
| 670 | 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
|
671 | 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
|
672 | { |
|
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
673 | PurpleAccount *account = purple_conversation_get_account(fc->active_conv); |
|
28728
0e157b00c8d2
Fix creating a conversation with a user in a chatroom from the userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28716
diff
changeset
|
674 | PurpleConnection *gc = purple_account_get_connection(account); |
|
0e157b00c8d2
Fix creating a conversation with a user in a chatroom from the userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28716
diff
changeset
|
675 | PurplePluginProtocolInfo *prpl_info = NULL; |
|
0e157b00c8d2
Fix creating a conversation with a user in a chatroom from the userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28716
diff
changeset
|
676 | char *name, *realname; |
|
0e157b00c8d2
Fix creating a conversation with a user in a chatroom from the userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28716
diff
changeset
|
677 | |
|
0e157b00c8d2
Fix creating a conversation with a user in a chatroom from the userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28716
diff
changeset
|
678 | if (!gc) { |
|
0e157b00c8d2
Fix creating a conversation with a user in a chatroom from the userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28716
diff
changeset
|
679 | purple_conversation_write(fc->active_conv, NULL, _("You are not connected."), |
|
0e157b00c8d2
Fix creating a conversation with a user in a chatroom from the userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28716
diff
changeset
|
680 | PURPLE_MESSAGE_SYSTEM, time(NULL)); |
|
0e157b00c8d2
Fix creating a conversation with a user in a chatroom from the userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28716
diff
changeset
|
681 | return; |
|
0e157b00c8d2
Fix creating a conversation with a user in a chatroom from the userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28716
diff
changeset
|
682 | } |
|
0e157b00c8d2
Fix creating a conversation with a user in a chatroom from the userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28716
diff
changeset
|
683 | |
|
0e157b00c8d2
Fix creating a conversation with a user in a chatroom from the userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28716
diff
changeset
|
684 | name = gnt_tree_get_selection_data(GNT_TREE(widget)); |
|
0e157b00c8d2
Fix creating a conversation with a user in a chatroom from the userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28716
diff
changeset
|
685 | |
|
0e157b00c8d2
Fix creating a conversation with a user in a chatroom from the userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28716
diff
changeset
|
686 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); |
|
0e157b00c8d2
Fix creating a conversation with a user in a chatroom from the userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28716
diff
changeset
|
687 | if (prpl_info && PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, get_cb_real_name)) |
|
0e157b00c8d2
Fix creating a conversation with a user in a chatroom from the userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28716
diff
changeset
|
688 | realname = prpl_info->get_cb_real_name(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(fc->active_conv)), name); |
|
0e157b00c8d2
Fix creating a conversation with a user in a chatroom from the userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28716
diff
changeset
|
689 | else |
|
0e157b00c8d2
Fix creating a conversation with a user in a chatroom from the userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28716
diff
changeset
|
690 | realname = NULL; |
|
0e157b00c8d2
Fix creating a conversation with a user in a chatroom from the userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28716
diff
changeset
|
691 | purple_conversation_new(PURPLE_CONV_TYPE_IM, account, realname ? realname : name); |
|
0e157b00c8d2
Fix creating a conversation with a user in a chatroom from the userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28716
diff
changeset
|
692 | g_free(realname); |
|
16949
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
693 | } |
|
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
694 | |
|
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
695 | 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
|
696 | 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
|
697 | { |
|
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
|
698 | 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
|
699 | 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
|
700 | 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
|
701 | 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
|
702 | } |
|
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
|
703 | } |
|
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
|
704 | |
|
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
|
705 | 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
|
706 | 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
|
707 | { |
|
39647
50ac98a0ecb1
Use gnt_*_get_text accessors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39644
diff
changeset
|
708 | if (start == gnt_entry_get_text(entry) && *start != '/') |
|
18423
83cabde8668d
Use the completion-signal to append a ': ' after a tab-completed nick.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18305
diff
changeset
|
709 | 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
|
710 | } |
|
83cabde8668d
Use the completion-signal to append a ': ' after a tab-completed nick.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18305
diff
changeset
|
711 | |
|
83cabde8668d
Use the completion-signal to append a ': ' after a tab-completed nick.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18305
diff
changeset
|
712 | static void |
|
23556
33eca6f632b9
Tab-completion for commands in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23503
diff
changeset
|
713 | gg_setup_commands(FinchConv *fconv, gboolean remove_first) |
|
33eca6f632b9
Tab-completion for commands in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23503
diff
changeset
|
714 | { |
|
33eca6f632b9
Tab-completion for commands in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23503
diff
changeset
|
715 | GList *commands; |
|
33eca6f632b9
Tab-completion for commands in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23503
diff
changeset
|
716 | char command[256] = "/"; |
|
33eca6f632b9
Tab-completion for commands in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23503
diff
changeset
|
717 | |
|
33eca6f632b9
Tab-completion for commands in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23503
diff
changeset
|
718 | if (remove_first) { |
|
33eca6f632b9
Tab-completion for commands in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23503
diff
changeset
|
719 | commands = purple_cmd_list(NULL); |
|
33eca6f632b9
Tab-completion for commands in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23503
diff
changeset
|
720 | for (; commands; commands = g_list_delete_link(commands, commands)) { |
|
33eca6f632b9
Tab-completion for commands in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23503
diff
changeset
|
721 | g_strlcpy(command + 1, commands->data, sizeof(command) - 1); |
|
33eca6f632b9
Tab-completion for commands in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23503
diff
changeset
|
722 | gnt_entry_remove_suggest(GNT_ENTRY(fconv->entry), command); |
|
33eca6f632b9
Tab-completion for commands in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23503
diff
changeset
|
723 | } |
|
33eca6f632b9
Tab-completion for commands in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23503
diff
changeset
|
724 | } |
|
33eca6f632b9
Tab-completion for commands in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23503
diff
changeset
|
725 | |
|
33eca6f632b9
Tab-completion for commands in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23503
diff
changeset
|
726 | commands = purple_cmd_list(fconv->active_conv); |
|
33eca6f632b9
Tab-completion for commands in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23503
diff
changeset
|
727 | for (; commands; commands = g_list_delete_link(commands, commands)) { |
|
33eca6f632b9
Tab-completion for commands in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23503
diff
changeset
|
728 | g_strlcpy(command + 1, commands->data, sizeof(command) - 1); |
|
33eca6f632b9
Tab-completion for commands in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23503
diff
changeset
|
729 | gnt_entry_add_suggest(GNT_ENTRY(fconv->entry), command); |
|
33eca6f632b9
Tab-completion for commands in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23503
diff
changeset
|
730 | } |
|
33eca6f632b9
Tab-completion for commands in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23503
diff
changeset
|
731 | } |
|
33eca6f632b9
Tab-completion for commands in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23503
diff
changeset
|
732 | |
|
33eca6f632b9
Tab-completion for commands in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23503
diff
changeset
|
733 | static void |
|
33eca6f632b9
Tab-completion for commands in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23503
diff
changeset
|
734 | cmd_added_cb(const char *cmd, PurpleCmdPriority prior, PurpleCmdFlag flags, |
|
33eca6f632b9
Tab-completion for commands in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23503
diff
changeset
|
735 | FinchConv *fconv) |
|
33eca6f632b9
Tab-completion for commands in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23503
diff
changeset
|
736 | { |
|
33eca6f632b9
Tab-completion for commands in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23503
diff
changeset
|
737 | gg_setup_commands(fconv, TRUE); |
|
33eca6f632b9
Tab-completion for commands in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23503
diff
changeset
|
738 | } |
|
33eca6f632b9
Tab-completion for commands in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23503
diff
changeset
|
739 | |
|
33eca6f632b9
Tab-completion for commands in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23503
diff
changeset
|
740 | static void |
|
33eca6f632b9
Tab-completion for commands in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23503
diff
changeset
|
741 | cmd_removed_cb(const char *cmd, FinchConv *fconv) |
|
33eca6f632b9
Tab-completion for commands in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23503
diff
changeset
|
742 | { |
|
33eca6f632b9
Tab-completion for commands in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23503
diff
changeset
|
743 | char command[256] = "/"; |
|
33eca6f632b9
Tab-completion for commands in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23503
diff
changeset
|
744 | g_strlcpy(command + 1, cmd, sizeof(command) - 1); |
|
33eca6f632b9
Tab-completion for commands in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23503
diff
changeset
|
745 | gnt_entry_remove_suggest(GNT_ENTRY(fconv->entry), command); |
|
33eca6f632b9
Tab-completion for commands in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23503
diff
changeset
|
746 | gg_setup_commands(fconv, TRUE); |
|
33eca6f632b9
Tab-completion for commands in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23503
diff
changeset
|
747 | } |
|
33eca6f632b9
Tab-completion for commands in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23503
diff
changeset
|
748 | |
|
33eca6f632b9
Tab-completion for commands in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23503
diff
changeset
|
749 | static void |
| 15884 | 750 | finch_create_conversation(PurpleConversation *conv) |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
751 | { |
|
22339
f68309ed6c0a
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22337
diff
changeset
|
752 | FinchConv *ggc = FINCH_GET_DATA(conv); |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
753 | char *title; |
| 15884 | 754 | PurpleConversationType type; |
| 755 | PurpleConversation *cc; | |
| 756 | PurpleAccount *account; | |
|
19986
7c725191167c
Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
757 | PurpleBlistNode *convnode = NULL; |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
758 | |
|
22556
dc08052dcac2
Make sure an existing conversation selected from the 'Send IM' dialog is given the focus.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22410
diff
changeset
|
759 | if (ggc) { |
|
dc08052dcac2
Make sure an existing conversation selected from the 'Send IM' dialog is given the focus.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22410
diff
changeset
|
760 | gnt_window_present(ggc->window); |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
761 | return; |
|
22556
dc08052dcac2
Make sure an existing conversation selected from the 'Send IM' dialog is given the focus.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22410
diff
changeset
|
762 | } |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
763 | |
|
22337
9868137b6724
Update finch to not touch the internals of PurpleConversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22336
diff
changeset
|
764 | account = purple_conversation_get_account(conv); |
|
9868137b6724
Update finch to not touch the internals of PurpleConversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22336
diff
changeset
|
765 | cc = find_conv_with_contact(account, purple_conversation_get_name(conv)); |
|
22339
f68309ed6c0a
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22337
diff
changeset
|
766 | if (cc && FINCH_GET_DATA(cc)) |
|
f68309ed6c0a
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22337
diff
changeset
|
767 | ggc = FINCH_GET_DATA(cc); |
|
14450
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
768 | else |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15841
diff
changeset
|
769 | ggc = g_new0(FinchConv, 1); |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
770 | |
|
19610
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
771 | /* 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
|
772 | if (ggc->list) { |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
773 | purple_conversation_set_logging(conv, |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
774 | purple_conversation_is_logging(ggc->list->data)); |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
775 | } |
|
0663ae14e7c5
Separate logging support for each conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
776 | |
|
14450
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
777 | ggc->list = g_list_prepend(ggc->list, conv); |
|
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
778 | ggc->active_conv = conv; |
|
22339
f68309ed6c0a
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22337
diff
changeset
|
779 | FINCH_SET_DATA(conv, ggc); |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
780 | |
|
22840
7a5dbaf5a914
Fix a crash which I think happens when the same buddy is in the buddylist
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22573
diff
changeset
|
781 | if (cc && FINCH_GET_DATA(cc) && cc != conv) { |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15841
diff
changeset
|
782 | finch_conversation_set_active(conv); |
|
14450
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
783 | return; |
|
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
784 | } |
|
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
785 | |
| 15884 | 786 | type = purple_conversation_get_type(conv); |
| 14612 | 787 | title = get_conversation_title(conv, account); |
| 788 | ||
| 16948 | 789 | ggc->window = gnt_vwindow_new(FALSE); |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
790 | gnt_box_set_title(GNT_BOX(ggc->window), title); |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
791 | gnt_box_set_toplevel(GNT_BOX(ggc->window), TRUE); |
|
13978
70d7030b7f26
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13969
diff
changeset
|
792 | 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
|
793 | |
|
22337
9868137b6724
Update finch to not touch the internals of PurpleConversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22336
diff
changeset
|
794 | switch (purple_conversation_get_type(conv)) { |
|
18305
7301814a6124
Plucked revision from finchfeat to give different names to windows for
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18301
diff
changeset
|
795 | 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
|
796 | 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
|
797 | break; |
|
7301814a6124
Plucked revision from finchfeat to give different names to windows for
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18301
diff
changeset
|
798 | 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
|
799 | 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
|
800 | break; |
|
7301814a6124
Plucked revision from finchfeat to give different names to windows for
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18301
diff
changeset
|
801 | 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
|
802 | 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
|
803 | break; |
|
7301814a6124
Plucked revision from finchfeat to give different names to windows for
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18301
diff
changeset
|
804 | 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
|
805 | 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
|
806 | break; |
|
7301814a6124
Plucked revision from finchfeat to give different names to windows for
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18301
diff
changeset
|
807 | 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
|
808 | 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
|
809 | break; |
|
7301814a6124
Plucked revision from finchfeat to give different names to windows for
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18301
diff
changeset
|
810 | } |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
811 | |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
812 | ggc->tv = gnt_text_view_new(); |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
813 | gnt_widget_set_name(ggc->tv, "conversation-window-textview"); |
| 15884 | 814 | gnt_widget_set_size(ggc->tv, purple_prefs_get_int(PREF_ROOT "/size/width"), |
| 815 | purple_prefs_get_int(PREF_ROOT "/size/height")); | |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
816 | |
|
16949
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
817 | 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
|
818 | 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
|
819 | 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
|
820 | 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
|
821 | 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
|
822 | 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
|
823 | 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
|
824 | 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
|
825 | 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
|
826 | gnt_tree_set_search_column(GNT_TREE(tree), 1); |
|
39644
54ed9db5e2ff
Use GntWidget flag accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38259
diff
changeset
|
827 | gnt_widget_set_has_border(tree, FALSE); |
|
16949
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
828 | 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
|
829 | 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
|
830 | 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
|
831 | 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
|
832 | 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
|
833 | } else { |
|
19449
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
834 | 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
|
835 | 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
|
836 | } |
|
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
837 | |
|
16190
435e34f11655
Allow adding information widgets in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16186
diff
changeset
|
838 | 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
|
839 | 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
|
840 | |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
841 | ggc->entry = gnt_entry_new(NULL); |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
842 | gnt_box_add_widget(GNT_BOX(ggc->window), ggc->entry); |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
843 | gnt_widget_set_name(ggc->entry, "conversation-window-entry"); |
|
14153
9da98052a4e1
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14122
diff
changeset
|
844 | gnt_entry_set_history_length(GNT_ENTRY(ggc->entry), -1); |
|
9da98052a4e1
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14122
diff
changeset
|
845 | gnt_entry_set_word_suggest(GNT_ENTRY(ggc->entry), TRUE); |
|
9da98052a4e1
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14122
diff
changeset
|
846 | gnt_entry_set_always_suggest(GNT_ENTRY(ggc->entry), FALSE); |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
847 | |
|
16186
73cb5b43aaf9
Add a utility function to assist scrolling in a textview.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15931
diff
changeset
|
848 | 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
|
849 | 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
|
850 | |
|
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
|
851 | 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
|
852 | 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
|
853 | 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
|
854 | |
| 15884 | 855 | gnt_widget_set_position(ggc->window, purple_prefs_get_int(PREF_ROOT "/position/x"), |
| 856 | purple_prefs_get_int(PREF_ROOT "/position/y")); | |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
857 | gnt_widget_show(ggc->window); |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
858 | |
|
14072
4e64a4f18686
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14070
diff
changeset
|
859 | 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
|
860 | 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
|
861 | |
| 15884 | 862 | 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
|
863 | 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
|
864 | } |
| 14612 | 865 | |
|
19986
7c725191167c
Remember the 'Enable Sounds' setting for a conversation. Closes #312.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
866 | 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
|
867 | 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
|
868 | !finch_sound_is_enabled()) |
|
19612
043dcbf3a36e
Fix #2767 (per-conversation/chat mute option).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19611
diff
changeset
|
869 | ggc->flags |= FINCH_CONV_NO_SOUND; |
|
043dcbf3a36e
Fix #2767 (per-conversation/chat mute option).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19611
diff
changeset
|
870 | |
|
19449
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
871 | gg_create_menu(ggc); |
|
23556
33eca6f632b9
Tab-completion for commands in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23503
diff
changeset
|
872 | gg_setup_commands(ggc, FALSE); |
|
33eca6f632b9
Tab-completion for commands in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23503
diff
changeset
|
873 | |
|
33eca6f632b9
Tab-completion for commands in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23503
diff
changeset
|
874 | purple_signal_connect(purple_cmds_get_handle(), "cmd-added", ggc, |
|
33eca6f632b9
Tab-completion for commands in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23503
diff
changeset
|
875 | G_CALLBACK(cmd_added_cb), ggc); |
|
33eca6f632b9
Tab-completion for commands in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23503
diff
changeset
|
876 | purple_signal_connect(purple_cmds_get_handle(), "cmd-removed", ggc, |
|
33eca6f632b9
Tab-completion for commands in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23503
diff
changeset
|
877 | G_CALLBACK(cmd_removed_cb), ggc); |
|
19449
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
878 | |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
879 | 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
|
880 | 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
|
881 | 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
|
882 | } |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
883 | |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
884 | static void |
| 15884 | 885 | finch_destroy_conversation(PurpleConversation *conv) |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
886 | { |
|
14450
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
887 | /* do stuff here */ |
|
22339
f68309ed6c0a
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22337
diff
changeset
|
888 | FinchConv *ggc = FINCH_GET_DATA(conv); |
|
14450
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
889 | ggc->list = g_list_remove(ggc->list, conv); |
|
23556
33eca6f632b9
Tab-completion for commands in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23503
diff
changeset
|
890 | if (ggc->list && conv == ggc->active_conv) { |
|
14450
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
891 | ggc->active_conv = ggc->list->data; |
|
23556
33eca6f632b9
Tab-completion for commands in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23503
diff
changeset
|
892 | gg_setup_commands(ggc, TRUE); |
|
33eca6f632b9
Tab-completion for commands in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23503
diff
changeset
|
893 | } |
|
33eca6f632b9
Tab-completion for commands in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23503
diff
changeset
|
894 | |
|
14450
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
895 | 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
|
896 | g_free(ggc->u.chat); |
|
23556
33eca6f632b9
Tab-completion for commands in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23503
diff
changeset
|
897 | purple_signals_disconnect_by_handle(ggc); |
|
18301
1988607deed3
Fix a few runtime warnings.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18273
diff
changeset
|
898 | if (ggc->window) |
|
1988607deed3
Fix a few runtime warnings.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18273
diff
changeset
|
899 | gnt_widget_destroy(ggc->window); |
|
14450
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
900 | g_free(ggc); |
|
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
901 | } |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
902 | } |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
903 | |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
904 | static void |
| 15884 | 905 | finch_write_common(PurpleConversation *conv, const char *who, const char *message, |
| 906 | PurpleMessageFlags flags, time_t mtime) | |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
907 | { |
|
22339
f68309ed6c0a
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22337
diff
changeset
|
908 | FinchConv *ggconv = FINCH_GET_DATA(conv); |
|
14073
db4207d73bd7
[gaim-migrate @ 16603]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14072
diff
changeset
|
909 | char *strip, *newline; |
|
13993
8c12e7d15b40
[gaim-migrate @ 16458]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13989
diff
changeset
|
910 | GntTextFormatFlags fl = 0; |
|
14092
191e12cbe464
[gaim-migrate @ 16632]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
911 | int pos; |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
912 | |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
913 | g_return_if_fail(ggconv != NULL); |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
914 | |
|
24456
fa1be35a86da
Set the urgent flag for conversation windows on receiving a /buzz etc.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24103
diff
changeset
|
915 | if ((flags & PURPLE_MESSAGE_SYSTEM) && !(flags & PURPLE_MESSAGE_NOTIFY)) { |
|
22410
6d2a5d806cc6
Ignore the recv/send flags when the system flag is set for a message.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22409
diff
changeset
|
916 | flags &= ~(PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_RECV); |
|
6d2a5d806cc6
Ignore the recv/send flags when the system flag is set for a message.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22409
diff
changeset
|
917 | } |
|
6d2a5d806cc6
Ignore the recv/send flags when the system flag is set for a message.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22409
diff
changeset
|
918 | |
|
14450
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
919 | if (ggconv->active_conv != conv) { |
| 15884 | 920 | if (flags & (PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_RECV)) |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15841
diff
changeset
|
921 | finch_conversation_set_active(conv); |
|
14450
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
922 | else |
|
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
923 | return; |
|
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
924 | } |
|
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
925 | |
|
14284
6c99565d0f50
[gaim-migrate @ 16903]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14253
diff
changeset
|
926 | 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
|
927 | |
|
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
|
928 | 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
|
929 | 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
|
930 | |
|
14296
ac12fbad24f7
[gaim-migrate @ 16916]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14284
diff
changeset
|
931 | /* Unnecessary to print the timestamp for delayed message */ |
|
27759
e984405d8ae8
Show the current time if the timestamp is zero.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27699
diff
changeset
|
932 | if (purple_prefs_get_bool("/finch/conversations/timestamps")) { |
|
e984405d8ae8
Show the current time if the timestamp is zero.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27699
diff
changeset
|
933 | if (!mtime) |
|
e984405d8ae8
Show the current time if the timestamp is zero.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27699
diff
changeset
|
934 | time(&mtime); |
|
14122
daf2aaa61829
[gaim-migrate @ 16678]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
935 | gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv), |
|
21855
fc93ce6595e4
Add color to the conversation window to indicate various message attributes
Richard Nelson <wabz@pidgin.im>
parents:
21453
diff
changeset
|
936 | purple_utf8_strftime("(%H:%M:%S)", localtime(&mtime)), gnt_color_pair(color_timestamp)); |
|
27759
e984405d8ae8
Show the current time if the timestamp is zero.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27699
diff
changeset
|
937 | } |
|
21855
fc93ce6595e4
Add color to the conversation window to indicate various message attributes
Richard Nelson <wabz@pidgin.im>
parents:
21453
diff
changeset
|
938 | |
|
fc93ce6595e4
Add color to the conversation window to indicate various message attributes
Richard Nelson <wabz@pidgin.im>
parents:
21453
diff
changeset
|
939 | gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv), " ", GNT_TEXT_FLAG_NORMAL); |
|
14427
8af0c81db5b9
[gaim-migrate @ 17071]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14413
diff
changeset
|
940 | |
| 15884 | 941 | if (flags & PURPLE_MESSAGE_AUTO_RESP) |
|
14483
82b73e12ce27
[gaim-migrate @ 17129]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14470
diff
changeset
|
942 | 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
|
943 | _("<AUTO-REPLY> "), GNT_TEXT_FLAG_BOLD); |
|
82b73e12ce27
[gaim-migrate @ 17129]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14470
diff
changeset
|
944 | |
|
20625
de0fcfa2bbc1
Show 'buzz'/'nudge' etc. messages differently from regular messages.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20622
diff
changeset
|
945 | 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
|
946 | !(flags & PURPLE_MESSAGE_NOTIFY)) |
|
13959
49d3a87c2679
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13958
diff
changeset
|
947 | { |
|
14427
8af0c81db5b9
[gaim-migrate @ 17071]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14413
diff
changeset
|
948 | char * name = NULL; |
|
21859
5107469829ef
Do not append ':' after expanding a /me.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
949 | GntTextFormatFlags msgflags = GNT_TEXT_FLAG_NORMAL; |
|
5107469829ef
Do not append ':' after expanding a /me.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
950 | gboolean me = FALSE; |
|
14427
8af0c81db5b9
[gaim-migrate @ 17071]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14413
diff
changeset
|
951 | |
|
21855
fc93ce6595e4
Add color to the conversation window to indicate various message attributes
Richard Nelson <wabz@pidgin.im>
parents:
21453
diff
changeset
|
952 | if (purple_message_meify((char*)message, -1)) { |
|
fc93ce6595e4
Add color to the conversation window to indicate various message attributes
Richard Nelson <wabz@pidgin.im>
parents:
21453
diff
changeset
|
953 | name = g_strdup_printf("*** %s", who); |
|
22409
64d529e825cd
Highlighted message color has a higher priority over an action message color.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22376
diff
changeset
|
954 | if (!(flags & PURPLE_MESSAGE_SEND) && |
|
64d529e825cd
Highlighted message color has a higher priority over an action message color.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22376
diff
changeset
|
955 | (flags & PURPLE_MESSAGE_NICK)) |
|
64d529e825cd
Highlighted message color has a higher priority over an action message color.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22376
diff
changeset
|
956 | msgflags = gnt_color_pair(color_message_highlight); |
|
64d529e825cd
Highlighted message color has a higher priority over an action message color.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22376
diff
changeset
|
957 | else |
|
64d529e825cd
Highlighted message color has a higher priority over an action message color.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22376
diff
changeset
|
958 | msgflags = gnt_color_pair(color_message_action); |
|
21859
5107469829ef
Do not append ':' after expanding a /me.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
959 | me = TRUE; |
|
21855
fc93ce6595e4
Add color to the conversation window to indicate various message attributes
Richard Nelson <wabz@pidgin.im>
parents:
21453
diff
changeset
|
960 | } else { |
|
fc93ce6595e4
Add color to the conversation window to indicate various message attributes
Richard Nelson <wabz@pidgin.im>
parents:
21453
diff
changeset
|
961 | name = g_strdup_printf("%s", who); |
|
fc93ce6595e4
Add color to the conversation window to indicate various message attributes
Richard Nelson <wabz@pidgin.im>
parents:
21453
diff
changeset
|
962 | if (flags & PURPLE_MESSAGE_SEND) |
|
21859
5107469829ef
Do not append ':' after expanding a /me.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
963 | msgflags = gnt_color_pair(color_message_send); |
|
5107469829ef
Do not append ':' after expanding a /me.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
964 | else if (flags & PURPLE_MESSAGE_NICK) |
|
5107469829ef
Do not append ':' after expanding a /me.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
965 | msgflags = gnt_color_pair(color_message_highlight); |
|
21855
fc93ce6595e4
Add color to the conversation window to indicate various message attributes
Richard Nelson <wabz@pidgin.im>
parents:
21453
diff
changeset
|
966 | else |
|
21859
5107469829ef
Do not append ':' after expanding a /me.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
967 | msgflags = gnt_color_pair(color_message_receive); |
|
21855
fc93ce6595e4
Add color to the conversation window to indicate various message attributes
Richard Nelson <wabz@pidgin.im>
parents:
21453
diff
changeset
|
968 | } |
|
21859
5107469829ef
Do not append ':' after expanding a /me.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
969 | gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv), |
|
5107469829ef
Do not append ':' after expanding a /me.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
970 | name, msgflags); |
|
5107469829ef
Do not append ':' after expanding a /me.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21855
diff
changeset
|
971 | gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv), me ? " " : ": ", GNT_TEXT_FLAG_NORMAL); |
|
13959
49d3a87c2679
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13958
diff
changeset
|
972 | g_free(name); |
|
21855
fc93ce6595e4
Add color to the conversation window to indicate various message attributes
Richard Nelson <wabz@pidgin.im>
parents:
21453
diff
changeset
|
973 | } else |
|
13959
49d3a87c2679
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13958
diff
changeset
|
974 | fl = GNT_TEXT_FLAG_DIM; |
|
49d3a87c2679
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13958
diff
changeset
|
975 | |
| 15884 | 976 | if (flags & PURPLE_MESSAGE_ERROR) |
|
13959
49d3a87c2679
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13958
diff
changeset
|
977 | fl |= GNT_TEXT_FLAG_BOLD; |
|
49d3a87c2679
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13958
diff
changeset
|
978 | |
|
14073
db4207d73bd7
[gaim-migrate @ 16603]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14072
diff
changeset
|
979 | /* XXX: Remove this workaround when textview can parse messages. */ |
| 15884 | 980 | newline = purple_strdup_withhtml(message); |
| 981 | strip = purple_markup_strip_html(newline); | |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
982 | 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
|
983 | strip, fl); |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
984 | |
|
14073
db4207d73bd7
[gaim-migrate @ 16603]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14072
diff
changeset
|
985 | g_free(newline); |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
986 | g_free(strip); |
|
13959
49d3a87c2679
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13958
diff
changeset
|
987 | |
|
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
|
988 | 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
|
989 | purple_conv_im_get_typing_state(PURPLE_CONV_IM(conv)) == PURPLE_TYPING) { |
|
22573
54822222d0cc
Patch from Kyle Turman to show the alias when available in the typing notification. Closes #4957.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22556
diff
changeset
|
990 | strip = g_strdup_printf(_("\n%s is typing..."), purple_conversation_get_title(conv)); |
|
15233
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14939
diff
changeset
|
991 | 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
|
992 | strip, GNT_TEXT_FLAG_DIM, "typing"); |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14939
diff
changeset
|
993 | g_free(strip); |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14939
diff
changeset
|
994 | } |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14939
diff
changeset
|
995 | |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14939
diff
changeset
|
996 | if (pos <= 1) |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14939
diff
changeset
|
997 | gnt_text_view_scroll(GNT_TEXT_VIEW(ggconv->tv), 0); |
|
fdd9e78534ad
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14939
diff
changeset
|
998 | |
| 15884 | 999 | 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
|
1000 | 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
|
1001 | 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
|
1002 | 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
|
1003 | 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
|
1004 | 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
|
1005 | } |
|
13959
49d3a87c2679
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13958
diff
changeset
|
1006 | } |
|
49d3a87c2679
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13958
diff
changeset
|
1007 | |
|
49d3a87c2679
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13958
diff
changeset
|
1008 | static void |
| 15884 | 1009 | finch_write_chat(PurpleConversation *conv, const char *who, const char *message, |
| 1010 | PurpleMessageFlags flags, time_t mtime) | |
|
13959
49d3a87c2679
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13958
diff
changeset
|
1011 | { |
| 15884 | 1012 | purple_conversation_write(conv, who, message, flags, mtime); |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1013 | } |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1014 | |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1015 | static void |
| 15884 | 1016 | finch_write_im(PurpleConversation *conv, const char *who, const char *message, |
| 1017 | PurpleMessageFlags flags, time_t mtime) | |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1018 | { |
| 15884 | 1019 | PurpleAccount *account = purple_conversation_get_account(conv); |
| 1020 | if (flags & PURPLE_MESSAGE_SEND) | |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1021 | { |
| 15884 | 1022 | 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
|
1023 | if (!who) |
| 15884 | 1024 | who = purple_account_get_alias(account); |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1025 | if (!who) |
| 15884 | 1026 | who = purple_account_get_username(account); |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1027 | } |
| 15884 | 1028 | else if (flags & PURPLE_MESSAGE_RECV) |
| 14070 | 1029 | { |
| 15884 | 1030 | PurpleBuddy *buddy; |
| 1031 | who = purple_conversation_get_name(conv); | |
| 1032 | buddy = purple_find_buddy(account, who); | |
| 14070 | 1033 | if (buddy) |
| 15884 | 1034 | who = purple_buddy_get_contact_alias(buddy); |
| 14070 | 1035 | } |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1036 | |
| 15884 | 1037 | purple_conversation_write(conv, who, message, flags, mtime); |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1038 | } |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1039 | |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1040 | static void |
| 15884 | 1041 | finch_write_conv(PurpleConversation *conv, const char *who, const char *alias, |
| 1042 | const char *message, PurpleMessageFlags flags, time_t mtime) | |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1043 | { |
|
13959
49d3a87c2679
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13958
diff
changeset
|
1044 | const char *name; |
|
49d3a87c2679
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13958
diff
changeset
|
1045 | if (alias && *alias) |
|
49d3a87c2679
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13958
diff
changeset
|
1046 | name = alias; |
|
49d3a87c2679
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13958
diff
changeset
|
1047 | else if (who && *who) |
|
49d3a87c2679
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13958
diff
changeset
|
1048 | name = who; |
|
49d3a87c2679
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13958
diff
changeset
|
1049 | else |
|
49d3a87c2679
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13958
diff
changeset
|
1050 | name = NULL; |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1051 | |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15841
diff
changeset
|
1052 | finch_write_common(conv, name, message, flags, mtime); |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1053 | } |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1054 | |
|
17115
7295bc64f5fa
Show user flags in chat userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17076
diff
changeset
|
1055 | static const char * |
|
7295bc64f5fa
Show user flags in chat userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17076
diff
changeset
|
1056 | chat_flag_text(PurpleConvChatBuddyFlags flags) |
|
7295bc64f5fa
Show user flags in chat userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17076
diff
changeset
|
1057 | { |
|
7295bc64f5fa
Show user flags in chat userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17076
diff
changeset
|
1058 | if (flags & PURPLE_CBFLAGS_FOUNDER) |
|
7295bc64f5fa
Show user flags in chat userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17076
diff
changeset
|
1059 | return "~"; |
|
7295bc64f5fa
Show user flags in chat userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17076
diff
changeset
|
1060 | if (flags & PURPLE_CBFLAGS_OP) |
|
7295bc64f5fa
Show user flags in chat userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17076
diff
changeset
|
1061 | return "@"; |
|
7295bc64f5fa
Show user flags in chat userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17076
diff
changeset
|
1062 | if (flags & PURPLE_CBFLAGS_HALFOP) |
|
7295bc64f5fa
Show user flags in chat userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17076
diff
changeset
|
1063 | return "%"; |
|
7295bc64f5fa
Show user flags in chat userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17076
diff
changeset
|
1064 | if (flags & PURPLE_CBFLAGS_VOICE) |
|
7295bc64f5fa
Show user flags in chat userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17076
diff
changeset
|
1065 | return "+"; |
|
7295bc64f5fa
Show user flags in chat userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17076
diff
changeset
|
1066 | return " "; |
|
7295bc64f5fa
Show user flags in chat userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17076
diff
changeset
|
1067 | } |
|
7295bc64f5fa
Show user flags in chat userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17076
diff
changeset
|
1068 | |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1069 | static void |
| 15884 | 1070 | 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
|
1071 | { |
|
22339
f68309ed6c0a
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22337
diff
changeset
|
1072 | FinchConv *ggc = FINCH_GET_DATA(conv); |
|
14153
9da98052a4e1
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14122
diff
changeset
|
1073 | GntEntry *entry = GNT_ENTRY(ggc->entry); |
|
9da98052a4e1
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14122
diff
changeset
|
1074 | |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1075 | if (!new_arrivals) |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1076 | { |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1077 | /* Print the list of users in the room */ |
|
23585
7b7739c29f86
Show the count of users when joining a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23556
diff
changeset
|
1078 | GString *string = g_string_new(NULL); |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1079 | GList *iter; |
|
23585
7b7739c29f86
Show the count of users when joining a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23556
diff
changeset
|
1080 | int count = g_list_length(users); |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1081 | |
|
23585
7b7739c29f86
Show the count of users when joining a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23556
diff
changeset
|
1082 | g_string_printf(string, |
|
7b7739c29f86
Show the count of users when joining a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23556
diff
changeset
|
1083 | ngettext("List of %d user:\n", "List of %d users:\n", count), count); |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1084 | for (iter = users; iter; iter = iter->next) |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1085 | { |
| 15884 | 1086 | PurpleConvChatBuddy *cbuddy = iter->data; |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1087 | char *str; |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1088 | |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1089 | if ((str = cbuddy->alias) == NULL) |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1090 | str = cbuddy->name; |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1091 | g_string_append_printf(string, "[ %s ]", str); |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1092 | } |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1093 | |
| 15884 | 1094 | purple_conversation_write(conv, NULL, string->str, |
| 1095 | PURPLE_MESSAGE_SYSTEM, time(NULL)); | |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1096 | g_string_free(string, TRUE); |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1097 | } |
|
14153
9da98052a4e1
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14122
diff
changeset
|
1098 | |
|
9da98052a4e1
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14122
diff
changeset
|
1099 | for (; users; users = users->next) |
|
9da98052a4e1
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14122
diff
changeset
|
1100 | { |
| 15884 | 1101 | 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
|
1102 | GntTree *tree = GNT_TREE(ggc->u.chat->userlist); |
|
14153
9da98052a4e1
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14122
diff
changeset
|
1103 | gnt_entry_add_suggest(entry, cbuddy->name); |
|
9da98052a4e1
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14122
diff
changeset
|
1104 | 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
|
1105 | 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
|
1106 | 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
|
1107 | } |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1108 | } |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1109 | |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1110 | static void |
| 15884 | 1111 | 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
|
1112 | { |
|
14318
07aba2cdc261
[gaim-migrate @ 16938]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14296
diff
changeset
|
1113 | /* Update the name for string completion */ |
|
22339
f68309ed6c0a
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22337
diff
changeset
|
1114 | FinchConv *ggc = FINCH_GET_DATA(conv); |
|
14153
9da98052a4e1
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14122
diff
changeset
|
1115 | 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
|
1116 | 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
|
1117 | 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
|
1118 | |
|
14153
9da98052a4e1
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14122
diff
changeset
|
1119 | gnt_entry_remove_suggest(entry, old); |
|
17115
7295bc64f5fa
Show user flags in chat userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17076
diff
changeset
|
1120 | gnt_tree_remove(tree, (gpointer)old); |
|
7295bc64f5fa
Show user flags in chat userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17076
diff
changeset
|
1121 | |
|
14153
9da98052a4e1
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14122
diff
changeset
|
1122 | gnt_entry_add_suggest(entry, new_n); |
|
9da98052a4e1
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14122
diff
changeset
|
1123 | 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
|
1124 | 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
|
1125 | 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
|
1126 | } |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1127 | |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1128 | static void |
|
17164
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
17115
diff
changeset
|
1129 | finch_chat_remove_users(PurpleConversation *conv, GList *list) |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1130 | { |
|
14318
07aba2cdc261
[gaim-migrate @ 16938]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14296
diff
changeset
|
1131 | /* Remove the name from string completion */ |
|
22339
f68309ed6c0a
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22337
diff
changeset
|
1132 | FinchConv *ggc = FINCH_GET_DATA(conv); |
|
14153
9da98052a4e1
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14122
diff
changeset
|
1133 | 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
|
1134 | 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
|
1135 | GntTree *tree = GNT_TREE(ggc->u.chat->userlist); |
|
14153
9da98052a4e1
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14122
diff
changeset
|
1136 | 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
|
1137 | 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
|
1138 | } |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1139 | } |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1140 | |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1141 | static void |
| 15884 | 1142 | finch_chat_update_user(PurpleConversation *conv, const char *user) |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1143 | { |
|
17115
7295bc64f5fa
Show user flags in chat userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17076
diff
changeset
|
1144 | PurpleConvChatBuddy *cb = purple_conv_chat_cb_find(PURPLE_CONV_CHAT(conv), user); |
|
22339
f68309ed6c0a
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22337
diff
changeset
|
1145 | FinchConv *ggc = FINCH_GET_DATA(conv); |
|
17115
7295bc64f5fa
Show user flags in chat userlist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17076
diff
changeset
|
1146 | 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
|
1147 | } |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1148 | |
|
19611
1ea4a579fbfa
Add two missing conversation-uiops functions. (has_focus and present)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19610
diff
changeset
|
1149 | static void |
|
1ea4a579fbfa
Add two missing conversation-uiops functions. (has_focus and present)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19610
diff
changeset
|
1150 | 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
|
1151 | { |
|
1ea4a579fbfa
Add two missing conversation-uiops functions. (has_focus and present)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19610
diff
changeset
|
1152 | 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
|
1153 | 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
|
1154 | 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
|
1155 | } |
|
1ea4a579fbfa
Add two missing conversation-uiops functions. (has_focus and present)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19610
diff
changeset
|
1156 | |
|
1ea4a579fbfa
Add two missing conversation-uiops functions. (has_focus and present)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19610
diff
changeset
|
1157 | static gboolean |
|
1ea4a579fbfa
Add two missing conversation-uiops functions. (has_focus and present)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19610
diff
changeset
|
1158 | 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
|
1159 | { |
|
1ea4a579fbfa
Add two missing conversation-uiops functions. (has_focus and present)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19610
diff
changeset
|
1160 | 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
|
1161 | 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
|
1162 | 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
|
1163 | return FALSE; |
|
1ea4a579fbfa
Add two missing conversation-uiops functions. (has_focus and present)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19610
diff
changeset
|
1164 | } |
|
1ea4a579fbfa
Add two missing conversation-uiops functions. (has_focus and present)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19610
diff
changeset
|
1165 | |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
29712
diff
changeset
|
1166 | static PurpleConversationUiOps conv_ui_ops = |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1167 | { |
|
17164
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
17115
diff
changeset
|
1168 | finch_create_conversation, |
|
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
17115
diff
changeset
|
1169 | finch_destroy_conversation, |
|
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
17115
diff
changeset
|
1170 | finch_write_chat, |
|
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
17115
diff
changeset
|
1171 | finch_write_im, |
|
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
17115
diff
changeset
|
1172 | finch_write_conv, |
|
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
17115
diff
changeset
|
1173 | 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
|
1174 | 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
|
1175 | 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
|
1176 | 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
|
1177 | 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
|
1178 | 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
|
1179 | 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
|
1180 | 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
|
1181 | 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
|
1182 | NULL, /* send_confirm */ |
|
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
17115
diff
changeset
|
1183 | NULL, |
|
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
17115
diff
changeset
|
1184 | NULL, |
|
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
17115
diff
changeset
|
1185 | NULL, |
|
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
17115
diff
changeset
|
1186 | NULL |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1187 | }; |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1188 | |
| 15884 | 1189 | PurpleConversationUiOps *finch_conv_get_ui_ops() |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1190 | { |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1191 | return &conv_ui_ops; |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1192 | } |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1193 | |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1194 | /* Xerox */ |
| 15884 | 1195 | static PurpleCmdRet |
| 1196 | say_command_cb(PurpleConversation *conv, | |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1197 | const char *cmd, char **args, char **error, void *data) |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1198 | { |
| 15884 | 1199 | if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) |
| 1200 | purple_conv_im_send(PURPLE_CONV_IM(conv), args[0]); | |
| 1201 | else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) | |
| 1202 | 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
|
1203 | |
| 15884 | 1204 | return PURPLE_CMD_RET_OK; |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1205 | } |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1206 | |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1207 | /* Xerox */ |
| 15884 | 1208 | static PurpleCmdRet |
| 1209 | me_command_cb(PurpleConversation *conv, | |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1210 | const char *cmd, char **args, char **error, void *data) |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1211 | { |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1212 | char *tmp; |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1213 | |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1214 | tmp = g_strdup_printf("/me %s", args[0]); |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1215 | |
| 15884 | 1216 | if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) |
| 1217 | purple_conv_im_send(PURPLE_CONV_IM(conv), tmp); | |
| 1218 | else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) | |
| 1219 | purple_conv_chat_send(PURPLE_CONV_CHAT(conv), tmp); | |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1220 | |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1221 | g_free(tmp); |
| 15884 | 1222 | return PURPLE_CMD_RET_OK; |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1223 | } |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1224 | |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1225 | /* Xerox */ |
| 15884 | 1226 | static PurpleCmdRet |
| 1227 | debug_command_cb(PurpleConversation *conv, | |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1228 | const char *cmd, char **args, char **error, void *data) |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1229 | { |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1230 | char *tmp, *markup; |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1231 | |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1232 | if (!g_ascii_strcasecmp(args[0], "version")) { |
|
28543
1a8becaa2a21
'/debug plugins' will announce the list of loaded plugins.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27829
diff
changeset
|
1233 | tmp = g_strdup_printf("Using Finch v%s with libpurple v%s.", |
|
1a8becaa2a21
'/debug plugins' will announce the list of loaded plugins.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27829
diff
changeset
|
1234 | DISPLAY_VERSION, purple_core_get_version()); |
|
1a8becaa2a21
'/debug plugins' will announce the list of loaded plugins.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27829
diff
changeset
|
1235 | } else if (!g_ascii_strcasecmp(args[0], "plugins")) { |
|
1a8becaa2a21
'/debug plugins' will announce the list of loaded plugins.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27829
diff
changeset
|
1236 | /* Show all the loaded plugins, including the protocol plugins and plugin loaders. |
|
1a8becaa2a21
'/debug plugins' will announce the list of loaded plugins.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27829
diff
changeset
|
1237 | * This is intentional, since third party prpls are often sources of bugs, and some |
|
1a8becaa2a21
'/debug plugins' will announce the list of loaded plugins.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27829
diff
changeset
|
1238 | * plugin loaders (e.g. mono) can also be buggy. |
|
1a8becaa2a21
'/debug plugins' will announce the list of loaded plugins.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27829
diff
changeset
|
1239 | */ |
|
1a8becaa2a21
'/debug plugins' will announce the list of loaded plugins.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27829
diff
changeset
|
1240 | GString *str = g_string_new("Loaded Plugins: "); |
|
1a8becaa2a21
'/debug plugins' will announce the list of loaded plugins.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27829
diff
changeset
|
1241 | const GList *plugins = purple_plugins_get_loaded(); |
|
1a8becaa2a21
'/debug plugins' will announce the list of loaded plugins.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27829
diff
changeset
|
1242 | if (plugins) { |
|
1a8becaa2a21
'/debug plugins' will announce the list of loaded plugins.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27829
diff
changeset
|
1243 | for (; plugins; plugins = plugins->next) { |
|
1a8becaa2a21
'/debug plugins' will announce the list of loaded plugins.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27829
diff
changeset
|
1244 | str = g_string_append(str, purple_plugin_get_name(plugins->data)); |
|
1a8becaa2a21
'/debug plugins' will announce the list of loaded plugins.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27829
diff
changeset
|
1245 | if (plugins->next) |
|
1a8becaa2a21
'/debug plugins' will announce the list of loaded plugins.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27829
diff
changeset
|
1246 | str = g_string_append(str, ", "); |
|
1a8becaa2a21
'/debug plugins' will announce the list of loaded plugins.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27829
diff
changeset
|
1247 | } |
|
1a8becaa2a21
'/debug plugins' will announce the list of loaded plugins.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27829
diff
changeset
|
1248 | } else { |
|
1a8becaa2a21
'/debug plugins' will announce the list of loaded plugins.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27829
diff
changeset
|
1249 | str = g_string_append(str, "(none)"); |
|
1a8becaa2a21
'/debug plugins' will announce the list of loaded plugins.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27829
diff
changeset
|
1250 | } |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1251 | |
|
28543
1a8becaa2a21
'/debug plugins' will announce the list of loaded plugins.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27829
diff
changeset
|
1252 | tmp = g_string_free(str, FALSE); |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1253 | } else { |
|
28543
1a8becaa2a21
'/debug plugins' will announce the list of loaded plugins.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27829
diff
changeset
|
1254 | purple_conversation_write(conv, NULL, _("Supported debug options are: plugins version"), |
| 15884 | 1255 | PURPLE_MESSAGE_NO_LOG|PURPLE_MESSAGE_ERROR, time(NULL)); |
|
28544
093965f9d811
Return the proper enum values from command callbacks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28543
diff
changeset
|
1256 | return PURPLE_CMD_RET_OK; |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1257 | } |
|
28543
1a8becaa2a21
'/debug plugins' will announce the list of loaded plugins.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27829
diff
changeset
|
1258 | |
|
1a8becaa2a21
'/debug plugins' will announce the list of loaded plugins.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27829
diff
changeset
|
1259 | markup = g_markup_escape_text(tmp, -1); |
|
1a8becaa2a21
'/debug plugins' will announce the list of loaded plugins.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27829
diff
changeset
|
1260 | if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) |
|
1a8becaa2a21
'/debug plugins' will announce the list of loaded plugins.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27829
diff
changeset
|
1261 | purple_conv_im_send(PURPLE_CONV_IM(conv), markup); |
|
1a8becaa2a21
'/debug plugins' will announce the list of loaded plugins.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27829
diff
changeset
|
1262 | else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) |
|
1a8becaa2a21
'/debug plugins' will announce the list of loaded plugins.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27829
diff
changeset
|
1263 | purple_conv_chat_send(PURPLE_CONV_CHAT(conv), markup); |
|
1a8becaa2a21
'/debug plugins' will announce the list of loaded plugins.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27829
diff
changeset
|
1264 | |
|
1a8becaa2a21
'/debug plugins' will announce the list of loaded plugins.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27829
diff
changeset
|
1265 | g_free(tmp); |
|
1a8becaa2a21
'/debug plugins' will announce the list of loaded plugins.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27829
diff
changeset
|
1266 | g_free(markup); |
|
28544
093965f9d811
Return the proper enum values from command callbacks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28543
diff
changeset
|
1267 | return PURPLE_CMD_RET_OK; |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1268 | } |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1269 | |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1270 | /* Xerox */ |
| 15884 | 1271 | static PurpleCmdRet |
| 1272 | clear_command_cb(PurpleConversation *conv, | |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1273 | const char *cmd, char **args, char **error, void *data) |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1274 | { |
|
19599
5d2c452fbc12
Clear the message history in the /clear callback.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19550
diff
changeset
|
1275 | purple_conversation_clear_message_history(conv); |
|
28544
093965f9d811
Return the proper enum values from command callbacks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28543
diff
changeset
|
1276 | return PURPLE_CMD_RET_OK; |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1277 | } |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1278 | |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1279 | /* Xerox */ |
| 15884 | 1280 | static PurpleCmdRet |
| 1281 | help_command_cb(PurpleConversation *conv, | |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1282 | const char *cmd, char **args, char **error, void *data) |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1283 | { |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1284 | GList *l, *text; |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1285 | GString *s; |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1286 | |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1287 | if (args[0] != NULL) { |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1288 | s = g_string_new(""); |
| 15884 | 1289 | text = purple_cmd_help(conv, args[0]); |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1290 | |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1291 | if (text) { |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1292 | for (l = text; l; l = l->next) |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1293 | if (l->next) |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1294 | g_string_append_printf(s, "%s\n", (char *)l->data); |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1295 | else |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1296 | g_string_append_printf(s, "%s", (char *)l->data); |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1297 | } else { |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1298 | g_string_append(s, _("No such command (in this context).")); |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1299 | } |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1300 | } else { |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1301 | 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
|
1302 | "The following commands are available in this context:\n")); |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1303 | |
| 15884 | 1304 | text = purple_cmd_list(conv); |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1305 | for (l = text; l; l = l->next) |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1306 | if (l->next) |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1307 | g_string_append_printf(s, "%s, ", (char *)l->data); |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1308 | else |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1309 | g_string_append_printf(s, "%s.", (char *)l->data); |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1310 | g_list_free(text); |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1311 | } |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1312 | |
| 15884 | 1313 | 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
|
1314 | g_string_free(s, TRUE); |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1315 | |
|
28544
093965f9d811
Return the proper enum values from command callbacks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28543
diff
changeset
|
1316 | return PURPLE_CMD_RET_OK; |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1317 | } |
|
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1318 | |
| 15884 | 1319 | static PurpleCmdRet |
| 1320 | 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
|
1321 | { |
|
22104
56970903b8e9
Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@pidgin.im>
parents:
21859
diff
changeset
|
1322 | void (*callback)(void) = data; |
|
14086
732c14687955
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14073
diff
changeset
|
1323 | callback(); |
|
28544
093965f9d811
Return the proper enum values from command callbacks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28543
diff
changeset
|
1324 | return PURPLE_CMD_RET_OK; |
|
14086
732c14687955
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14073
diff
changeset
|
1325 | } |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1326 | |
|
16949
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
1327 | static PurpleCmdRet |
|
23452
0cf9a2c482ff
msgcolor command to change colors of messages in conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23374
diff
changeset
|
1328 | cmd_message_color(PurpleConversation *conv, const char *cmd, char **args, char **error, gpointer data) |
|
0cf9a2c482ff
msgcolor command to change colors of messages in conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23374
diff
changeset
|
1329 | { |
|
0cf9a2c482ff
msgcolor command to change colors of messages in conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23374
diff
changeset
|
1330 | int *msgclass = NULL; |
|
0cf9a2c482ff
msgcolor command to change colors of messages in conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23374
diff
changeset
|
1331 | int fg, bg; |
|
0cf9a2c482ff
msgcolor command to change colors of messages in conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23374
diff
changeset
|
1332 | |
|
38259
c593fc9f5438
Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
31756
diff
changeset
|
1333 | if (purple_strequal(args[0], "receive")) |
|
23452
0cf9a2c482ff
msgcolor command to change colors of messages in conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23374
diff
changeset
|
1334 | msgclass = &color_message_receive; |
|
38259
c593fc9f5438
Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
31756
diff
changeset
|
1335 | else if (purple_strequal(args[0], "send")) |
|
23452
0cf9a2c482ff
msgcolor command to change colors of messages in conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23374
diff
changeset
|
1336 | msgclass = &color_message_send; |
|
38259
c593fc9f5438
Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
31756
diff
changeset
|
1337 | else if (purple_strequal(args[0], "highlight")) |
|
23452
0cf9a2c482ff
msgcolor command to change colors of messages in conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23374
diff
changeset
|
1338 | msgclass = &color_message_highlight; |
|
38259
c593fc9f5438
Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
31756
diff
changeset
|
1339 | else if (purple_strequal(args[0], "action")) |
|
23452
0cf9a2c482ff
msgcolor command to change colors of messages in conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23374
diff
changeset
|
1340 | msgclass = &color_message_action; |
|
38259
c593fc9f5438
Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
31756
diff
changeset
|
1341 | else if (purple_strequal(args[0], "timestamp")) |
|
23452
0cf9a2c482ff
msgcolor command to change colors of messages in conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23374
diff
changeset
|
1342 | msgclass = &color_timestamp; |
|
0cf9a2c482ff
msgcolor command to change colors of messages in conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23374
diff
changeset
|
1343 | else { |
|
0cf9a2c482ff
msgcolor command to change colors of messages in conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23374
diff
changeset
|
1344 | if (error) |
|
0cf9a2c482ff
msgcolor command to change colors of messages in conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23374
diff
changeset
|
1345 | *error = g_strdup_printf(_("%s is not a valid message class. See '/help msgcolor' for valid message classes."), args[0]); |
|
28544
093965f9d811
Return the proper enum values from command callbacks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28543
diff
changeset
|
1346 | return PURPLE_CMD_RET_FAILED; |
|
23452
0cf9a2c482ff
msgcolor command to change colors of messages in conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23374
diff
changeset
|
1347 | } |
|
0cf9a2c482ff
msgcolor command to change colors of messages in conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23374
diff
changeset
|
1348 | |
|
0cf9a2c482ff
msgcolor command to change colors of messages in conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23374
diff
changeset
|
1349 | fg = gnt_colors_get_color(args[1]); |
|
0cf9a2c482ff
msgcolor command to change colors of messages in conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23374
diff
changeset
|
1350 | if (fg == -EINVAL) { |
|
0cf9a2c482ff
msgcolor command to change colors of messages in conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23374
diff
changeset
|
1351 | if (error) |
|
0cf9a2c482ff
msgcolor command to change colors of messages in conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23374
diff
changeset
|
1352 | *error = g_strdup_printf(_("%s is not a valid color. See '/help msgcolor' for valid colors."), args[1]); |
|
28544
093965f9d811
Return the proper enum values from command callbacks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28543
diff
changeset
|
1353 | return PURPLE_CMD_RET_FAILED; |
|
23452
0cf9a2c482ff
msgcolor command to change colors of messages in conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23374
diff
changeset
|
1354 | } |
|
0cf9a2c482ff
msgcolor command to change colors of messages in conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23374
diff
changeset
|
1355 | |
|
0cf9a2c482ff
msgcolor command to change colors of messages in conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23374
diff
changeset
|
1356 | bg = gnt_colors_get_color(args[2]); |
|
0cf9a2c482ff
msgcolor command to change colors of messages in conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23374
diff
changeset
|
1357 | if (bg == -EINVAL) { |
|
0cf9a2c482ff
msgcolor command to change colors of messages in conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23374
diff
changeset
|
1358 | if (error) |
|
0cf9a2c482ff
msgcolor command to change colors of messages in conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23374
diff
changeset
|
1359 | *error = g_strdup_printf(_("%s is not a valid color. See '/help msgcolor' for valid colors."), args[2]); |
|
28544
093965f9d811
Return the proper enum values from command callbacks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28543
diff
changeset
|
1360 | return PURPLE_CMD_RET_FAILED; |
|
23452
0cf9a2c482ff
msgcolor command to change colors of messages in conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23374
diff
changeset
|
1361 | } |
|
0cf9a2c482ff
msgcolor command to change colors of messages in conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23374
diff
changeset
|
1362 | |
|
0cf9a2c482ff
msgcolor command to change colors of messages in conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23374
diff
changeset
|
1363 | init_pair(*msgclass, fg, bg); |
|
0cf9a2c482ff
msgcolor command to change colors of messages in conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23374
diff
changeset
|
1364 | |
|
28544
093965f9d811
Return the proper enum values from command callbacks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28543
diff
changeset
|
1365 | return PURPLE_CMD_RET_OK; |
|
23452
0cf9a2c482ff
msgcolor command to change colors of messages in conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23374
diff
changeset
|
1366 | } |
|
0cf9a2c482ff
msgcolor command to change colors of messages in conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23374
diff
changeset
|
1367 | |
|
0cf9a2c482ff
msgcolor command to change colors of messages in conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23374
diff
changeset
|
1368 | static PurpleCmdRet |
|
16949
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
1369 | 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
|
1370 | { |
|
22339
f68309ed6c0a
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22337
diff
changeset
|
1371 | FinchConv *fc = FINCH_GET_DATA(conv); |
|
16949
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
1372 | FinchConvChat *ch; |
|
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
1373 | if (!fc) |
|
28544
093965f9d811
Return the proper enum values from command callbacks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28543
diff
changeset
|
1374 | return PURPLE_CMD_RET_FAILED; |
|
16949
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
1375 | |
|
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
1376 | 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
|
1377 | gnt_widget_set_visible(ch->userlist, |
|
39644
54ed9db5e2ff
Use GntWidget flag accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38259
diff
changeset
|
1378 | !gnt_widget_get_visible(ch->userlist)); |
|
16949
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
1379 | 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
|
1380 | gnt_box_give_focus_to_child(GNT_BOX(fc->window), fc->entry); |
|
39644
54ed9db5e2ff
Use GntWidget flag accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38259
diff
changeset
|
1381 | purple_prefs_set_bool(PREF_USERLIST, gnt_widget_get_visible(ch->userlist)); |
|
28544
093965f9d811
Return the proper enum values from command callbacks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28543
diff
changeset
|
1382 | return PURPLE_CMD_RET_OK; |
|
16949
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
1383 | } |
|
fd7fcea88ac0
Add a /users command to toggle the userlist in chat windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16948
diff
changeset
|
1384 | |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15841
diff
changeset
|
1385 | void finch_conversation_init() |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1386 | { |
|
21855
fc93ce6595e4
Add color to the conversation window to indicate various message attributes
Richard Nelson <wabz@pidgin.im>
parents:
21453
diff
changeset
|
1387 | color_message_send = gnt_style_get_color(NULL, "color-message-sent"); |
|
fc93ce6595e4
Add color to the conversation window to indicate various message attributes
Richard Nelson <wabz@pidgin.im>
parents:
21453
diff
changeset
|
1388 | if (!color_message_send) |
|
fc93ce6595e4
Add color to the conversation window to indicate various message attributes
Richard Nelson <wabz@pidgin.im>
parents:
21453
diff
changeset
|
1389 | color_message_send = gnt_color_add_pair(COLOR_CYAN, -1); |
|
fc93ce6595e4
Add color to the conversation window to indicate various message attributes
Richard Nelson <wabz@pidgin.im>
parents:
21453
diff
changeset
|
1390 | color_message_receive = gnt_style_get_color(NULL, "color-message-received"); |
|
fc93ce6595e4
Add color to the conversation window to indicate various message attributes
Richard Nelson <wabz@pidgin.im>
parents:
21453
diff
changeset
|
1391 | if (!color_message_receive) |
|
fc93ce6595e4
Add color to the conversation window to indicate various message attributes
Richard Nelson <wabz@pidgin.im>
parents:
21453
diff
changeset
|
1392 | color_message_receive = gnt_color_add_pair(COLOR_RED, -1); |
|
fc93ce6595e4
Add color to the conversation window to indicate various message attributes
Richard Nelson <wabz@pidgin.im>
parents:
21453
diff
changeset
|
1393 | color_message_highlight = gnt_style_get_color(NULL, "color-message-highlight"); |
|
fc93ce6595e4
Add color to the conversation window to indicate various message attributes
Richard Nelson <wabz@pidgin.im>
parents:
21453
diff
changeset
|
1394 | if (!color_message_highlight) |
|
fc93ce6595e4
Add color to the conversation window to indicate various message attributes
Richard Nelson <wabz@pidgin.im>
parents:
21453
diff
changeset
|
1395 | color_message_highlight = gnt_color_add_pair(COLOR_GREEN, -1); |
|
fc93ce6595e4
Add color to the conversation window to indicate various message attributes
Richard Nelson <wabz@pidgin.im>
parents:
21453
diff
changeset
|
1396 | color_timestamp = gnt_style_get_color(NULL, "color-timestamp"); |
|
fc93ce6595e4
Add color to the conversation window to indicate various message attributes
Richard Nelson <wabz@pidgin.im>
parents:
21453
diff
changeset
|
1397 | if (!color_timestamp) |
|
fc93ce6595e4
Add color to the conversation window to indicate various message attributes
Richard Nelson <wabz@pidgin.im>
parents:
21453
diff
changeset
|
1398 | color_timestamp = gnt_color_add_pair(COLOR_BLUE, -1); |
|
fc93ce6595e4
Add color to the conversation window to indicate various message attributes
Richard Nelson <wabz@pidgin.im>
parents:
21453
diff
changeset
|
1399 | color_message_action = gnt_style_get_color(NULL, "color-message-action"); |
|
fc93ce6595e4
Add color to the conversation window to indicate various message attributes
Richard Nelson <wabz@pidgin.im>
parents:
21453
diff
changeset
|
1400 | if (!color_message_action) |
|
fc93ce6595e4
Add color to the conversation window to indicate various message attributes
Richard Nelson <wabz@pidgin.im>
parents:
21453
diff
changeset
|
1401 | color_message_action = gnt_color_add_pair(COLOR_YELLOW, -1); |
| 15884 | 1402 | purple_prefs_add_none(PREF_ROOT); |
| 1403 | purple_prefs_add_none(PREF_ROOT "/size"); | |
| 1404 | purple_prefs_add_int(PREF_ROOT "/size/width", 70); | |
| 1405 | purple_prefs_add_int(PREF_ROOT "/size/height", 20); | |
| 1406 | purple_prefs_add_none(PREF_ROOT "/position"); | |
| 1407 | purple_prefs_add_int(PREF_ROOT "/position/x", 0); | |
| 1408 | 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
|
1409 | 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
|
1410 | purple_prefs_add_bool(PREF_USERLIST, FALSE); |
|
14072
4e64a4f18686
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14070
diff
changeset
|
1411 | |
|
4e64a4f18686
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14070
diff
changeset
|
1412 | /* Xerox the commands */ |
| 15884 | 1413 | purple_cmd_register("say", "S", PURPLE_CMD_P_DEFAULT, |
| 1414 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM, NULL, | |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1415 | say_command_cb, _("say <message>: Send a message normally as if you weren't using a command."), NULL); |
| 15884 | 1416 | purple_cmd_register("me", "S", PURPLE_CMD_P_DEFAULT, |
| 1417 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM, NULL, | |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1418 | me_command_cb, _("me <action>: Send an IRC style action to a buddy or chat."), NULL); |
| 15884 | 1419 | purple_cmd_register("debug", "w", PURPLE_CMD_P_DEFAULT, |
| 1420 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM, NULL, | |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1421 | debug_command_cb, _("debug <option>: Send various debug information to the current conversation."), NULL); |
| 15884 | 1422 | purple_cmd_register("clear", "", PURPLE_CMD_P_DEFAULT, |
| 1423 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM, NULL, | |
|
14033
127990de806d
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14028
diff
changeset
|
1424 | clear_command_cb, _("clear: Clears the conversation scrollback."), NULL); |
| 15884 | 1425 | purple_cmd_register("help", "w", PURPLE_CMD_P_DEFAULT, |
| 1426 | 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
|
1427 | 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
|
1428 | 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
|
1429 | 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
|
1430 | 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
|
1431 | |
|
732c14687955
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14073
diff
changeset
|
1432 | /* Now some commands to bring up some other windows */ |
| 15884 | 1433 | purple_cmd_register("plugins", "", PURPLE_CMD_P_DEFAULT, |
| 1434 | 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
|
1435 | cmd_show_window, _("plugins: Show the plugins window."), finch_plugins_show_all); |
| 15884 | 1436 | purple_cmd_register("buddylist", "", PURPLE_CMD_P_DEFAULT, |
| 1437 | 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
|
1438 | cmd_show_window, _("buddylist: Show the buddylist."), finch_blist_show); |
| 15884 | 1439 | purple_cmd_register("accounts", "", PURPLE_CMD_P_DEFAULT, |
| 1440 | 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
|
1441 | cmd_show_window, _("accounts: Show the accounts window."), finch_accounts_show_all); |
| 15884 | 1442 | purple_cmd_register("debugwin", "", PURPLE_CMD_P_DEFAULT, |
| 1443 | 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
|
1444 | cmd_show_window, _("debugwin: Show the debug window."), finch_debug_window_show); |
| 15884 | 1445 | purple_cmd_register("prefs", "", PURPLE_CMD_P_DEFAULT, |
| 1446 | 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
|
1447 | cmd_show_window, _("prefs: Show the preference window."), finch_prefs_show_all); |
| 15884 | 1448 | purple_cmd_register("status", "", PURPLE_CMD_P_DEFAULT, |
| 1449 | 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
|
1450 | 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
|
1451 | |
|
23452
0cf9a2c482ff
msgcolor command to change colors of messages in conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23374
diff
changeset
|
1452 | /* Allow customizing the message colors using a command during run-time */ |
|
0cf9a2c482ff
msgcolor command to change colors of messages in conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23374
diff
changeset
|
1453 | purple_cmd_register("msgcolor", "www", PURPLE_CMD_P_DEFAULT, |
|
0cf9a2c482ff
msgcolor command to change colors of messages in conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23374
diff
changeset
|
1454 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM, NULL, |
|
0cf9a2c482ff
msgcolor command to change colors of messages in conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23374
diff
changeset
|
1455 | cmd_message_color, _("msgcolor <class> <foreground> <background>: " |
|
0cf9a2c482ff
msgcolor command to change colors of messages in conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23374
diff
changeset
|
1456 | "Set the color for different classes of messages in the conversation window.<br>" |
|
0cf9a2c482ff
msgcolor command to change colors of messages in conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23374
diff
changeset
|
1457 | " <class>: receive, send, highlight, action, timestamp<br>" |
|
0cf9a2c482ff
msgcolor command to change colors of messages in conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23374
diff
changeset
|
1458 | " <foreground/background>: black, red, green, blue, white, gray, darkgray, magenta, cyan, default<br><br>" |
|
0cf9a2c482ff
msgcolor command to change colors of messages in conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23374
diff
changeset
|
1459 | "EXAMPLE:<br> msgcolor send cyan default"), |
|
0cf9a2c482ff
msgcolor command to change colors of messages in conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23374
diff
changeset
|
1460 | NULL); |
|
31756
17b32efc423a
Register both spellings for the msgcolour command, for people who
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31643
diff
changeset
|
1461 | purple_cmd_register("msgcolour", "www", PURPLE_CMD_P_DEFAULT, |
|
17b32efc423a
Register both spellings for the msgcolour command, for people who
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31643
diff
changeset
|
1462 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM, NULL, |
|
17b32efc423a
Register both spellings for the msgcolour command, for people who
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31643
diff
changeset
|
1463 | cmd_message_color, _("msgcolor <class> <foreground> <background>: " |
|
17b32efc423a
Register both spellings for the msgcolour command, for people who
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31643
diff
changeset
|
1464 | "Set the color for different classes of messages in the conversation window.<br>" |
|
17b32efc423a
Register both spellings for the msgcolour command, for people who
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31643
diff
changeset
|
1465 | " <class>: receive, send, highlight, action, timestamp<br>" |
|
17b32efc423a
Register both spellings for the msgcolour command, for people who
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31643
diff
changeset
|
1466 | " <foreground/background>: black, red, green, blue, white, gray, darkgray, magenta, cyan, default<br><br>" |
|
17b32efc423a
Register both spellings for the msgcolour command, for people who
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31643
diff
changeset
|
1467 | "EXAMPLE:<br> msgcolor send cyan default"), |
|
17b32efc423a
Register both spellings for the msgcolour command, for people who
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31643
diff
changeset
|
1468 | NULL); |
|
23452
0cf9a2c482ff
msgcolor command to change colors of messages in conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23374
diff
changeset
|
1469 | |
|
17076
9968d75058a4
Notify when you leave a chat, after /part or /kick.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17028
diff
changeset
|
1470 | 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
|
1471 | 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
|
1472 | 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
|
1473 | 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
|
1474 | 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
|
1475 | PURPLE_CALLBACK(chat_left_cb), NULL); |
|
31643
805b37d317a2
Add a cleared-message-history conversation signal, and use it in Pidgin and Finch
Paul Aurich <darkrain42@pidgin.im>
parents:
31294
diff
changeset
|
1476 | purple_signal_connect(purple_conversations_get_handle(), "cleared-message-history", finch_conv_get_handle(), |
|
805b37d317a2
Add a cleared-message-history conversation signal, and use it in Pidgin and Finch
Paul Aurich <darkrain42@pidgin.im>
parents:
31294
diff
changeset
|
1477 | PURPLE_CALLBACK(cleared_message_history_cb), NULL); |
|
19449
a1a8233074ec
Update the 'send to' menu in conversation windows when necessary.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18935
diff
changeset
|
1478 | 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
|
1479 | 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
|
1480 | 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
|
1481 | 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
|
1482 | 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
|
1483 | 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
|
1484 | 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
|
1485 | PURPLE_CALLBACK(account_signed_on_off), NULL); |
|
28716
97be946ff188
Rejoin an opened chat after an account reconnects.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28544
diff
changeset
|
1486 | purple_signal_connect(purple_connections_get_handle(), "signing-off", finch_conv_get_handle(), |
|
97be946ff188
Rejoin an opened chat after an account reconnects.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28544
diff
changeset
|
1487 | PURPLE_CALLBACK(account_signing_off), NULL); |
|
13947
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1488 | } |
|
a77f6f615c20
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1489 | |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15841
diff
changeset
|
1490 | void finch_conversation_uninit() |
|
13969
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13959
diff
changeset
|
1491 | { |
|
17076
9968d75058a4
Notify when you leave a chat, after /part or /kick.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17028
diff
changeset
|
1492 | purple_signals_disconnect_by_handle(finch_conv_get_handle()); |
|
13969
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13959
diff
changeset
|
1493 | } |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13959
diff
changeset
|
1494 | |
| 15884 | 1495 | void finch_conversation_set_active(PurpleConversation *conv) |
|
14450
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
1496 | { |
|
22339
f68309ed6c0a
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22337
diff
changeset
|
1497 | FinchConv *ggconv = FINCH_GET_DATA(conv); |
| 15884 | 1498 | PurpleAccount *account; |
|
14470
352d47a0724d
[gaim-migrate @ 17116]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14450
diff
changeset
|
1499 | char *title; |
|
14450
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
1500 | |
|
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
1501 | g_return_if_fail(ggconv); |
|
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
1502 | g_return_if_fail(g_list_find(ggconv->list, conv)); |
|
23556
33eca6f632b9
Tab-completion for commands in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23503
diff
changeset
|
1503 | if (ggconv->active_conv == conv) |
|
33eca6f632b9
Tab-completion for commands in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23503
diff
changeset
|
1504 | return; |
|
14450
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
1505 | |
|
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
1506 | ggconv->active_conv = conv; |
|
23556
33eca6f632b9
Tab-completion for commands in finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23503
diff
changeset
|
1507 | gg_setup_commands(ggconv, TRUE); |
| 15884 | 1508 | account = purple_conversation_get_account(conv); |
| 14612 | 1509 | title = get_conversation_title(conv, account); |
|
14470
352d47a0724d
[gaim-migrate @ 17116]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14450
diff
changeset
|
1510 | gnt_screen_rename_widget(ggconv->window, title); |
|
352d47a0724d
[gaim-migrate @ 17116]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14450
diff
changeset
|
1511 | g_free(title); |
|
14450
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
1512 | } |
|
1ac2b6e98ef8
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14427
diff
changeset
|
1513 | |
|
16190
435e34f11655
Allow adding information widgets in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16186
diff
changeset
|
1514 | 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
|
1515 | { |
|
22339
f68309ed6c0a
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22337
diff
changeset
|
1516 | FinchConv *fc = FINCH_GET_DATA(conv); |
|
16190
435e34f11655
Allow adding information widgets in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16186
diff
changeset
|
1517 | int height, width; |
|
435e34f11655
Allow adding information widgets in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16186
diff
changeset
|
1518 | |
|
435e34f11655
Allow adding information widgets in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16186
diff
changeset
|
1519 | 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
|
1520 | |
|
435e34f11655
Allow adding information widgets in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16186
diff
changeset
|
1521 | if (widget) { |
|
435e34f11655
Allow adding information widgets in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16186
diff
changeset
|
1522 | 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
|
1523 | 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
|
1524 | } |
|
435e34f11655
Allow adding information widgets in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16186
diff
changeset
|
1525 | |
|
435e34f11655
Allow adding information widgets in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16186
diff
changeset
|
1526 | 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
|
1527 | 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
|
1528 | 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
|
1529 | 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
|
1530 | } |
|
435e34f11655
Allow adding information widgets in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16186
diff
changeset
|
1531 |