Mercurial > pidgin.yaz
annotate console/gntconv.c @ 14216:e9dd2f76e61b
[gaim-migrate @ 16897]
A couple more keybindings.
committer: Tailor Script <tailor@pidgin.im>
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Sun, 20 Aug 2006 07:11:09 +0000 |
parents | 009db0b357b5 |
children | 8c13a650cef5 |
rev | line source |
---|---|
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13887
diff
changeset
|
1 #include <string.h> |
13966
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
2 |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
3 #include <cmds.h> |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
4 #include <prefs.h> |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
5 #include <util.h> |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
6 |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
7 #include "gntgaim.h" |
14024
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
8 #include "gntaccount.h" |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
9 #include "gntblist.h" |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
10 #include "gntconv.h" |
14024
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
11 #include "gntdebug.h" |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
12 #include "gntplugin.h" |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14047
diff
changeset
|
13 #include "gntprefs.h" |
14126
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14091
diff
changeset
|
14 #include "gntstatus.h" |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
15 |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
16 #include "gnt.h" |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
17 #include "gntbox.h" |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
18 #include "gntentry.h" |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
19 #include "gnttextview.h" |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
20 |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
21 #define PREF_ROOT "/gaim/gnt/conversations" |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
22 |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
14126
diff
changeset
|
23 #include "config.h" |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
14126
diff
changeset
|
24 |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
25 GHashTable *ggconvs; |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
26 |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
27 typedef struct _GGConv GGConv; |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
28 typedef struct _GGConvChat GGConvChat; |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
29 typedef struct _GGConvIm GGConvIm; |
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 struct _GGConv |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
32 { |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
33 GaimConversation *conv; |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
34 |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
35 GntWidget *window; /* the container */ |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
36 GntWidget *entry; /* entry */ |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
37 GntWidget *tv; /* text-view */ |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
38 |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
39 union |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
40 { |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
41 GGConvChat *chat; |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
42 GGConvIm *im; |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
43 } u; |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
44 }; |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
45 |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
46 struct _GGConvChat |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
47 { |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
48 GntWidget *userlist; /* the userlist */ |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
49 }; |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
50 |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
51 struct _GGConvIm |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
52 { |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
53 void *nothing_for_now; |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
54 }; |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
55 |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
56 static gboolean |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
57 entry_key_pressed(GntWidget *w, const char *key, GGConv *ggconv) |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
58 { |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
59 if (key[0] == '\r' && key[1] == 0) |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
60 { |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
61 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
|
62 if (*text == '/') |
82684a39f1ec
[gaim-migrate @ 16469]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
63 { |
13966
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
64 GaimConversation *conv = ggconv->conv; |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
65 GaimCmdStatus status; |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
66 const char *cmdline = text + 1; |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
67 char *error = NULL, *escape; |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
68 |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
69 escape = g_markup_escape_text(cmdline, -1); |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
70 status = gaim_cmd_do_command(conv, cmdline, escape, &error); |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
71 g_free(escape); |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
72 |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
73 switch (status) |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
74 { |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
75 case GAIM_CMD_STATUS_OK: |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
76 break; |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
77 case GAIM_CMD_STATUS_NOT_FOUND: |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
78 gaim_conversation_write(conv, "", _("No such command."), |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
79 GAIM_MESSAGE_NO_LOG, time(NULL)); |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
80 break; |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
81 case GAIM_CMD_STATUS_WRONG_ARGS: |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
82 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
|
83 "to that command."), |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
84 GAIM_MESSAGE_NO_LOG, time(NULL)); |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
85 break; |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
86 case GAIM_CMD_STATUS_FAILED: |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
87 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
|
88 GAIM_MESSAGE_NO_LOG, time(NULL)); |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
89 break; |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
90 case GAIM_CMD_STATUS_WRONG_TYPE: |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
91 if(gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
92 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
|
93 GAIM_MESSAGE_NO_LOG, time(NULL)); |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
94 else |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
95 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
|
96 GAIM_MESSAGE_NO_LOG, time(NULL)); |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
97 break; |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
98 case GAIM_CMD_STATUS_WRONG_PRPL: |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
99 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
|
100 GAIM_MESSAGE_NO_LOG, time(NULL)); |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
101 break; |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
102 } |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
103 g_free(error); |
80cbf6c2d562
[gaim-migrate @ 16522]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
104 #if 0 |
13938
82684a39f1ec
[gaim-migrate @ 16469]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
105 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
|
106 _("Commands are not supported yet. Message was NOT sent."), |
82684a39f1ec
[gaim-migrate @ 16469]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
107 GNT_TEXT_FLAG_DIM | GNT_TEXT_FLAG_UNDERLINE); |
82684a39f1ec
[gaim-migrate @ 16469]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
108 gnt_text_view_next_line(GNT_TEXT_VIEW(ggconv->tv)); |
82684a39f1ec
[gaim-migrate @ 16469]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
109 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
|
110 #endif |
13938
82684a39f1ec
[gaim-migrate @ 16469]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
111 } |
82684a39f1ec
[gaim-migrate @ 16469]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
112 else |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
113 { |
14047
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14030
diff
changeset
|
114 char *escape = g_markup_escape_text(text, -1); |
13938
82684a39f1ec
[gaim-migrate @ 16469]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
115 switch (gaim_conversation_get_type(ggconv->conv)) |
82684a39f1ec
[gaim-migrate @ 16469]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
116 { |
82684a39f1ec
[gaim-migrate @ 16469]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
117 case GAIM_CONV_TYPE_IM: |
14047
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14030
diff
changeset
|
118 gaim_conv_im_send_with_flags(GAIM_CONV_IM(ggconv->conv), escape, GAIM_MESSAGE_SEND); |
13938
82684a39f1ec
[gaim-migrate @ 16469]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
119 break; |
82684a39f1ec
[gaim-migrate @ 16469]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
120 case GAIM_CONV_TYPE_CHAT: |
14047
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14030
diff
changeset
|
121 gaim_conv_chat_send(GAIM_CONV_CHAT(ggconv->conv), escape); |
13938
82684a39f1ec
[gaim-migrate @ 16469]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
122 break; |
82684a39f1ec
[gaim-migrate @ 16469]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
123 default: |
14047
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14030
diff
changeset
|
124 g_free(escape); |
13938
82684a39f1ec
[gaim-migrate @ 16469]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
125 g_return_val_if_reached(FALSE); |
82684a39f1ec
[gaim-migrate @ 16469]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
126 } |
14047
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14030
diff
changeset
|
127 g_free(escape); |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
128 } |
14091
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
129 gnt_entry_add_to_history(GNT_ENTRY(ggconv->entry), text); |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
130 gnt_entry_clear(GNT_ENTRY(ggconv->entry)); |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
131 return TRUE; |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
132 } |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13887
diff
changeset
|
133 else if (key[0] == 27) |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13887
diff
changeset
|
134 { |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13887
diff
changeset
|
135 if (strcmp(key+1, GNT_KEY_DOWN) == 0) |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13887
diff
changeset
|
136 gnt_text_view_scroll(GNT_TEXT_VIEW(ggconv->tv), 1); |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13887
diff
changeset
|
137 else if (strcmp(key+1, GNT_KEY_UP) == 0) |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13887
diff
changeset
|
138 gnt_text_view_scroll(GNT_TEXT_VIEW(ggconv->tv), -1); |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13887
diff
changeset
|
139 else if (strcmp(key+1, GNT_KEY_PGDOWN) == 0) |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13887
diff
changeset
|
140 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
|
141 else if (strcmp(key+1, GNT_KEY_PGUP) == 0) |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13887
diff
changeset
|
142 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
|
143 else |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13887
diff
changeset
|
144 return FALSE; |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13887
diff
changeset
|
145 return TRUE; |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13887
diff
changeset
|
146 } |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
147 |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
148 return FALSE; |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
149 } |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
150 |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
151 static void |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
152 closing_window(GntWidget *window, GGConv *ggconv) |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
153 { |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
154 ggconv->window = NULL; |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
155 gaim_conversation_destroy(ggconv->conv); |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
156 } |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
157 |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
158 static void |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
159 size_changed_cb(GntWidget *w, int width, int height) |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
160 { |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
161 gaim_prefs_set_int(PREF_ROOT "/size/width", width); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
162 gaim_prefs_set_int(PREF_ROOT "/size/height", height); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
163 } |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
164 |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
165 static void |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
166 save_position_cb(GntWidget *w, int x, int y) |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
167 { |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
168 gaim_prefs_set_int(PREF_ROOT "/position/x", x); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
169 gaim_prefs_set_int(PREF_ROOT "/position/y", y); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
170 } |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
171 |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
172 static void |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
173 gg_create_conversation(GaimConversation *conv) |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
174 { |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
175 GGConv *ggc = g_hash_table_lookup(ggconvs, conv); |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
176 char *title; |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
177 GaimConversationType type; |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
178 |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
179 if (ggc) |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
180 return; |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
181 |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
182 ggc = g_new0(GGConv, 1); |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
183 g_hash_table_insert(ggconvs, conv, ggc); |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
184 |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
185 ggc->conv = conv; |
13985
a7b1d2ab9cb0
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
186 conv->ui_data = ggc; |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
187 |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
188 type = gaim_conversation_get_type(conv); |
14008
d9fab56e6011
[gaim-migrate @ 16594]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13988
diff
changeset
|
189 title = g_strdup_printf(_("%s"), gaim_conversation_get_title(conv)); |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13938
diff
changeset
|
190 ggc->window = gnt_box_new(FALSE, TRUE); |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
191 gnt_box_set_title(GNT_BOX(ggc->window), title); |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
192 gnt_box_set_toplevel(GNT_BOX(ggc->window), TRUE); |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
193 gnt_box_set_pad(GNT_BOX(ggc->window), 0); |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13887
diff
changeset
|
194 gnt_widget_set_name(ggc->window, title); |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
195 |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
196 ggc->tv = gnt_text_view_new(); |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
197 gnt_box_add_widget(GNT_BOX(ggc->window), ggc->tv); |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
198 gnt_widget_set_name(ggc->tv, "conversation-window-textview"); |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
199 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
|
200 gaim_prefs_get_int(PREF_ROOT "/size/height")); |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
201 |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
202 ggc->entry = gnt_entry_new(NULL); |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
203 gnt_box_add_widget(GNT_BOX(ggc->window), ggc->entry); |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
204 gnt_widget_set_name(ggc->entry, "conversation-window-entry"); |
14091
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
205 gnt_entry_set_history_length(GNT_ENTRY(ggc->entry), -1); |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
206 gnt_entry_set_word_suggest(GNT_ENTRY(ggc->entry), TRUE); |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
207 gnt_entry_set_always_suggest(GNT_ENTRY(ggc->entry), FALSE); |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
208 |
14091
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
209 g_signal_connect_after(G_OBJECT(ggc->entry), "key_pressed", G_CALLBACK(entry_key_pressed), ggc); |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
210 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
|
211 |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
212 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
|
213 gaim_prefs_get_int(PREF_ROOT "/position/y")); |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
214 gnt_widget_show(ggc->window); |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
215 |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
216 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
|
217 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
|
218 |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
219 g_free(title); |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
220 } |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
221 |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
222 static void |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
223 gg_destroy_conversation(GaimConversation *conv) |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
224 { |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
225 g_hash_table_remove(ggconvs, conv); |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
226 } |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
227 |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
228 static void |
13897
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
229 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
|
230 GaimMessageFlags flags, time_t mtime) |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
231 { |
13988
4d5cc9e4cb12
[gaim-migrate @ 16561]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13985
diff
changeset
|
232 GGConv *ggconv = g_hash_table_lookup(ggconvs, conv); /* XXX: ggconv = conv->ui_data; should do */ |
14011
735c4e927eb8
[gaim-migrate @ 16603]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
233 char *strip, *newline; |
13931
917a71dd02eb
[gaim-migrate @ 16458]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
234 GntTextFormatFlags fl = 0; |
14030
0e70bb6d32fd
[gaim-migrate @ 16632]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
235 int pos; |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
236 |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
237 g_return_if_fail(ggconv != NULL); |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
238 |
14060
81648c6aa918
[gaim-migrate @ 16678]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
239 if (gaim_prefs_get_bool("/gaim/gnt/conversations/timestamps")) |
81648c6aa918
[gaim-migrate @ 16678]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
240 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
|
241 gaim_utf8_strftime("(%H:%M:%S) ", localtime(&mtime)), GNT_TEXT_FLAG_DIM); |
13897
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
242 if (who && *who && (flags & (GAIM_MESSAGE_SEND | GAIM_MESSAGE_RECV))) |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
243 { |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
244 char * name = g_strdup_printf("%s: ", who); |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
245 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
|
246 name, GNT_TEXT_FLAG_BOLD); |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
247 g_free(name); |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
248 } |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
249 else |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
250 fl = GNT_TEXT_FLAG_DIM; |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
251 |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
252 if (flags & GAIM_MESSAGE_ERROR) |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
253 fl |= GNT_TEXT_FLAG_BOLD; |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
254 if (flags & GAIM_MESSAGE_NICK) |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
255 fl |= GNT_TEXT_FLAG_UNDERLINE; |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
256 |
14030
0e70bb6d32fd
[gaim-migrate @ 16632]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
257 pos = gnt_text_view_get_lines_below(GNT_TEXT_VIEW(ggconv->tv)); |
0e70bb6d32fd
[gaim-migrate @ 16632]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
258 |
14011
735c4e927eb8
[gaim-migrate @ 16603]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
259 /* XXX: Remove this workaround when textview can parse messages. */ |
735c4e927eb8
[gaim-migrate @ 16603]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
260 newline = gaim_strdup_withhtml(message); |
735c4e927eb8
[gaim-migrate @ 16603]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
261 strip = gaim_markup_strip_html(newline); |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
262 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
|
263 strip, fl); |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
264 gnt_text_view_next_line(GNT_TEXT_VIEW(ggconv->tv)); |
14030
0e70bb6d32fd
[gaim-migrate @ 16632]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
265 if (pos <= 1) |
0e70bb6d32fd
[gaim-migrate @ 16632]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
266 gnt_text_view_scroll(GNT_TEXT_VIEW(ggconv->tv), 0); |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
267 |
14011
735c4e927eb8
[gaim-migrate @ 16603]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
268 g_free(newline); |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
269 g_free(strip); |
13897
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
270 |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
271 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
|
272 gnt_widget_set_urgent(ggconv->tv); |
13897
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
273 } |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
274 |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
275 static void |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
276 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
|
277 GaimMessageFlags flags, time_t mtime) |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
278 { |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
279 gg_write_common(conv, who, message, flags, mtime); |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
280 } |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
281 |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
282 static void |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
283 gg_write_im(GaimConversation *conv, const char *who, const char *message, |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
284 GaimMessageFlags flags, time_t mtime) |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
285 { |
14008
d9fab56e6011
[gaim-migrate @ 16594]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13988
diff
changeset
|
286 GaimAccount *account = gaim_conversation_get_account(conv); |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
287 if (flags & GAIM_MESSAGE_SEND) |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
288 { |
13971
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
289 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
|
290 if (!who) |
13971
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
291 who = gaim_account_get_alias(account); |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
292 if (!who) |
13971
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
293 who = gaim_account_get_username(account); |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
294 } |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
295 else if (flags & GAIM_MESSAGE_RECV) |
14008
d9fab56e6011
[gaim-migrate @ 16594]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13988
diff
changeset
|
296 { |
d9fab56e6011
[gaim-migrate @ 16594]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13988
diff
changeset
|
297 GaimBuddy *buddy; |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
298 who = gaim_conversation_get_name(conv); |
14008
d9fab56e6011
[gaim-migrate @ 16594]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13988
diff
changeset
|
299 buddy = gaim_find_buddy(account, who); |
d9fab56e6011
[gaim-migrate @ 16594]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13988
diff
changeset
|
300 if (buddy) |
d9fab56e6011
[gaim-migrate @ 16594]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13988
diff
changeset
|
301 who = gaim_buddy_get_contact_alias(buddy); |
d9fab56e6011
[gaim-migrate @ 16594]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13988
diff
changeset
|
302 } |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
303 |
13897
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
304 gg_write_common(conv, who, message, flags, mtime); |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
305 } |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
306 |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
307 static void |
13886
90eb736b4c26
[gaim-migrate @ 16366]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13885
diff
changeset
|
308 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
|
309 const char *message, GaimMessageFlags flags, time_t mtime) |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
310 { |
13897
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
311 const char *name; |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
312 if (alias && *alias) |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
313 name = alias; |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
314 else if (who && *who) |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
315 name = who; |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
316 else |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
317 name = NULL; |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
318 |
13897
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
319 gg_write_common(conv, name, message, flags, mtime); |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
320 } |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
321 |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
322 static void |
13971
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
323 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
|
324 { |
14091
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
325 GGConv *ggc = conv->ui_data; |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
326 GntEntry *entry = GNT_ENTRY(ggc->entry); |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
327 |
13971
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
328 if (!new_arrivals) |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
329 { |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
330 /* Print the list of users in the room */ |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
331 GString *string = g_string_new(_("List of users:\n")); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
332 GList *iter; |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
333 |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
334 for (iter = users; iter; iter = iter->next) |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
335 { |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
336 GaimConvChatBuddy *cbuddy = iter->data; |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
337 char *str; |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
338 |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
339 if ((str = cbuddy->alias) == NULL) |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
340 str = cbuddy->name; |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
341 g_string_append_printf(string, "[ %s ]", str); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
342 } |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
343 |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
344 gaim_conversation_write(conv, NULL, string->str, |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
345 GAIM_MESSAGE_SYSTEM, time(NULL)); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
346 g_string_free(string, TRUE); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
347 } |
14091
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
348 |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
349 for (; users; users = users->next) |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
350 { |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
351 GaimConvChatBuddy *cbuddy = users->data; |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
352 gnt_entry_add_suggest(entry, cbuddy->name); |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
353 gnt_entry_add_suggest(entry, cbuddy->alias); |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
354 } |
13971
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
355 } |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
356 |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
357 static void |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
358 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
|
359 { |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
360 /* XXX: Update the name for string completion */ |
14091
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
361 GGConv *ggc = conv->ui_data; |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
362 GntEntry *entry = GNT_ENTRY(ggc->entry); |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
363 gnt_entry_remove_suggest(entry, old); |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
364 gnt_entry_add_suggest(entry, new_n); |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
365 gnt_entry_add_suggest(entry, new_a); |
13971
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
366 } |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
367 |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
368 static void |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
369 gg_chat_remove_user(GaimConversation *conv, GList *list) |
13971
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
370 { |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
371 /* XXX: Remove the name from string completion */ |
14091
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
372 GGConv *ggc = conv->ui_data; |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
373 GntEntry *entry = GNT_ENTRY(ggc->entry); |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
374 for (; list; list = list->next) |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
375 gnt_entry_remove_suggest(entry, list->data); |
13971
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
376 } |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
377 |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
378 static void |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
379 gg_chat_update_user(GaimConversation *conv, const char *user) |
13971
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
380 { |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
381 } |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
382 |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
383 static GaimConversationUiOps conv_ui_ops = |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
384 { |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
385 .create_conversation = gg_create_conversation, |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
386 .destroy_conversation = gg_destroy_conversation, |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
387 .write_chat = gg_write_chat, |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
388 .write_im = gg_write_im, |
13886
90eb736b4c26
[gaim-migrate @ 16366]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13885
diff
changeset
|
389 .write_conv = gg_write_conv, |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
390 .chat_add_users = gg_chat_add_users, |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
391 .chat_rename_user = gg_chat_rename_user, |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
392 .chat_remove_users = gg_chat_remove_user, |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
393 .chat_update_user = gg_chat_update_user, |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
394 .present = NULL, |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
395 .has_focus = NULL, |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
396 .custom_smiley_add = NULL, |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
397 .custom_smiley_write = NULL, |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
398 .custom_smiley_close = NULL |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
399 }; |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
400 |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
401 static void |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
402 destroy_ggconv(gpointer data) |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
403 { |
13971
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
404 GGConv *ggconv = data; |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
405 gnt_widget_destroy(ggconv->window); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
406 g_free(ggconv); |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
407 } |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
408 |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
409 GaimConversationUiOps *gg_conv_get_ui_ops() |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
410 { |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
411 return &conv_ui_ops; |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
412 } |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
413 |
13971
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
414 /* Xerox */ |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
415 static GaimCmdRet |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
416 say_command_cb(GaimConversation *conv, |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
417 const char *cmd, char **args, char **error, void *data) |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
418 { |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
419 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
420 gaim_conv_im_send(GAIM_CONV_IM(conv), args[0]); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
421 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
|
422 gaim_conv_chat_send(GAIM_CONV_CHAT(conv), args[0]); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
423 |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
424 return GAIM_CMD_RET_OK; |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
425 } |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
426 |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
427 /* Xerox */ |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
428 static GaimCmdRet |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
429 me_command_cb(GaimConversation *conv, |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
430 const char *cmd, char **args, char **error, void *data) |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
431 { |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
432 char *tmp; |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
433 |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
434 tmp = g_strdup_printf("/me %s", args[0]); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
435 |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
436 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
437 gaim_conv_im_send(GAIM_CONV_IM(conv), tmp); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
438 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
|
439 gaim_conv_chat_send(GAIM_CONV_CHAT(conv), tmp); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
440 |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
441 g_free(tmp); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
442 return GAIM_CMD_RET_OK; |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
443 } |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
444 |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
445 /* Xerox */ |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
446 static GaimCmdRet |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
447 debug_command_cb(GaimConversation *conv, |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
448 const char *cmd, char **args, char **error, void *data) |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
449 { |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
450 char *tmp, *markup; |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
451 GaimCmdStatus status; |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
452 |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
453 if (!g_ascii_strcasecmp(args[0], "version")) { |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
454 tmp = g_strdup_printf("me is using %s.", VERSION); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
455 markup = g_markup_escape_text(tmp, -1); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
456 |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
457 status = gaim_cmd_do_command(conv, tmp, markup, error); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
458 |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
459 g_free(tmp); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
460 g_free(markup); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
461 return status; |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
462 } else { |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
463 gaim_conversation_write(conv, NULL, _("Supported debug options are: version"), |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
464 GAIM_MESSAGE_NO_LOG|GAIM_MESSAGE_ERROR, time(NULL)); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
465 return GAIM_CMD_STATUS_OK; |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
466 } |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
467 } |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
468 |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
469 /* Xerox */ |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
470 static GaimCmdRet |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
471 clear_command_cb(GaimConversation *conv, |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
472 const char *cmd, char **args, char **error, void *data) |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
473 { |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
474 GGConv *ggconv = conv->ui_data; |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
475 gnt_text_view_clear(GNT_TEXT_VIEW(ggconv->tv)); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
476 return GAIM_CMD_STATUS_OK; |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
477 } |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
478 |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
479 /* Xerox */ |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
480 static GaimCmdRet |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
481 help_command_cb(GaimConversation *conv, |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
482 const char *cmd, char **args, char **error, void *data) |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
483 { |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
484 GList *l, *text; |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
485 GString *s; |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
486 |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
487 if (args[0] != NULL) { |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
488 s = g_string_new(""); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
489 text = gaim_cmd_help(conv, args[0]); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
490 |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
491 if (text) { |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
492 for (l = text; l; l = l->next) |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
493 if (l->next) |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
494 g_string_append_printf(s, "%s\n", (char *)l->data); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
495 else |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
496 g_string_append_printf(s, "%s", (char *)l->data); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
497 } else { |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
498 g_string_append(s, _("No such command (in this context).")); |
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 } else { |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
501 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
|
502 "The following commands are available in this context:\n")); |
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 text = gaim_cmd_list(conv); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
505 for (l = text; l; l = l->next) |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
506 if (l->next) |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
507 g_string_append_printf(s, "%s, ", (char *)l->data); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
508 else |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
509 g_string_append_printf(s, "%s.", (char *)l->data); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
510 g_list_free(text); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
511 } |
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 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
|
514 g_string_free(s, TRUE); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
515 |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
516 return GAIM_CMD_STATUS_OK; |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
517 } |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
518 |
14024
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
519 static GaimCmdRet |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
520 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
|
521 { |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
522 void (*callback)() = data; |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
523 callback(); |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
524 return GAIM_CMD_STATUS_OK; |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
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 void gg_conversation_init() |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
528 { |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
529 ggconvs = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, destroy_ggconv); |
13971
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
530 |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
531 gaim_prefs_add_none(PREF_ROOT); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
532 gaim_prefs_add_none(PREF_ROOT "/size"); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
533 gaim_prefs_add_int(PREF_ROOT "/size/width", 70); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
534 gaim_prefs_add_int(PREF_ROOT "/size/height", 20); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
535 gaim_prefs_add_none(PREF_ROOT "/position"); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
536 gaim_prefs_add_int(PREF_ROOT "/position/x", 0); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
537 gaim_prefs_add_int(PREF_ROOT "/position/y", 0); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
538 |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
539 /* Xerox the commands */ |
13971
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
540 gaim_cmd_register("say", "S", GAIM_CMD_P_DEFAULT, |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
541 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
542 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
|
543 gaim_cmd_register("me", "S", GAIM_CMD_P_DEFAULT, |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
544 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
545 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
|
546 gaim_cmd_register("debug", "w", GAIM_CMD_P_DEFAULT, |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
547 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
548 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
|
549 gaim_cmd_register("clear", "", GAIM_CMD_P_DEFAULT, |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
550 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
551 clear_command_cb, _("clear: Clears the conversation scrollback."), NULL); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
552 gaim_cmd_register("help", "w", GAIM_CMD_P_DEFAULT, |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
553 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
|
554 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
|
555 |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
556 /* Now some commands to bring up some other windows */ |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
557 gaim_cmd_register("plugins", "", GAIM_CMD_P_DEFAULT, |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
558 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
559 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
|
560 gaim_cmd_register("buddylist", "", GAIM_CMD_P_DEFAULT, |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
561 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
562 cmd_show_window, _("buddylist: Show the buddylist."), gg_blist_show); |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
563 gaim_cmd_register("accounts", "", GAIM_CMD_P_DEFAULT, |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
564 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
565 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
|
566 gaim_cmd_register("debugwin", "", GAIM_CMD_P_DEFAULT, |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
567 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
568 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
|
569 gaim_cmd_register("prefs", "", GAIM_CMD_P_DEFAULT, |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14047
diff
changeset
|
570 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14047
diff
changeset
|
571 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
|
572 gaim_cmd_register("status", "", GAIM_CMD_P_DEFAULT, |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14091
diff
changeset
|
573 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14091
diff
changeset
|
574 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
|
575 } |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
576 |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
577 void gg_conversation_uninit() |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
578 { |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
579 g_hash_table_destroy(ggconvs); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
580 ggconvs = NULL; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
581 } |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
582 |