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