Mercurial > pidgin.yaz
annotate console/gntconv.c @ 14261:bb060cdc23d1
[gaim-migrate @ 16943]
Get rid of this thread stuff. You can read the whole saga at
http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=201791
Basically we were working around some complicated library
interactions between d-bus and newer, threaded versions of
gnome-vfs. But the d-bus guys were awesome enough to make
our working around unnecessary
I'm seeing the following error printed to the console when
I click on on the Send To menu in conversation windows, but
I get this error with or without these threading changes.
I'm not sure what's up with that. I should point out that
our dnsquery.c stuff is calling g_thread_init() for both
Unix and Windows now (it didn't used to do that on Unix)
The error is:
GLib-GObject: gsignal.c:1713: handler `982' of instance `0xc6d960' is not blocked
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Mon, 21 Aug 2006 05:07:42 +0000 |
parents | e7de1f6d9f35 |
children | 1bd09d355f9e |
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 |
14222
8c13a650cef5
[gaim-migrate @ 16903]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14191
diff
changeset
|
239 pos = gnt_text_view_get_lines_below(GNT_TEXT_VIEW(ggconv->tv)); |
8c13a650cef5
[gaim-migrate @ 16903]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14191
diff
changeset
|
240 |
8c13a650cef5
[gaim-migrate @ 16903]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14191
diff
changeset
|
241 gnt_text_view_next_line(GNT_TEXT_VIEW(ggconv->tv)); |
8c13a650cef5
[gaim-migrate @ 16903]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14191
diff
changeset
|
242 |
14234
04bdbbefbd1d
[gaim-migrate @ 16916]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14222
diff
changeset
|
243 /* Unnecessary to print the timestamp for delayed message */ |
04bdbbefbd1d
[gaim-migrate @ 16916]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14222
diff
changeset
|
244 if (!(flags & GAIM_MESSAGE_DELAYED) && |
04bdbbefbd1d
[gaim-migrate @ 16916]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14222
diff
changeset
|
245 gaim_prefs_get_bool("/gaim/gnt/conversations/timestamps")) |
14060
81648c6aa918
[gaim-migrate @ 16678]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
246 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
|
247 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
|
248 if (who && *who && (flags & (GAIM_MESSAGE_SEND | GAIM_MESSAGE_RECV))) |
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 char * name = g_strdup_printf("%s: ", who); |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
251 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
|
252 name, GNT_TEXT_FLAG_BOLD); |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
253 g_free(name); |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
254 } |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
255 else |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
256 fl = GNT_TEXT_FLAG_DIM; |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
257 |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
258 if (flags & GAIM_MESSAGE_ERROR) |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
259 fl |= GNT_TEXT_FLAG_BOLD; |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
260 if (flags & GAIM_MESSAGE_NICK) |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
261 fl |= GNT_TEXT_FLAG_UNDERLINE; |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
262 |
14011
735c4e927eb8
[gaim-migrate @ 16603]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
263 /* XXX: Remove this workaround when textview can parse messages. */ |
735c4e927eb8
[gaim-migrate @ 16603]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
264 newline = gaim_strdup_withhtml(message); |
735c4e927eb8
[gaim-migrate @ 16603]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
265 strip = gaim_markup_strip_html(newline); |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
266 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
|
267 strip, fl); |
14030
0e70bb6d32fd
[gaim-migrate @ 16632]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
268 if (pos <= 1) |
0e70bb6d32fd
[gaim-migrate @ 16632]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14024
diff
changeset
|
269 gnt_text_view_scroll(GNT_TEXT_VIEW(ggconv->tv), 0); |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
270 |
14011
735c4e927eb8
[gaim-migrate @ 16603]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
271 g_free(newline); |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
272 g_free(strip); |
13897
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
273 |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
274 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
|
275 gnt_widget_set_urgent(ggconv->tv); |
13897
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 |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
278 static void |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
279 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
|
280 GaimMessageFlags flags, time_t mtime) |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
281 { |
14222
8c13a650cef5
[gaim-migrate @ 16903]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14191
diff
changeset
|
282 gaim_conversation_write(conv, who, message, flags, mtime); |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
283 } |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
284 |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
285 static void |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
286 gg_write_im(GaimConversation *conv, const char *who, const char *message, |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
287 GaimMessageFlags flags, time_t mtime) |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
288 { |
14008
d9fab56e6011
[gaim-migrate @ 16594]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13988
diff
changeset
|
289 GaimAccount *account = gaim_conversation_get_account(conv); |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
290 if (flags & GAIM_MESSAGE_SEND) |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
291 { |
13971
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
292 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
|
293 if (!who) |
13971
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
294 who = gaim_account_get_alias(account); |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
295 if (!who) |
13971
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
296 who = gaim_account_get_username(account); |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
297 } |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
298 else if (flags & GAIM_MESSAGE_RECV) |
14008
d9fab56e6011
[gaim-migrate @ 16594]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13988
diff
changeset
|
299 { |
d9fab56e6011
[gaim-migrate @ 16594]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13988
diff
changeset
|
300 GaimBuddy *buddy; |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
301 who = gaim_conversation_get_name(conv); |
14008
d9fab56e6011
[gaim-migrate @ 16594]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13988
diff
changeset
|
302 buddy = gaim_find_buddy(account, who); |
d9fab56e6011
[gaim-migrate @ 16594]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13988
diff
changeset
|
303 if (buddy) |
d9fab56e6011
[gaim-migrate @ 16594]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13988
diff
changeset
|
304 who = gaim_buddy_get_contact_alias(buddy); |
d9fab56e6011
[gaim-migrate @ 16594]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13988
diff
changeset
|
305 } |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
306 |
14222
8c13a650cef5
[gaim-migrate @ 16903]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14191
diff
changeset
|
307 gaim_conversation_write(conv, who, message, flags, mtime); |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
308 } |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
309 |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
310 static void |
13886
90eb736b4c26
[gaim-migrate @ 16366]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13885
diff
changeset
|
311 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
|
312 const char *message, GaimMessageFlags flags, time_t mtime) |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
313 { |
13897
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
314 const char *name; |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
315 if (alias && *alias) |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
316 name = alias; |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
317 else if (who && *who) |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
318 name = who; |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
319 else |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
320 name = NULL; |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
321 |
13897
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
322 gg_write_common(conv, name, message, flags, mtime); |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
323 } |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
324 |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
325 static void |
13971
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
326 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
|
327 { |
14091
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
328 GGConv *ggc = conv->ui_data; |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
329 GntEntry *entry = GNT_ENTRY(ggc->entry); |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
330 |
13971
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
331 if (!new_arrivals) |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
332 { |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
333 /* Print the list of users in the room */ |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
334 GString *string = g_string_new(_("List of users:\n")); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
335 GList *iter; |
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 for (iter = users; iter; iter = iter->next) |
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 GaimConvChatBuddy *cbuddy = iter->data; |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
340 char *str; |
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 if ((str = cbuddy->alias) == NULL) |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
343 str = cbuddy->name; |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
344 g_string_append_printf(string, "[ %s ]", str); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
345 } |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
346 |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
347 gaim_conversation_write(conv, NULL, string->str, |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
348 GAIM_MESSAGE_SYSTEM, time(NULL)); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
349 g_string_free(string, TRUE); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
350 } |
14091
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
351 |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
352 for (; users; users = users->next) |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
353 { |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
354 GaimConvChatBuddy *cbuddy = users->data; |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
355 gnt_entry_add_suggest(entry, cbuddy->name); |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
356 gnt_entry_add_suggest(entry, cbuddy->alias); |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
357 } |
13971
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
358 } |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
359 |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
360 static void |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
361 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
|
362 { |
14256
e7de1f6d9f35
[gaim-migrate @ 16938]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14234
diff
changeset
|
363 /* Update the name for string completion */ |
14091
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
364 GGConv *ggc = conv->ui_data; |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
365 GntEntry *entry = GNT_ENTRY(ggc->entry); |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
366 gnt_entry_remove_suggest(entry, old); |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
367 gnt_entry_add_suggest(entry, new_n); |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
368 gnt_entry_add_suggest(entry, new_a); |
13971
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
369 } |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
370 |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
371 static void |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
372 gg_chat_remove_user(GaimConversation *conv, GList *list) |
13971
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
373 { |
14256
e7de1f6d9f35
[gaim-migrate @ 16938]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14234
diff
changeset
|
374 /* Remove the name from string completion */ |
14091
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
375 GGConv *ggc = conv->ui_data; |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
376 GntEntry *entry = GNT_ENTRY(ggc->entry); |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
377 for (; list; list = list->next) |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
378 gnt_entry_remove_suggest(entry, list->data); |
13971
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 void |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
382 gg_chat_update_user(GaimConversation *conv, const char *user) |
13971
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
383 { |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
384 } |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
385 |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
386 static GaimConversationUiOps conv_ui_ops = |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
387 { |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
388 .create_conversation = gg_create_conversation, |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
389 .destroy_conversation = gg_destroy_conversation, |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
390 .write_chat = gg_write_chat, |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
391 .write_im = gg_write_im, |
13886
90eb736b4c26
[gaim-migrate @ 16366]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13885
diff
changeset
|
392 .write_conv = gg_write_conv, |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
393 .chat_add_users = gg_chat_add_users, |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
394 .chat_rename_user = gg_chat_rename_user, |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
395 .chat_remove_users = gg_chat_remove_user, |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
396 .chat_update_user = gg_chat_update_user, |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
397 .present = NULL, |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
398 .has_focus = NULL, |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
399 .custom_smiley_add = NULL, |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
400 .custom_smiley_write = NULL, |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
401 .custom_smiley_close = NULL |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
402 }; |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
403 |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
404 static void |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
405 destroy_ggconv(gpointer data) |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
406 { |
13971
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
407 GGConv *ggconv = data; |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
408 gnt_widget_destroy(ggconv->window); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
409 g_free(ggconv); |
13885
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 |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
412 GaimConversationUiOps *gg_conv_get_ui_ops() |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
413 { |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
414 return &conv_ui_ops; |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
415 } |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
416 |
13971
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
417 /* Xerox */ |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
418 static GaimCmdRet |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
419 say_command_cb(GaimConversation *conv, |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
420 const char *cmd, char **args, char **error, void *data) |
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 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
423 gaim_conv_im_send(GAIM_CONV_IM(conv), args[0]); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
424 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
|
425 gaim_conv_chat_send(GAIM_CONV_CHAT(conv), args[0]); |
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 return GAIM_CMD_RET_OK; |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
428 } |
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 /* Xerox */ |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
431 static GaimCmdRet |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
432 me_command_cb(GaimConversation *conv, |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
433 const char *cmd, char **args, char **error, void *data) |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
434 { |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
435 char *tmp; |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
436 |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
437 tmp = g_strdup_printf("/me %s", args[0]); |
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 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
440 gaim_conv_im_send(GAIM_CONV_IM(conv), tmp); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
441 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
|
442 gaim_conv_chat_send(GAIM_CONV_CHAT(conv), tmp); |
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 g_free(tmp); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
445 return GAIM_CMD_RET_OK; |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
446 } |
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 /* Xerox */ |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
449 static GaimCmdRet |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
450 debug_command_cb(GaimConversation *conv, |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
451 const char *cmd, char **args, char **error, void *data) |
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 char *tmp, *markup; |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
454 GaimCmdStatus status; |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
455 |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
456 if (!g_ascii_strcasecmp(args[0], "version")) { |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
457 tmp = g_strdup_printf("me is using %s.", VERSION); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
458 markup = g_markup_escape_text(tmp, -1); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
459 |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
460 status = gaim_cmd_do_command(conv, tmp, markup, error); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
461 |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
462 g_free(tmp); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
463 g_free(markup); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
464 return status; |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
465 } else { |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
466 gaim_conversation_write(conv, NULL, _("Supported debug options are: version"), |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
467 GAIM_MESSAGE_NO_LOG|GAIM_MESSAGE_ERROR, time(NULL)); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
468 return GAIM_CMD_STATUS_OK; |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
469 } |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
470 } |
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 /* Xerox */ |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
473 static GaimCmdRet |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
474 clear_command_cb(GaimConversation *conv, |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
475 const char *cmd, char **args, char **error, void *data) |
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 GGConv *ggconv = conv->ui_data; |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
478 gnt_text_view_clear(GNT_TEXT_VIEW(ggconv->tv)); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
479 return GAIM_CMD_STATUS_OK; |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
480 } |
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 /* Xerox */ |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
483 static GaimCmdRet |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
484 help_command_cb(GaimConversation *conv, |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
485 const char *cmd, char **args, char **error, void *data) |
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 GList *l, *text; |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
488 GString *s; |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
489 |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
490 if (args[0] != NULL) { |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
491 s = g_string_new(""); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
492 text = gaim_cmd_help(conv, args[0]); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
493 |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
494 if (text) { |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
495 for (l = text; l; l = l->next) |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
496 if (l->next) |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
497 g_string_append_printf(s, "%s\n", (char *)l->data); |
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 g_string_append_printf(s, "%s", (char *)l->data); |
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 g_string_append(s, _("No such command (in this context).")); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
502 } |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
503 } else { |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
504 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
|
505 "The following commands are available in this context:\n")); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
506 |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
507 text = gaim_cmd_list(conv); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
508 for (l = text; l; l = l->next) |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
509 if (l->next) |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
510 g_string_append_printf(s, "%s, ", (char *)l->data); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
511 else |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
512 g_string_append_printf(s, "%s.", (char *)l->data); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
513 g_list_free(text); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
514 } |
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 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
|
517 g_string_free(s, TRUE); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
518 |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
519 return GAIM_CMD_STATUS_OK; |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
520 } |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
521 |
14024
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
522 static GaimCmdRet |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
523 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
|
524 { |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
525 void (*callback)() = data; |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
526 callback(); |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
527 return GAIM_CMD_STATUS_OK; |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
528 } |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
529 |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
530 void gg_conversation_init() |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
531 { |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
532 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
|
533 |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
534 gaim_prefs_add_none(PREF_ROOT); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
535 gaim_prefs_add_none(PREF_ROOT "/size"); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
536 gaim_prefs_add_int(PREF_ROOT "/size/width", 70); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
537 gaim_prefs_add_int(PREF_ROOT "/size/height", 20); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
538 gaim_prefs_add_none(PREF_ROOT "/position"); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
539 gaim_prefs_add_int(PREF_ROOT "/position/x", 0); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
540 gaim_prefs_add_int(PREF_ROOT "/position/y", 0); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
541 |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14008
diff
changeset
|
542 /* Xerox the commands */ |
13971
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
543 gaim_cmd_register("say", "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 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
|
546 gaim_cmd_register("me", "S", 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 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
|
549 gaim_cmd_register("debug", "w", 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 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
|
552 gaim_cmd_register("clear", "", 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, NULL, |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
554 clear_command_cb, _("clear: Clears the conversation scrollback."), NULL); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
555 gaim_cmd_register("help", "w", GAIM_CMD_P_DEFAULT, |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13966
diff
changeset
|
556 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
|
557 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
|
558 |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
559 /* Now some commands to bring up some other windows */ |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
560 gaim_cmd_register("plugins", "", 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, _("plugins: Show the plugins window."), gg_plugins_show_all); |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
563 gaim_cmd_register("buddylist", "", 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, _("buddylist: Show the buddylist."), gg_blist_show); |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
566 gaim_cmd_register("accounts", "", 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, _("accounts: Show the accounts window."), gg_accounts_show_all); |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
569 gaim_cmd_register("debugwin", "", GAIM_CMD_P_DEFAULT, |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
570 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
571 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
|
572 gaim_cmd_register("prefs", "", GAIM_CMD_P_DEFAULT, |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14047
diff
changeset
|
573 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14047
diff
changeset
|
574 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
|
575 gaim_cmd_register("status", "", GAIM_CMD_P_DEFAULT, |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14091
diff
changeset
|
576 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14091
diff
changeset
|
577 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
|
578 } |
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
579 |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
580 void gg_conversation_uninit() |
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 g_hash_table_destroy(ggconvs); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
583 ggconvs = NULL; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
584 } |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
585 |