Mercurial > pidgin.yaz
annotate console/gntconv.c @ 15439:a415922e2882
merge of '8f5c72b9dbcf628f35e4674469f97b34f9c6fa2c'
and 'e082ba7b9cfaf0fef0531d0fe9b54af7831f75df'
author | Ethan Blanton <elb@pidgin.im> |
---|---|
date | Sun, 28 Jan 2007 01:24:15 +0000 |
parents | 4e004a29ccf3 |
children | dfe73ac65733 |
rev | line source |
---|---|
14558
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14550
diff
changeset
|
1 /** |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14550
diff
changeset
|
2 * @file gntconv.c GNT Conversation API |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14550
diff
changeset
|
3 * @ingroup gntui |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14550
diff
changeset
|
4 * |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14550
diff
changeset
|
5 * gaim |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14550
diff
changeset
|
6 * |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14550
diff
changeset
|
7 * Gaim is the legal property of its developers, whose names are too numerous |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14550
diff
changeset
|
8 * to list here. Please refer to the COPYRIGHT file distributed with this |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14550
diff
changeset
|
9 * source distribution. |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14550
diff
changeset
|
10 * |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14550
diff
changeset
|
11 * This program is free software; you can redistribute it and/or modify |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14550
diff
changeset
|
12 * it under the terms of the GNU General Public License as published by |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14550
diff
changeset
|
13 * the Free Software Foundation; either version 2 of the License, or |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14550
diff
changeset
|
14 * (at your option) any later version. |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14550
diff
changeset
|
15 * |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14550
diff
changeset
|
16 * This program is distributed in the hope that it will be useful, |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14550
diff
changeset
|
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14550
diff
changeset
|
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14550
diff
changeset
|
19 * GNU General Public License for more details. |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14550
diff
changeset
|
20 * |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14550
diff
changeset
|
21 * You should have received a copy of the GNU General Public License |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14550
diff
changeset
|
22 * along with this program; if not, write to the Free Software |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14550
diff
changeset
|
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14550
diff
changeset
|
24 */ |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13887
diff
changeset
|
25 #include <string.h> |
13966
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
26 |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
27 #include <cmds.h> |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
28 #include <prefs.h> |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
29 #include <util.h> |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
30 |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
31 #include "gntgaim.h" |
14024
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
32 #include "gntaccount.h" |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
33 #include "gntblist.h" |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
34 #include "gntconv.h" |
14024
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
35 #include "gntdebug.h" |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
36 #include "gntplugin.h" |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14047
diff
changeset
|
37 #include "gntprefs.h" |
14126
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14091
diff
changeset
|
38 #include "gntstatus.h" |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
39 |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
40 #include "gnt.h" |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
41 #include "gntbox.h" |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
42 #include "gntentry.h" |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
43 #include "gnttextview.h" |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
44 |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
45 #define PREF_ROOT "/gaim/gnt/conversations" |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
46 |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
14126
diff
changeset
|
47 #include "config.h" |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
14126
diff
changeset
|
48 |
15312
4e004a29ccf3
[gaim-migrate @ 18102]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15201
diff
changeset
|
49 static void |
4e004a29ccf3
[gaim-migrate @ 18102]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15201
diff
changeset
|
50 send_typing_notification(GntWidget *w, GGConv *ggconv) |
15201
6a647ede0a76
[gaim-migrate @ 17990]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15189
diff
changeset
|
51 { |
15312
4e004a29ccf3
[gaim-migrate @ 18102]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15201
diff
changeset
|
52 const char *text = gnt_entry_get_text(GNT_ENTRY(ggconv->entry)); |
4e004a29ccf3
[gaim-migrate @ 18102]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15201
diff
changeset
|
53 gboolean empty = (!text || !*text); |
4e004a29ccf3
[gaim-migrate @ 18102]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15201
diff
changeset
|
54 if (gaim_prefs_get_bool("/gaim/gnt/conversations/notify_typing")) { |
4e004a29ccf3
[gaim-migrate @ 18102]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15201
diff
changeset
|
55 GaimConversation *conv = ggconv->active_conv; |
4e004a29ccf3
[gaim-migrate @ 18102]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15201
diff
changeset
|
56 GaimConvIm *im = GAIM_CONV_IM(conv); |
4e004a29ccf3
[gaim-migrate @ 18102]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15201
diff
changeset
|
57 if (!empty) { |
4e004a29ccf3
[gaim-migrate @ 18102]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15201
diff
changeset
|
58 gboolean send = (gaim_conv_im_get_send_typed_timeout(im) == 0); |
15201
6a647ede0a76
[gaim-migrate @ 17990]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15189
diff
changeset
|
59 |
6a647ede0a76
[gaim-migrate @ 17990]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15189
diff
changeset
|
60 gaim_conv_im_stop_send_typed_timeout(im); |
6a647ede0a76
[gaim-migrate @ 17990]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15189
diff
changeset
|
61 gaim_conv_im_start_send_typed_timeout(im); |
15312
4e004a29ccf3
[gaim-migrate @ 18102]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15201
diff
changeset
|
62 if (send || (gaim_conv_im_get_type_again(im) != 0 && |
15201
6a647ede0a76
[gaim-migrate @ 17990]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15189
diff
changeset
|
63 time(NULL) > gaim_conv_im_get_type_again(im))) { |
6a647ede0a76
[gaim-migrate @ 17990]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15189
diff
changeset
|
64 unsigned int timeout; |
6a647ede0a76
[gaim-migrate @ 17990]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15189
diff
changeset
|
65 timeout = serv_send_typing(gaim_conversation_get_gc(conv), |
6a647ede0a76
[gaim-migrate @ 17990]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15189
diff
changeset
|
66 gaim_conversation_get_name(conv), |
6a647ede0a76
[gaim-migrate @ 17990]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15189
diff
changeset
|
67 GAIM_TYPING); |
6a647ede0a76
[gaim-migrate @ 17990]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15189
diff
changeset
|
68 gaim_conv_im_set_type_again(im, timeout); |
6a647ede0a76
[gaim-migrate @ 17990]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15189
diff
changeset
|
69 } |
15312
4e004a29ccf3
[gaim-migrate @ 18102]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15201
diff
changeset
|
70 } else { |
4e004a29ccf3
[gaim-migrate @ 18102]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15201
diff
changeset
|
71 gaim_conv_im_stop_send_typed_timeout(im); |
4e004a29ccf3
[gaim-migrate @ 18102]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15201
diff
changeset
|
72 |
4e004a29ccf3
[gaim-migrate @ 18102]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15201
diff
changeset
|
73 serv_send_typing(gaim_conversation_get_gc(conv), |
4e004a29ccf3
[gaim-migrate @ 18102]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15201
diff
changeset
|
74 gaim_conversation_get_name(conv), |
4e004a29ccf3
[gaim-migrate @ 18102]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15201
diff
changeset
|
75 GAIM_NOT_TYPING); |
15201
6a647ede0a76
[gaim-migrate @ 17990]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15189
diff
changeset
|
76 } |
6a647ede0a76
[gaim-migrate @ 17990]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15189
diff
changeset
|
77 } |
6a647ede0a76
[gaim-migrate @ 17990]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15189
diff
changeset
|
78 } |
6a647ede0a76
[gaim-migrate @ 17990]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15189
diff
changeset
|
79 |
6a647ede0a76
[gaim-migrate @ 17990]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15189
diff
changeset
|
80 static gboolean |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
81 entry_key_pressed(GntWidget *w, const char *key, GGConv *ggconv) |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
82 { |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
83 if (key[0] == '\r' && key[1] == 0) |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
84 { |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
85 const char *text = gnt_entry_get_text(GNT_ENTRY(ggconv->entry)); |
13938
82684a39f1ec
[gaim-migrate @ 16469]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
86 if (*text == '/') |
82684a39f1ec
[gaim-migrate @ 16469]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
87 { |
14388
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
88 GaimConversation *conv = ggconv->active_conv; |
13966
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
89 GaimCmdStatus status; |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
90 const char *cmdline = text + 1; |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
91 char *error = NULL, *escape; |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
92 |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
93 escape = g_markup_escape_text(cmdline, -1); |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
94 status = gaim_cmd_do_command(conv, cmdline, escape, &error); |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
95 g_free(escape); |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
96 |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
97 switch (status) |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
98 { |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
99 case GAIM_CMD_STATUS_OK: |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
100 break; |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
101 case GAIM_CMD_STATUS_NOT_FOUND: |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
102 gaim_conversation_write(conv, "", _("No such command."), |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
103 GAIM_MESSAGE_NO_LOG, time(NULL)); |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
104 break; |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
105 case GAIM_CMD_STATUS_WRONG_ARGS: |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
106 gaim_conversation_write(conv, "", _("Syntax Error: You typed the wrong number of arguments " |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
107 "to that command."), |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
108 GAIM_MESSAGE_NO_LOG, time(NULL)); |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
109 break; |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
110 case GAIM_CMD_STATUS_FAILED: |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
111 gaim_conversation_write(conv, "", error ? error : _("Your command failed for an unknown reason."), |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
112 GAIM_MESSAGE_NO_LOG, time(NULL)); |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
113 break; |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
114 case GAIM_CMD_STATUS_WRONG_TYPE: |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
115 if(gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
116 gaim_conversation_write(conv, "", _("That command only works in chats, not IMs."), |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
117 GAIM_MESSAGE_NO_LOG, time(NULL)); |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
118 else |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
119 gaim_conversation_write(conv, "", _("That command only works in IMs, not chats."), |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
120 GAIM_MESSAGE_NO_LOG, time(NULL)); |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
121 break; |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
122 case GAIM_CMD_STATUS_WRONG_PRPL: |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
123 gaim_conversation_write(conv, "", _("That command doesn't work on this protocol."), |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
124 GAIM_MESSAGE_NO_LOG, time(NULL)); |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
125 break; |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
126 } |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
127 g_free(error); |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
128 #if 0 |
13938
82684a39f1ec
[gaim-migrate @ 16469]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
129 gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv), |
82684a39f1ec
[gaim-migrate @ 16469]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
130 _("Commands are not supported yet. Message was NOT sent."), |
82684a39f1ec
[gaim-migrate @ 16469]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
131 GNT_TEXT_FLAG_DIM | GNT_TEXT_FLAG_UNDERLINE); |
82684a39f1ec
[gaim-migrate @ 16469]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
132 gnt_text_view_next_line(GNT_TEXT_VIEW(ggconv->tv)); |
82684a39f1ec
[gaim-migrate @ 16469]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
133 gnt_text_view_scroll(GNT_TEXT_VIEW(ggconv->tv), 0); |
13966
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
134 #endif |
13938
82684a39f1ec
[gaim-migrate @ 16469]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
135 } |
82684a39f1ec
[gaim-migrate @ 16469]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
136 else |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
137 { |
14047
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14030
diff
changeset
|
138 char *escape = g_markup_escape_text(text, -1); |
14822
ac0ce6064000
[gaim-migrate @ 17589]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14715
diff
changeset
|
139 char *apos = gaim_strreplace(escape, "'", "'"); |
ac0ce6064000
[gaim-migrate @ 17589]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14715
diff
changeset
|
140 g_free(escape); |
ac0ce6064000
[gaim-migrate @ 17589]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14715
diff
changeset
|
141 escape = apos; |
14388
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
142 switch (gaim_conversation_get_type(ggconv->active_conv)) |
13938
82684a39f1ec
[gaim-migrate @ 16469]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
143 { |
82684a39f1ec
[gaim-migrate @ 16469]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
144 case GAIM_CONV_TYPE_IM: |
14388
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
145 gaim_conv_im_send_with_flags(GAIM_CONV_IM(ggconv->active_conv), escape, GAIM_MESSAGE_SEND); |
13938
82684a39f1ec
[gaim-migrate @ 16469]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
146 break; |
82684a39f1ec
[gaim-migrate @ 16469]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
147 case GAIM_CONV_TYPE_CHAT: |
14388
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
148 gaim_conv_chat_send(GAIM_CONV_CHAT(ggconv->active_conv), escape); |
13938
82684a39f1ec
[gaim-migrate @ 16469]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
149 break; |
82684a39f1ec
[gaim-migrate @ 16469]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
150 default: |
14047
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14030
diff
changeset
|
151 g_free(escape); |
13938
82684a39f1ec
[gaim-migrate @ 16469]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
152 g_return_val_if_reached(FALSE); |
82684a39f1ec
[gaim-migrate @ 16469]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
153 } |
14047
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14030
diff
changeset
|
154 g_free(escape); |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
155 } |
14091
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
156 gnt_entry_add_to_history(GNT_ENTRY(ggconv->entry), text); |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
157 gnt_entry_clear(GNT_ENTRY(ggconv->entry)); |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
158 return TRUE; |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
159 } |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13887
diff
changeset
|
160 else if (key[0] == 27) |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13887
diff
changeset
|
161 { |
14877
c01f62c83647
[gaim-migrate @ 17646]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14861
diff
changeset
|
162 if (strcmp(key, GNT_KEY_DOWN) == 0) |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13887
diff
changeset
|
163 gnt_text_view_scroll(GNT_TEXT_VIEW(ggconv->tv), 1); |
14877
c01f62c83647
[gaim-migrate @ 17646]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14861
diff
changeset
|
164 else if (strcmp(key, GNT_KEY_UP) == 0) |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13887
diff
changeset
|
165 gnt_text_view_scroll(GNT_TEXT_VIEW(ggconv->tv), -1); |
14877
c01f62c83647
[gaim-migrate @ 17646]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14861
diff
changeset
|
166 else if (strcmp(key, GNT_KEY_PGDOWN) == 0) |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13887
diff
changeset
|
167 gnt_text_view_scroll(GNT_TEXT_VIEW(ggconv->tv), ggconv->tv->priv.height - 2); |
14877
c01f62c83647
[gaim-migrate @ 17646]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14861
diff
changeset
|
168 else if (strcmp(key, GNT_KEY_PGUP) == 0) |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13887
diff
changeset
|
169 gnt_text_view_scroll(GNT_TEXT_VIEW(ggconv->tv), -(ggconv->tv->priv.height - 2)); |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13887
diff
changeset
|
170 else |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13887
diff
changeset
|
171 return FALSE; |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13887
diff
changeset
|
172 return TRUE; |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13887
diff
changeset
|
173 } |
15188
b94956393b63
[gaim-migrate @ 17976]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15172
diff
changeset
|
174 else |
b94956393b63
[gaim-migrate @ 17976]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15172
diff
changeset
|
175 { |
b94956393b63
[gaim-migrate @ 17976]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15172
diff
changeset
|
176 } |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
177 |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
178 return FALSE; |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
179 } |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
180 |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
181 static void |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
182 closing_window(GntWidget *window, GGConv *ggconv) |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
183 { |
14388
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
184 GList *list = ggconv->list; |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
185 ggconv->window = NULL; |
14388
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
186 while (list) { |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
187 GaimConversation *conv = list->data; |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
188 list = list->next; |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
189 gaim_conversation_destroy(conv); |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
190 } |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
191 } |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
192 |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
193 static void |
14861
dd2ef00759a7
[gaim-migrate @ 17630]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14822
diff
changeset
|
194 size_changed_cb(GntWidget *widget, int width, int height) |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
195 { |
14861
dd2ef00759a7
[gaim-migrate @ 17630]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14822
diff
changeset
|
196 int w, h; |
dd2ef00759a7
[gaim-migrate @ 17630]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14822
diff
changeset
|
197 gnt_widget_get_size(widget, &w, &h); |
dd2ef00759a7
[gaim-migrate @ 17630]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14822
diff
changeset
|
198 gaim_prefs_set_int(PREF_ROOT "/size/width", w); |
dd2ef00759a7
[gaim-migrate @ 17630]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14822
diff
changeset
|
199 gaim_prefs_set_int(PREF_ROOT "/size/height", h); |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
200 } |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
201 |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
202 static void |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
203 save_position_cb(GntWidget *w, int x, int y) |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
204 { |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
205 gaim_prefs_set_int(PREF_ROOT "/position/x", x); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
206 gaim_prefs_set_int(PREF_ROOT "/position/y", y); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
207 } |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
208 |
14388
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
209 static GaimConversation * |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
210 find_conv_with_contact(GaimConversation *conv) |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
211 { |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
212 GaimBlistNode *node; |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
213 GaimBuddy *buddy = gaim_find_buddy(conv->account, conv->name); |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
214 GaimConversation *ret = NULL; |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
215 |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
216 if (!buddy) |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
217 return NULL; |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
218 |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
219 for (node = ((GaimBlistNode*)buddy)->parent->child; node; node = node->next) { |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
220 if (node == (GaimBlistNode*)buddy) |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
221 continue; |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
222 if ((ret = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
223 ((GaimBuddy*)node)->name, ((GaimBuddy*)node)->account)) != NULL) |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
224 break; |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
225 } |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
226 return ret; |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
227 } |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
228 |
14550
c4e0ce19c5e1
[gaim-migrate @ 17273]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
229 static char * |
c4e0ce19c5e1
[gaim-migrate @ 17273]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
230 get_conversation_title(GaimConversation *conv, GaimAccount *account) |
c4e0ce19c5e1
[gaim-migrate @ 17273]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
231 { |
c4e0ce19c5e1
[gaim-migrate @ 17273]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
232 return g_strdup_printf(_("%s (%s -- %s)"), gaim_conversation_get_title(conv), |
c4e0ce19c5e1
[gaim-migrate @ 17273]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
233 gaim_account_get_username(account), gaim_account_get_protocol_name(account)); |
c4e0ce19c5e1
[gaim-migrate @ 17273]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
234 } |
c4e0ce19c5e1
[gaim-migrate @ 17273]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
235 |
c4e0ce19c5e1
[gaim-migrate @ 17273]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
236 static void |
c4e0ce19c5e1
[gaim-migrate @ 17273]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
237 update_buddy_typing(GaimAccount *account, const char *who, gpointer null) |
c4e0ce19c5e1
[gaim-migrate @ 17273]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
238 { |
c4e0ce19c5e1
[gaim-migrate @ 17273]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
239 GaimConversation *conv; |
c4e0ce19c5e1
[gaim-migrate @ 17273]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
240 GGConv *ggc; |
c4e0ce19c5e1
[gaim-migrate @ 17273]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
241 GaimConvIm *im = NULL; |
15172
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14877
diff
changeset
|
242 char *title, *str; |
14550
c4e0ce19c5e1
[gaim-migrate @ 17273]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
243 |
c4e0ce19c5e1
[gaim-migrate @ 17273]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
244 conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, who, account); |
c4e0ce19c5e1
[gaim-migrate @ 17273]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
245 |
c4e0ce19c5e1
[gaim-migrate @ 17273]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
246 if (!conv) |
c4e0ce19c5e1
[gaim-migrate @ 17273]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
247 return; |
c4e0ce19c5e1
[gaim-migrate @ 17273]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
248 |
14688 | 249 im = GAIM_CONV_IM(conv); |
15172
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14877
diff
changeset
|
250 ggc = conv->ui_data; |
14688 | 251 |
14550
c4e0ce19c5e1
[gaim-migrate @ 17273]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
252 if (gaim_conv_im_get_typing_state(im) == GAIM_TYPING) { |
15172
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14877
diff
changeset
|
253 int scroll; |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14877
diff
changeset
|
254 str = get_conversation_title(conv, account); |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14877
diff
changeset
|
255 title = g_strdup_printf(_("%s [%s]"), str, |
14550
c4e0ce19c5e1
[gaim-migrate @ 17273]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
256 gnt_ascii_only() ? "T" : "\342\243\277"); |
15172
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14877
diff
changeset
|
257 g_free(str); |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14877
diff
changeset
|
258 |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14877
diff
changeset
|
259 scroll = gnt_text_view_get_lines_below(GNT_TEXT_VIEW(ggc->tv)); |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14877
diff
changeset
|
260 str = g_strdup_printf(_("\n%s is typing..."), gaim_conversation_get_name(conv)); |
15201
6a647ede0a76
[gaim-migrate @ 17990]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15189
diff
changeset
|
261 /* Updating is a little buggy. So just remove and add a new one */ |
6a647ede0a76
[gaim-migrate @ 17990]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15189
diff
changeset
|
262 gnt_text_view_tag_change(GNT_TEXT_VIEW(ggc->tv), "typing", NULL, TRUE); |
6a647ede0a76
[gaim-migrate @ 17990]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15189
diff
changeset
|
263 gnt_text_view_append_text_with_tag(GNT_TEXT_VIEW(ggc->tv), |
6a647ede0a76
[gaim-migrate @ 17990]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15189
diff
changeset
|
264 str, GNT_TEXT_FLAG_DIM, "typing"); |
15172
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14877
diff
changeset
|
265 g_free(str); |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14877
diff
changeset
|
266 if (scroll <= 1) |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14877
diff
changeset
|
267 gnt_text_view_scroll(GNT_TEXT_VIEW(ggc->tv), 0); |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14877
diff
changeset
|
268 } else { |
14550
c4e0ce19c5e1
[gaim-migrate @ 17273]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
269 title = get_conversation_title(conv, account); |
15172
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14877
diff
changeset
|
270 gnt_text_view_tag_change(GNT_TEXT_VIEW(ggc->tv), "typing", NULL, TRUE); |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14877
diff
changeset
|
271 } |
14550
c4e0ce19c5e1
[gaim-migrate @ 17273]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
272 gnt_screen_rename_widget(ggc->window, title); |
c4e0ce19c5e1
[gaim-migrate @ 17273]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
273 g_free(title); |
c4e0ce19c5e1
[gaim-migrate @ 17273]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
274 } |
c4e0ce19c5e1
[gaim-migrate @ 17273]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
275 |
c4e0ce19c5e1
[gaim-migrate @ 17273]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
276 static gpointer |
c4e0ce19c5e1
[gaim-migrate @ 17273]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
277 gg_conv_get_handle() |
c4e0ce19c5e1
[gaim-migrate @ 17273]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
278 { |
c4e0ce19c5e1
[gaim-migrate @ 17273]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
279 static int handle; |
c4e0ce19c5e1
[gaim-migrate @ 17273]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
280 return &handle; |
c4e0ce19c5e1
[gaim-migrate @ 17273]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
281 } |
c4e0ce19c5e1
[gaim-migrate @ 17273]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
282 |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
283 static void |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
284 gg_create_conversation(GaimConversation *conv) |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
285 { |
14388
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
286 GGConv *ggc = conv->ui_data; |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
287 char *title; |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
288 GaimConversationType type; |
14388
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
289 GaimConversation *cc; |
14408
a57d7f0cfc0c
[gaim-migrate @ 17116]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14388
diff
changeset
|
290 GaimAccount *account; |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
291 |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
292 if (ggc) |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
293 return; |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
294 |
14388
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
295 cc = find_conv_with_contact(conv); |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
296 if (cc && cc->ui_data) |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
297 ggc = cc->ui_data; |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
298 else |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
299 ggc = g_new0(GGConv, 1); |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
300 |
14388
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
301 ggc->list = g_list_prepend(ggc->list, conv); |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
302 ggc->active_conv = conv; |
13985
a7b1d2ab9cb0
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
303 conv->ui_data = ggc; |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
304 |
14388
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
305 if (cc && cc->ui_data) { |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
306 gg_conversation_set_active(conv); |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
307 return; |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
308 } |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
309 |
14408
a57d7f0cfc0c
[gaim-migrate @ 17116]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14388
diff
changeset
|
310 account = gaim_conversation_get_account(conv); |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
311 type = gaim_conversation_get_type(conv); |
14550
c4e0ce19c5e1
[gaim-migrate @ 17273]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
312 title = get_conversation_title(conv, account); |
c4e0ce19c5e1
[gaim-migrate @ 17273]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
313 |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13938
diff
changeset
|
314 ggc->window = gnt_box_new(FALSE, TRUE); |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
315 gnt_box_set_title(GNT_BOX(ggc->window), title); |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
316 gnt_box_set_toplevel(GNT_BOX(ggc->window), TRUE); |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
317 gnt_box_set_pad(GNT_BOX(ggc->window), 0); |
14351
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
318 gnt_widget_set_name(ggc->window, "conversation-window"); |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
319 |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
320 ggc->tv = gnt_text_view_new(); |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
321 gnt_box_add_widget(GNT_BOX(ggc->window), ggc->tv); |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
322 gnt_widget_set_name(ggc->tv, "conversation-window-textview"); |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
323 gnt_widget_set_size(ggc->tv, gaim_prefs_get_int(PREF_ROOT "/size/width"), |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
324 gaim_prefs_get_int(PREF_ROOT "/size/height")); |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
325 |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
326 ggc->entry = gnt_entry_new(NULL); |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
327 gnt_box_add_widget(GNT_BOX(ggc->window), ggc->entry); |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
328 gnt_widget_set_name(ggc->entry, "conversation-window-entry"); |
14091
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
329 gnt_entry_set_history_length(GNT_ENTRY(ggc->entry), -1); |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
330 gnt_entry_set_word_suggest(GNT_ENTRY(ggc->entry), TRUE); |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
331 gnt_entry_set_always_suggest(GNT_ENTRY(ggc->entry), FALSE); |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
332 |
14091
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
333 g_signal_connect_after(G_OBJECT(ggc->entry), "key_pressed", G_CALLBACK(entry_key_pressed), ggc); |
15312
4e004a29ccf3
[gaim-migrate @ 18102]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15201
diff
changeset
|
334 g_signal_connect(G_OBJECT(ggc->entry), "text_changed", G_CALLBACK(send_typing_notification), ggc); |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
335 g_signal_connect(G_OBJECT(ggc->window), "destroy", G_CALLBACK(closing_window), ggc); |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
336 |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
337 gnt_widget_set_position(ggc->window, gaim_prefs_get_int(PREF_ROOT "/position/x"), |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
338 gaim_prefs_get_int(PREF_ROOT "/position/y")); |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
339 gnt_widget_show(ggc->window); |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
340 |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
341 g_signal_connect(G_OBJECT(ggc->tv), "size_changed", G_CALLBACK(size_changed_cb), NULL); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
342 g_signal_connect(G_OBJECT(ggc->window), "position_set", G_CALLBACK(save_position_cb), NULL); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
343 |
14550
c4e0ce19c5e1
[gaim-migrate @ 17273]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
344 gaim_signal_connect(gaim_conversations_get_handle(), "buddy-typing", gg_conv_get_handle(), |
c4e0ce19c5e1
[gaim-migrate @ 17273]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
345 GAIM_CALLBACK(update_buddy_typing), NULL); |
c4e0ce19c5e1
[gaim-migrate @ 17273]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
346 gaim_signal_connect(gaim_conversations_get_handle(), "buddy-typing-stopped", gg_conv_get_handle(), |
c4e0ce19c5e1
[gaim-migrate @ 17273]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
347 GAIM_CALLBACK(update_buddy_typing), NULL); |
c4e0ce19c5e1
[gaim-migrate @ 17273]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
348 |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
349 g_free(title); |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
350 } |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
351 |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
352 static void |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
353 gg_destroy_conversation(GaimConversation *conv) |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
354 { |
14388
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
355 /* do stuff here */ |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
356 GGConv *ggc = conv->ui_data; |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
357 ggc->list = g_list_remove(ggc->list, conv); |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
358 if (ggc->list && conv == ggc->active_conv) |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
359 ggc->active_conv = ggc->list->data; |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
360 |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
361 if (ggc->list == NULL) { |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
362 gnt_widget_destroy(ggc->window); |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
363 g_free(ggc); |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
364 } |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
365 } |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
366 |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
367 static void |
13897
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
368 gg_write_common(GaimConversation *conv, const char *who, const char *message, |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
369 GaimMessageFlags flags, time_t mtime) |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
370 { |
14388
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
371 GGConv *ggconv = conv->ui_data; |
14011
735c4e927eb8
[gaim-migrate @ 16603]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
372 char *strip, *newline; |
13931
917a71dd02eb
[gaim-migrate @ 16458]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
373 GntTextFormatFlags fl = 0; |
14030
0e70bb6d32fd
[gaim-migrate @ 16632]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
374 int pos; |
15172
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14877
diff
changeset
|
375 gboolean notify; |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
376 |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
377 g_return_if_fail(ggconv != NULL); |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
378 |
14388
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
379 if (ggconv->active_conv != conv) { |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
380 if (flags & (GAIM_MESSAGE_SEND | GAIM_MESSAGE_RECV)) |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
381 gg_conversation_set_active(conv); |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
382 else |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
383 return; |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
384 } |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
385 |
14222
8c13a650cef5
[gaim-migrate @ 16903]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14191
diff
changeset
|
386 pos = gnt_text_view_get_lines_below(GNT_TEXT_VIEW(ggconv->tv)); |
8c13a650cef5
[gaim-migrate @ 16903]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14191
diff
changeset
|
387 |
15172
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14877
diff
changeset
|
388 notify = !!gnt_text_view_tag_change(GNT_TEXT_VIEW(ggconv->tv), "typing", NULL, TRUE); |
14715
04f03667702f
[gaim-migrate @ 17469]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14688
diff
changeset
|
389 gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv), "\n", GNT_TEXT_FLAG_NORMAL); |
14222
8c13a650cef5
[gaim-migrate @ 16903]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14191
diff
changeset
|
390 |
14234
04bdbbefbd1d
[gaim-migrate @ 16916]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14222
diff
changeset
|
391 /* Unnecessary to print the timestamp for delayed message */ |
04bdbbefbd1d
[gaim-migrate @ 16916]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14222
diff
changeset
|
392 if (!(flags & GAIM_MESSAGE_DELAYED) && |
04bdbbefbd1d
[gaim-migrate @ 16916]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14222
diff
changeset
|
393 gaim_prefs_get_bool("/gaim/gnt/conversations/timestamps")) |
14060
81648c6aa918
[gaim-migrate @ 16678]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
394 gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv), |
81648c6aa918
[gaim-migrate @ 16678]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
395 gaim_utf8_strftime("(%H:%M:%S) ", localtime(&mtime)), GNT_TEXT_FLAG_DIM); |
14365
573b36b628f6
[gaim-migrate @ 17071]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14351
diff
changeset
|
396 |
14421
553bbd68387e
[gaim-migrate @ 17129]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14408
diff
changeset
|
397 if (flags & GAIM_MESSAGE_AUTO_RESP) |
553bbd68387e
[gaim-migrate @ 17129]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14408
diff
changeset
|
398 gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv), |
553bbd68387e
[gaim-migrate @ 17129]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14408
diff
changeset
|
399 _("<AUTO-REPLY> "), GNT_TEXT_FLAG_BOLD); |
553bbd68387e
[gaim-migrate @ 17129]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14408
diff
changeset
|
400 |
13897
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
401 if (who && *who && (flags & (GAIM_MESSAGE_SEND | GAIM_MESSAGE_RECV))) |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
402 { |
14365
573b36b628f6
[gaim-migrate @ 17071]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14351
diff
changeset
|
403 char * name = NULL; |
573b36b628f6
[gaim-migrate @ 17071]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14351
diff
changeset
|
404 |
573b36b628f6
[gaim-migrate @ 17071]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14351
diff
changeset
|
405 if (gaim_message_meify((char*)message, -1)) |
573b36b628f6
[gaim-migrate @ 17071]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14351
diff
changeset
|
406 name = g_strdup_printf("*** %s ", who); |
573b36b628f6
[gaim-migrate @ 17071]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14351
diff
changeset
|
407 else |
573b36b628f6
[gaim-migrate @ 17071]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14351
diff
changeset
|
408 name = g_strdup_printf("%s: ", who); |
573b36b628f6
[gaim-migrate @ 17071]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14351
diff
changeset
|
409 |
13897
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
410 gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv), |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
411 name, GNT_TEXT_FLAG_BOLD); |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
412 g_free(name); |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
413 } |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
414 else |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
415 fl = GNT_TEXT_FLAG_DIM; |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
416 |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
417 if (flags & GAIM_MESSAGE_ERROR) |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
418 fl |= GNT_TEXT_FLAG_BOLD; |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
419 if (flags & GAIM_MESSAGE_NICK) |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
420 fl |= GNT_TEXT_FLAG_UNDERLINE; |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
421 |
14011
735c4e927eb8
[gaim-migrate @ 16603]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
422 /* XXX: Remove this workaround when textview can parse messages. */ |
735c4e927eb8
[gaim-migrate @ 16603]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
423 newline = gaim_strdup_withhtml(message); |
735c4e927eb8
[gaim-migrate @ 16603]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
424 strip = gaim_markup_strip_html(newline); |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
425 gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv), |
13897
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
426 strip, fl); |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
427 |
14011
735c4e927eb8
[gaim-migrate @ 16603]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
428 g_free(newline); |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
429 g_free(strip); |
13897
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
430 |
15172
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14877
diff
changeset
|
431 if (notify) { |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14877
diff
changeset
|
432 strip = g_strdup_printf(_("\n%s is typing..."), gaim_conversation_get_name(conv)); |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14877
diff
changeset
|
433 gnt_text_view_append_text_with_tag(GNT_TEXT_VIEW(ggconv->tv), |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14877
diff
changeset
|
434 strip, GNT_TEXT_FLAG_DIM, "typing"); |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14877
diff
changeset
|
435 g_free(strip); |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14877
diff
changeset
|
436 } |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14877
diff
changeset
|
437 |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14877
diff
changeset
|
438 if (pos <= 1) |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14877
diff
changeset
|
439 gnt_text_view_scroll(GNT_TEXT_VIEW(ggconv->tv), 0); |
a00712d0522e
[gaim-migrate @ 17957]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14877
diff
changeset
|
440 |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
441 if (flags & (GAIM_MESSAGE_RECV | GAIM_MESSAGE_NICK | GAIM_MESSAGE_ERROR)) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
442 gnt_widget_set_urgent(ggconv->tv); |
13897
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
443 } |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
444 |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
445 static void |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
446 gg_write_chat(GaimConversation *conv, const char *who, const char *message, |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
447 GaimMessageFlags flags, time_t mtime) |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
448 { |
14222
8c13a650cef5
[gaim-migrate @ 16903]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14191
diff
changeset
|
449 gaim_conversation_write(conv, who, message, flags, mtime); |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
450 } |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
451 |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
452 static void |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
453 gg_write_im(GaimConversation *conv, const char *who, const char *message, |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
454 GaimMessageFlags flags, time_t mtime) |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
455 { |
14008
d9fab56e6011
[gaim-migrate @ 16594]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13988
diff
changeset
|
456 GaimAccount *account = gaim_conversation_get_account(conv); |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
457 if (flags & GAIM_MESSAGE_SEND) |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
458 { |
13971
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
459 who = gaim_connection_get_display_name(gaim_account_get_connection(account)); |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
460 if (!who) |
13971
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
461 who = gaim_account_get_alias(account); |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
462 if (!who) |
13971
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
463 who = gaim_account_get_username(account); |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
464 } |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
465 else if (flags & GAIM_MESSAGE_RECV) |
14008
d9fab56e6011
[gaim-migrate @ 16594]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13988
diff
changeset
|
466 { |
d9fab56e6011
[gaim-migrate @ 16594]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13988
diff
changeset
|
467 GaimBuddy *buddy; |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
468 who = gaim_conversation_get_name(conv); |
14008
d9fab56e6011
[gaim-migrate @ 16594]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13988
diff
changeset
|
469 buddy = gaim_find_buddy(account, who); |
d9fab56e6011
[gaim-migrate @ 16594]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13988
diff
changeset
|
470 if (buddy) |
d9fab56e6011
[gaim-migrate @ 16594]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13988
diff
changeset
|
471 who = gaim_buddy_get_contact_alias(buddy); |
d9fab56e6011
[gaim-migrate @ 16594]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13988
diff
changeset
|
472 } |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
473 |
14222
8c13a650cef5
[gaim-migrate @ 16903]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14191
diff
changeset
|
474 gaim_conversation_write(conv, who, message, flags, mtime); |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
475 } |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
476 |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
477 static void |
13886
90eb736b4c26
[gaim-migrate @ 16366]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13885
diff
changeset
|
478 gg_write_conv(GaimConversation *conv, const char *who, const char *alias, |
90eb736b4c26
[gaim-migrate @ 16366]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13885
diff
changeset
|
479 const char *message, GaimMessageFlags flags, time_t mtime) |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
480 { |
13897
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
481 const char *name; |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
482 if (alias && *alias) |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
483 name = alias; |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
484 else if (who && *who) |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
485 name = who; |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
486 else |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
487 name = NULL; |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
488 |
13897
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
489 gg_write_common(conv, name, message, flags, mtime); |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
490 } |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
491 |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
492 static void |
13971
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
493 gg_chat_add_users(GaimConversation *conv, GList *users, gboolean new_arrivals) |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
494 { |
14091
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
495 GGConv *ggc = conv->ui_data; |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
496 GntEntry *entry = GNT_ENTRY(ggc->entry); |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
497 |
13971
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
498 if (!new_arrivals) |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
499 { |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
500 /* Print the list of users in the room */ |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
501 GString *string = g_string_new(_("List of users:\n")); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
502 GList *iter; |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
503 |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
504 for (iter = users; iter; iter = iter->next) |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
505 { |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
506 GaimConvChatBuddy *cbuddy = iter->data; |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
507 char *str; |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
508 |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
509 if ((str = cbuddy->alias) == NULL) |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
510 str = cbuddy->name; |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
511 g_string_append_printf(string, "[ %s ]", str); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
512 } |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
513 |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
514 gaim_conversation_write(conv, NULL, string->str, |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
515 GAIM_MESSAGE_SYSTEM, time(NULL)); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
516 g_string_free(string, TRUE); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
517 } |
14091
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
518 |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
519 for (; users; users = users->next) |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
520 { |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
521 GaimConvChatBuddy *cbuddy = users->data; |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
522 gnt_entry_add_suggest(entry, cbuddy->name); |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
523 gnt_entry_add_suggest(entry, cbuddy->alias); |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
524 } |
13971
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
525 } |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
526 |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
527 static void |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
528 gg_chat_rename_user(GaimConversation *conv, const char *old, const char *new_n, const char *new_a) |
13971
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
529 { |
14256
e7de1f6d9f35
[gaim-migrate @ 16938]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14234
diff
changeset
|
530 /* Update the name for string completion */ |
14091
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
531 GGConv *ggc = conv->ui_data; |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
532 GntEntry *entry = GNT_ENTRY(ggc->entry); |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
533 gnt_entry_remove_suggest(entry, old); |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
534 gnt_entry_add_suggest(entry, new_n); |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
535 gnt_entry_add_suggest(entry, new_a); |
13971
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
536 } |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
537 |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
538 static void |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
539 gg_chat_remove_user(GaimConversation *conv, GList *list) |
13971
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
540 { |
14256
e7de1f6d9f35
[gaim-migrate @ 16938]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14234
diff
changeset
|
541 /* Remove the name from string completion */ |
14091
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
542 GGConv *ggc = conv->ui_data; |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
543 GntEntry *entry = GNT_ENTRY(ggc->entry); |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
544 for (; list; list = list->next) |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
545 gnt_entry_remove_suggest(entry, list->data); |
13971
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
546 } |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
547 |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
548 static void |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
549 gg_chat_update_user(GaimConversation *conv, const char *user) |
13971
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
550 { |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
551 } |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
552 |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
553 static GaimConversationUiOps conv_ui_ops = |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
554 { |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
555 .create_conversation = gg_create_conversation, |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
556 .destroy_conversation = gg_destroy_conversation, |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
557 .write_chat = gg_write_chat, |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
558 .write_im = gg_write_im, |
13886
90eb736b4c26
[gaim-migrate @ 16366]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13885
diff
changeset
|
559 .write_conv = gg_write_conv, |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
560 .chat_add_users = gg_chat_add_users, |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
561 .chat_rename_user = gg_chat_rename_user, |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
562 .chat_remove_users = gg_chat_remove_user, |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
563 .chat_update_user = gg_chat_update_user, |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
564 .present = NULL, |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
565 .has_focus = NULL, |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
566 .custom_smiley_add = NULL, |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
567 .custom_smiley_write = NULL, |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
568 .custom_smiley_close = NULL |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
569 }; |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
570 |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
571 GaimConversationUiOps *gg_conv_get_ui_ops() |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
572 { |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
573 return &conv_ui_ops; |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
574 } |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
575 |
13971
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
576 /* Xerox */ |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
577 static GaimCmdRet |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
578 say_command_cb(GaimConversation *conv, |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
579 const char *cmd, char **args, char **error, void *data) |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
580 { |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
581 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
582 gaim_conv_im_send(GAIM_CONV_IM(conv), args[0]); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
583 else if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
584 gaim_conv_chat_send(GAIM_CONV_CHAT(conv), args[0]); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
585 |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
586 return GAIM_CMD_RET_OK; |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
587 } |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
588 |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
589 /* Xerox */ |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
590 static GaimCmdRet |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
591 me_command_cb(GaimConversation *conv, |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
592 const char *cmd, char **args, char **error, void *data) |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
593 { |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
594 char *tmp; |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
595 |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
596 tmp = g_strdup_printf("/me %s", args[0]); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
597 |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
598 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
599 gaim_conv_im_send(GAIM_CONV_IM(conv), tmp); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
600 else if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
601 gaim_conv_chat_send(GAIM_CONV_CHAT(conv), tmp); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
602 |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
603 g_free(tmp); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
604 return GAIM_CMD_RET_OK; |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
605 } |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
606 |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
607 /* Xerox */ |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
608 static GaimCmdRet |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
609 debug_command_cb(GaimConversation *conv, |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
610 const char *cmd, char **args, char **error, void *data) |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
611 { |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
612 char *tmp, *markup; |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
613 GaimCmdStatus status; |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
614 |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
615 if (!g_ascii_strcasecmp(args[0], "version")) { |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
616 tmp = g_strdup_printf("me is using %s.", VERSION); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
617 markup = g_markup_escape_text(tmp, -1); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
618 |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
619 status = gaim_cmd_do_command(conv, tmp, markup, error); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
620 |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
621 g_free(tmp); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
622 g_free(markup); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
623 return status; |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
624 } else { |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
625 gaim_conversation_write(conv, NULL, _("Supported debug options are: version"), |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
626 GAIM_MESSAGE_NO_LOG|GAIM_MESSAGE_ERROR, time(NULL)); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
627 return GAIM_CMD_STATUS_OK; |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
628 } |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
629 } |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
630 |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
631 /* Xerox */ |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
632 static GaimCmdRet |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
633 clear_command_cb(GaimConversation *conv, |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
634 const char *cmd, char **args, char **error, void *data) |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
635 { |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
636 GGConv *ggconv = conv->ui_data; |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
637 gnt_text_view_clear(GNT_TEXT_VIEW(ggconv->tv)); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
638 return GAIM_CMD_STATUS_OK; |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
639 } |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
640 |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
641 /* Xerox */ |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
642 static GaimCmdRet |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
643 help_command_cb(GaimConversation *conv, |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
644 const char *cmd, char **args, char **error, void *data) |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
645 { |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
646 GList *l, *text; |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
647 GString *s; |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
648 |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
649 if (args[0] != NULL) { |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
650 s = g_string_new(""); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
651 text = gaim_cmd_help(conv, args[0]); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
652 |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
653 if (text) { |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
654 for (l = text; l; l = l->next) |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
655 if (l->next) |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
656 g_string_append_printf(s, "%s\n", (char *)l->data); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
657 else |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
658 g_string_append_printf(s, "%s", (char *)l->data); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
659 } else { |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
660 g_string_append(s, _("No such command (in this context).")); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
661 } |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
662 } else { |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
663 s = g_string_new(_("Use \"/help <command>\" for help on a specific command.\n" |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
664 "The following commands are available in this context:\n")); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
665 |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
666 text = gaim_cmd_list(conv); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
667 for (l = text; l; l = l->next) |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
668 if (l->next) |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
669 g_string_append_printf(s, "%s, ", (char *)l->data); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
670 else |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
671 g_string_append_printf(s, "%s.", (char *)l->data); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
672 g_list_free(text); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
673 } |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
674 |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
675 gaim_conversation_write(conv, NULL, s->str, GAIM_MESSAGE_NO_LOG, time(NULL)); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
676 g_string_free(s, TRUE); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
677 |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
678 return GAIM_CMD_STATUS_OK; |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
679 } |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
680 |
14024
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
681 static GaimCmdRet |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
682 cmd_show_window(GaimConversation *conv, const char *cmd, char **args, char **error, gpointer data) |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
683 { |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
684 void (*callback)() = data; |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
685 callback(); |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
686 return GAIM_CMD_STATUS_OK; |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
687 } |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
688 |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
689 void gg_conversation_init() |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
690 { |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
691 gaim_prefs_add_none(PREF_ROOT); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
692 gaim_prefs_add_none(PREF_ROOT "/size"); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
693 gaim_prefs_add_int(PREF_ROOT "/size/width", 70); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
694 gaim_prefs_add_int(PREF_ROOT "/size/height", 20); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
695 gaim_prefs_add_none(PREF_ROOT "/position"); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
696 gaim_prefs_add_int(PREF_ROOT "/position/x", 0); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
697 gaim_prefs_add_int(PREF_ROOT "/position/y", 0); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
698 |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
699 /* Xerox the commands */ |
13971
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
700 gaim_cmd_register("say", "S", GAIM_CMD_P_DEFAULT, |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
701 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
702 say_command_cb, _("say <message>: Send a message normally as if you weren't using a command."), NULL); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
703 gaim_cmd_register("me", "S", GAIM_CMD_P_DEFAULT, |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
704 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
705 me_command_cb, _("me <action>: Send an IRC style action to a buddy or chat."), NULL); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
706 gaim_cmd_register("debug", "w", GAIM_CMD_P_DEFAULT, |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
707 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
708 debug_command_cb, _("debug <option>: Send various debug information to the current conversation."), NULL); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
709 gaim_cmd_register("clear", "", GAIM_CMD_P_DEFAULT, |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
710 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
711 clear_command_cb, _("clear: Clears the conversation scrollback."), NULL); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
712 gaim_cmd_register("help", "w", GAIM_CMD_P_DEFAULT, |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
713 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, NULL, |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
714 help_command_cb, _("help <command>: Help on a specific command."), NULL); |
14024
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
715 |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
716 /* Now some commands to bring up some other windows */ |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
717 gaim_cmd_register("plugins", "", GAIM_CMD_P_DEFAULT, |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
718 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
719 cmd_show_window, _("plugins: Show the plugins window."), gg_plugins_show_all); |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
720 gaim_cmd_register("buddylist", "", GAIM_CMD_P_DEFAULT, |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
721 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
722 cmd_show_window, _("buddylist: Show the buddylist."), gg_blist_show); |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
723 gaim_cmd_register("accounts", "", GAIM_CMD_P_DEFAULT, |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
724 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
725 cmd_show_window, _("accounts: Show the accounts window."), gg_accounts_show_all); |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
726 gaim_cmd_register("debugwin", "", GAIM_CMD_P_DEFAULT, |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
727 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
728 cmd_show_window, _("debugwin: Show the debug window."), gg_debug_window_show); |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14047
diff
changeset
|
729 gaim_cmd_register("prefs", "", GAIM_CMD_P_DEFAULT, |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14047
diff
changeset
|
730 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14047
diff
changeset
|
731 cmd_show_window, _("prefs: Show the preference window."), gg_prefs_show_all); |
14126
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14091
diff
changeset
|
732 gaim_cmd_register("status", "", GAIM_CMD_P_DEFAULT, |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14091
diff
changeset
|
733 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14091
diff
changeset
|
734 cmd_show_window, _("statuses: Show the savedstatuses window."), gg_savedstatus_show_all); |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
735 } |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
736 |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
737 void gg_conversation_uninit() |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
738 { |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
739 } |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
740 |
14388
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
741 void gg_conversation_set_active(GaimConversation *conv) |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
742 { |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
743 GGConv *ggconv = conv->ui_data; |
14408
a57d7f0cfc0c
[gaim-migrate @ 17116]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14388
diff
changeset
|
744 GaimAccount *account; |
a57d7f0cfc0c
[gaim-migrate @ 17116]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14388
diff
changeset
|
745 char *title; |
14388
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
746 |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
747 g_return_if_fail(ggconv); |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
748 g_return_if_fail(g_list_find(ggconv->list, conv)); |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
749 |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
750 ggconv->active_conv = conv; |
14408
a57d7f0cfc0c
[gaim-migrate @ 17116]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14388
diff
changeset
|
751 account = gaim_conversation_get_account(conv); |
14550
c4e0ce19c5e1
[gaim-migrate @ 17273]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
752 title = get_conversation_title(conv, account); |
14408
a57d7f0cfc0c
[gaim-migrate @ 17116]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14388
diff
changeset
|
753 gnt_screen_rename_widget(ggconv->window, title); |
a57d7f0cfc0c
[gaim-migrate @ 17116]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14388
diff
changeset
|
754 g_free(title); |
14388
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
755 } |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14365
diff
changeset
|
756 |