author | Myhailo Danylenko <isbear@ukrpost.net> |
Thu, 25 Mar 2010 20:46:44 +0200 | |
changeset 17 | e26e6692b0d5 |
parent 16 | 19d13d97b3a1 |
child 18 | 887d772326a0 |
permissions | -rw-r--r-- |
0 | 1 |
/* |
2 |
* cmd.c -- Send shell command output as messages |
|
3 |
* |
|
4 |
* Copyrigth (C) 2009 Myhailo Danylenko <isbear@ukrpost.net> |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or modify |
|
7 |
* it under the terms of the GNU General Public License as published by |
|
8 |
* the Free Software Foundation; either version 2 of the License, or (at |
|
9 |
* your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, but |
|
12 |
* WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
14 |
* General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
|
19 |
* USA |
|
20 |
*/ |
|
21 |
||
22 |
#include <stdlib.h> |
|
23 |
#include <glib.h> |
|
24 |
#include <unistd.h> |
|
25 |
#include <errno.h> |
|
26 |
||
8
5771827a4976
Change mcabber headers naming convention
Myhailo Danylenko <isbear@ukrpost.net>
parents:
7
diff
changeset
|
27 |
#include <mcabber/commands.h> |
5771827a4976
Change mcabber headers naming convention
Myhailo Danylenko <isbear@ukrpost.net>
parents:
7
diff
changeset
|
28 |
#include <mcabber/logprint.h> |
5771827a4976
Change mcabber headers naming convention
Myhailo Danylenko <isbear@ukrpost.net>
parents:
7
diff
changeset
|
29 |
#include <mcabber/utils.h> |
5771827a4976
Change mcabber headers naming convention
Myhailo Danylenko <isbear@ukrpost.net>
parents:
7
diff
changeset
|
30 |
#include <mcabber/settings.h> |
5771827a4976
Change mcabber headers naming convention
Myhailo Danylenko <isbear@ukrpost.net>
parents:
7
diff
changeset
|
31 |
#include <mcabber/hbuf.h> |
5771827a4976
Change mcabber headers naming convention
Myhailo Danylenko <isbear@ukrpost.net>
parents:
7
diff
changeset
|
32 |
#include <mcabber/xmpp.h> |
5771827a4976
Change mcabber headers naming convention
Myhailo Danylenko <isbear@ukrpost.net>
parents:
7
diff
changeset
|
33 |
#include <mcabber/roster.h> |
15
891fc0779d50
New module loading scheme
Myhailo Danylenko <isbear@ukrpost.net>
parents:
13
diff
changeset
|
34 |
#include <mcabber/modules.h> |
891fc0779d50
New module loading scheme
Myhailo Danylenko <isbear@ukrpost.net>
parents:
13
diff
changeset
|
35 |
|
16
19d13d97b3a1
Use new module struct with api
Myhailo Danylenko <isbear@ukrpost.net>
parents:
15
diff
changeset
|
36 |
#include "config.h" |
19d13d97b3a1
Use new module struct with api
Myhailo Danylenko <isbear@ukrpost.net>
parents:
15
diff
changeset
|
37 |
|
15
891fc0779d50
New module loading scheme
Myhailo Danylenko <isbear@ukrpost.net>
parents:
13
diff
changeset
|
38 |
static void mcmd_init (void); |
891fc0779d50
New module loading scheme
Myhailo Danylenko <isbear@ukrpost.net>
parents:
13
diff
changeset
|
39 |
static void mcmd_uninit (void); |
891fc0779d50
New module loading scheme
Myhailo Danylenko <isbear@ukrpost.net>
parents:
13
diff
changeset
|
40 |
|
16
19d13d97b3a1
Use new module struct with api
Myhailo Danylenko <isbear@ukrpost.net>
parents:
15
diff
changeset
|
41 |
#define DESCRIPTION ( \ |
19d13d97b3a1
Use new module struct with api
Myhailo Danylenko <isbear@ukrpost.net>
parents:
15
diff
changeset
|
42 |
"Sends output of command to buddy\n" \ |
19d13d97b3a1
Use new module struct with api
Myhailo Danylenko <isbear@ukrpost.net>
parents:
15
diff
changeset
|
43 |
"Recognizes options cmd_shell, cmd_redirect_stderr, cmd_header and cmd_header_inline\n" \ |
19d13d97b3a1
Use new module struct with api
Myhailo Danylenko <isbear@ukrpost.net>
parents:
15
diff
changeset
|
44 |
"Provides command /cmd" ) |
19d13d97b3a1
Use new module struct with api
Myhailo Danylenko <isbear@ukrpost.net>
parents:
15
diff
changeset
|
45 |
|
19d13d97b3a1
Use new module struct with api
Myhailo Danylenko <isbear@ukrpost.net>
parents:
15
diff
changeset
|
46 |
static module_info_t info_cmd_experimental = { |
19d13d97b3a1
Use new module struct with api
Myhailo Danylenko <isbear@ukrpost.net>
parents:
15
diff
changeset
|
47 |
.branch = "experimental", |
17
e26e6692b0d5
Use new scr_* functions
Myhailo Danylenko <isbear@ukrpost.net>
parents:
16
diff
changeset
|
48 |
.api = 10, |
16
19d13d97b3a1
Use new module struct with api
Myhailo Danylenko <isbear@ukrpost.net>
parents:
15
diff
changeset
|
49 |
.version = PROJECT_VERSION, |
19d13d97b3a1
Use new module struct with api
Myhailo Danylenko <isbear@ukrpost.net>
parents:
15
diff
changeset
|
50 |
.description = DESCRIPTION, |
15
891fc0779d50
New module loading scheme
Myhailo Danylenko <isbear@ukrpost.net>
parents:
13
diff
changeset
|
51 |
.requires = NULL, |
891fc0779d50
New module loading scheme
Myhailo Danylenko <isbear@ukrpost.net>
parents:
13
diff
changeset
|
52 |
.init = mcmd_init, |
891fc0779d50
New module loading scheme
Myhailo Danylenko <isbear@ukrpost.net>
parents:
13
diff
changeset
|
53 |
.uninit = mcmd_uninit, |
16
19d13d97b3a1
Use new module struct with api
Myhailo Danylenko <isbear@ukrpost.net>
parents:
15
diff
changeset
|
54 |
.next = NULL, |
19d13d97b3a1
Use new module struct with api
Myhailo Danylenko <isbear@ukrpost.net>
parents:
15
diff
changeset
|
55 |
}; |
19d13d97b3a1
Use new module struct with api
Myhailo Danylenko <isbear@ukrpost.net>
parents:
15
diff
changeset
|
56 |
|
19d13d97b3a1
Use new module struct with api
Myhailo Danylenko <isbear@ukrpost.net>
parents:
15
diff
changeset
|
57 |
module_info_t info_cmd = { |
19d13d97b3a1
Use new module struct with api
Myhailo Danylenko <isbear@ukrpost.net>
parents:
15
diff
changeset
|
58 |
.branch = "dev", |
17
e26e6692b0d5
Use new scr_* functions
Myhailo Danylenko <isbear@ukrpost.net>
parents:
16
diff
changeset
|
59 |
.api = 11, |
16
19d13d97b3a1
Use new module struct with api
Myhailo Danylenko <isbear@ukrpost.net>
parents:
15
diff
changeset
|
60 |
.version = PROJECT_VERSION, |
19d13d97b3a1
Use new module struct with api
Myhailo Danylenko <isbear@ukrpost.net>
parents:
15
diff
changeset
|
61 |
.description = DESCRIPTION, |
19d13d97b3a1
Use new module struct with api
Myhailo Danylenko <isbear@ukrpost.net>
parents:
15
diff
changeset
|
62 |
.requires = NULL, |
19d13d97b3a1
Use new module struct with api
Myhailo Danylenko <isbear@ukrpost.net>
parents:
15
diff
changeset
|
63 |
.init = mcmd_init, |
19d13d97b3a1
Use new module struct with api
Myhailo Danylenko <isbear@ukrpost.net>
parents:
15
diff
changeset
|
64 |
.uninit = mcmd_uninit, |
19d13d97b3a1
Use new module struct with api
Myhailo Danylenko <isbear@ukrpost.net>
parents:
15
diff
changeset
|
65 |
.next = &info_cmd_experimental, |
15
891fc0779d50
New module loading scheme
Myhailo Danylenko <isbear@ukrpost.net>
parents:
13
diff
changeset
|
66 |
}; |
0 | 67 |
|
68 |
typedef struct { |
|
69 |
gchar *jid; |
|
70 |
GString *input; |
|
5 | 71 |
gchar *subject; |
72 |
guint seq; |
|
0 | 73 |
guint source; |
74 |
GIOChannel *channel; |
|
75 |
} cmd_cb_t; |
|
76 |
||
5 | 77 |
static GSList *cmd_channels = NULL; |
78 |
||
79 |
static gboolean is_room (const gchar *jid) |
|
80 |
{ |
|
81 |
return roster_find (jid, jidsearch, ROSTER_TYPE_ROOM) ? TRUE : FALSE; |
|
82 |
} |
|
83 |
||
84 |
static gboolean cmd_send_msg (const gchar *to, const gchar *subject, const gchar *body) |
|
85 |
{ |
|
86 |
gboolean room = is_room (to); |
|
87 |
gpointer xep184 = NULL; |
|
88 |
gint crypted; |
|
89 |
||
90 |
xmpp_send_msg (to, body, room ? ROSTER_TYPE_ROOM : ROSTER_TYPE_USER, room ? NULL : subject, FALSE /* ? */, &crypted, LM_MESSAGE_SUB_TYPE_NOT_SET, &xep184); |
|
91 |
||
92 |
if (crypted == -1) { |
|
17
e26e6692b0d5
Use new scr_* functions
Myhailo Danylenko <isbear@ukrpost.net>
parents:
16
diff
changeset
|
93 |
scr_log_print (LPRINT_LOGNORM, "cmd: Encryption error. Message not sent."); |
5 | 94 |
return FALSE; |
95 |
} |
|
96 |
||
6
8e64b6d3302e
Fix outgoing message header displaying
Myhailo Danylenko <isbear@ukrpost.net>
parents:
5
diff
changeset
|
97 |
if (!room) { |
8e64b6d3302e
Fix outgoing message header displaying
Myhailo Danylenko <isbear@ukrpost.net>
parents:
5
diff
changeset
|
98 |
if (subject) { |
8e64b6d3302e
Fix outgoing message header displaying
Myhailo Danylenko <isbear@ukrpost.net>
parents:
5
diff
changeset
|
99 |
gchar *hbody = g_strdup_printf ("[%s]\n%s", subject, body); |
8e64b6d3302e
Fix outgoing message header displaying
Myhailo Danylenko <isbear@ukrpost.net>
parents:
5
diff
changeset
|
100 |
hk_message_out (to, NULL, 0, hbody, crypted, xep184); |
8e64b6d3302e
Fix outgoing message header displaying
Myhailo Danylenko <isbear@ukrpost.net>
parents:
5
diff
changeset
|
101 |
g_free (hbody); |
8e64b6d3302e
Fix outgoing message header displaying
Myhailo Danylenko <isbear@ukrpost.net>
parents:
5
diff
changeset
|
102 |
} else |
8e64b6d3302e
Fix outgoing message header displaying
Myhailo Danylenko <isbear@ukrpost.net>
parents:
5
diff
changeset
|
103 |
hk_message_out (to, NULL, 0, body, crypted, xep184); |
8e64b6d3302e
Fix outgoing message header displaying
Myhailo Danylenko <isbear@ukrpost.net>
parents:
5
diff
changeset
|
104 |
} |
5 | 105 |
|
106 |
return TRUE; |
|
107 |
} |
|
0 | 108 |
|
109 |
static gboolean cmd_reader (GIOChannel *channel, GIOCondition condition, gpointer data) |
|
110 |
{ |
|
111 |
cmd_cb_t *cb = (cmd_cb_t *) data; |
|
112 |
||
113 |
if (condition & (G_IO_IN|G_IO_PRI)) { |
|
5 | 114 |
GIOStatus chstat; |
115 |
static gchar buf[HBB_BLOCKSIZE]; |
|
116 |
gsize endpos; |
|
117 |
GError *error = NULL; |
|
0 | 118 |
|
5 | 119 |
chstat = g_io_channel_read_chars (channel, buf, HBB_BLOCKSIZE, &endpos, &error); |
120 |
||
121 |
if (error) { |
|
17
e26e6692b0d5
Use new scr_* functions
Myhailo Danylenko <isbear@ukrpost.net>
parents:
16
diff
changeset
|
122 |
scr_log_print (LPRINT_DEBUG, "cmd: Reading error: %s.", error -> message); |
5 | 123 |
g_clear_error (&error); |
124 |
} |
|
0 | 125 |
|
126 |
if (chstat == G_IO_STATUS_ERROR || chstat == G_IO_STATUS_EOF) { |
|
127 |
cb->source = 0; |
|
128 |
return FALSE; // XXX |
|
129 |
} |
|
130 |
||
131 |
if (endpos) { |
|
132 |
GString *input = cb->input; |
|
133 |
gsize bread = 0; |
|
134 |
gsize written = 0; |
|
135 |
gchar *utf8 = NULL; |
|
136 |
||
137 |
g_string_append_len (input, buf, endpos); |
|
138 |
||
11
fafc922963f5
Use xmpp_is_online if available
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
139 |
if (!xmpp_is_online ()) { |
17
e26e6692b0d5
Use new scr_* functions
Myhailo Danylenko <isbear@ukrpost.net>
parents:
16
diff
changeset
|
140 |
scr_log_print (LPRINT_LOGNORM, "cmd: Connection is not ready, delaying data"); |
0 | 141 |
return TRUE; |
142 |
} |
|
143 |
||
144 |
// usual g_locale_to_utf8 seem to be unable to detect locale charset |
|
145 |
// maybe, proper solution will be to call setlocale on module loading, |
|
146 |
// but mcabber already does this, and I do not want to mess with it |
|
5 | 147 |
utf8 = g_convert (input->str, input->len, LocaleCharSet, "UTF-8", &bread, &written, &error); |
0 | 148 |
|
5 | 149 |
if (error && error->code == G_CONVERT_ERROR_ILLEGAL_SEQUENCE && bread) { |
0 | 150 |
written = 0; |
5 | 151 |
g_clear_error (&error); |
152 |
utf8 = g_convert (input->str, bread, LocaleCharSet, "UTF-8", &bread, &written, &error); |
|
0 | 153 |
} |
154 |
||
155 |
if (written) { |
|
156 |
gsize sent = 0; |
|
157 |
||
158 |
while (sent < written) { |
|
159 |
gsize len = 0; |
|
160 |
gchar *bbuf = NULL; |
|
5 | 161 |
gchar *subject = NULL; |
162 |
gboolean ret; |
|
0 | 163 |
|
164 |
if (written - sent > HBB_BLOCKSIZE) { |
|
165 |
gchar *c = utf8 + sent + HBB_BLOCKSIZE; |
|
166 |
c = g_utf8_find_prev_char (utf8 + sent, c); |
|
167 |
||
168 |
if (!c) { |
|
17
e26e6692b0d5
Use new scr_* functions
Myhailo Danylenko <isbear@ukrpost.net>
parents:
16
diff
changeset
|
169 |
scr_log_print (LPRINT_LOGNORM, "cmd: Cannot determine utf8 character end! End of data chunk will be discarded!"); |
0 | 170 |
break; |
171 |
} |
|
172 |
||
173 |
len = c - utf8 - sent; |
|
174 |
bbuf = g_strndup (utf8 + sent, len); |
|
175 |
} |
|
176 |
||
5 | 177 |
cb -> seq += 1; |
0 | 178 |
|
5 | 179 |
if (cb -> subject) |
180 |
subject = g_strdup_printf (cb -> subject, cb -> seq); |
|
0 | 181 |
|
5 | 182 |
if (!cmd_send_msg (cb->jid, subject, len ? bbuf : (utf8 + sent))) |
17
e26e6692b0d5
Use new scr_* functions
Myhailo Danylenko <isbear@ukrpost.net>
parents:
16
diff
changeset
|
183 |
scr_log_print (LPRINT_LOGNORM, "cmd: Encryption error. Message not sent."); |
0 | 184 |
|
5 | 185 |
if (subject) |
186 |
g_free (subject); |
|
0 | 187 |
|
188 |
if (!len) |
|
189 |
break; |
|
190 |
||
191 |
g_free (bbuf); |
|
192 |
||
193 |
sent += len; |
|
194 |
} |
|
195 |
||
196 |
g_free (utf8); |
|
197 |
||
198 |
g_string_erase (input, 0, bread); |
|
199 |
||
200 |
} else { |
|
201 |
||
17
e26e6692b0d5
Use new scr_* functions
Myhailo Danylenko <isbear@ukrpost.net>
parents:
16
diff
changeset
|
202 |
scr_log_print (LPRINT_LOGNORM, "cmd: Character conversion error: %s", error->message); |
5 | 203 |
g_error_free (error); |
0 | 204 |
cb->source = 0; |
205 |
return FALSE; |
|
206 |
} |
|
207 |
} |
|
208 |
||
209 |
} else if (condition & (G_IO_ERR|G_IO_NVAL|G_IO_HUP)) { |
|
210 |
cb->source = 0; |
|
211 |
return FALSE; // XXX |
|
212 |
} |
|
213 |
||
214 |
return TRUE; |
|
215 |
} |
|
216 |
||
217 |
static void cmd_destroy_data (gpointer data) |
|
218 |
{ |
|
219 |
cmd_cb_t *cb = (cmd_cb_t *) data; |
|
220 |
||
221 |
cmd_channels = g_slist_remove (cmd_channels, data); |
|
222 |
||
5 | 223 |
if (cb->source) |
224 |
g_source_remove (cb->source); |
|
0 | 225 |
if (cb->channel) |
226 |
g_io_channel_unref (cb->channel); |
|
5 | 227 |
if (cb -> subject) |
228 |
g_free (cb -> subject); |
|
0 | 229 |
g_free (cb->jid); |
230 |
g_free (cb); |
|
231 |
} |
|
232 |
||
233 |
static void do_cmd (char *arg) |
|
234 |
{ |
|
235 |
int fd[2]; |
|
236 |
const char *jid = CURRENT_JID; |
|
237 |
||
238 |
if (!*arg) |
|
239 |
return; |
|
240 |
||
241 |
if (!jid) { |
|
17
e26e6692b0d5
Use new scr_* functions
Myhailo Danylenko <isbear@ukrpost.net>
parents:
16
diff
changeset
|
242 |
scr_log_print (LPRINT_LOGNORM, "Unsuitable buddy selected."); |
0 | 243 |
return; |
244 |
} |
|
245 |
||
246 |
if (pipe (fd)) { |
|
17
e26e6692b0d5
Use new scr_* functions
Myhailo Danylenko <isbear@ukrpost.net>
parents:
16
diff
changeset
|
247 |
scr_log_print (LPRINT_LOGNORM, "Cannot create pipe: %s.", strerror (errno)); |
0 | 248 |
return; |
249 |
} |
|
250 |
||
251 |
{ |
|
5 | 252 |
GIOChannel *channel; |
253 |
int res = fork (); |
|
0 | 254 |
|
255 |
if (!res) { |
|
256 |
||
257 |
close (fd[0]); |
|
258 |
dup2 (fd[1], STDOUT_FILENO); |
|
259 |
if (settings_opt_get_int ("cmd_redirect_stderr")) |
|
260 |
dup2 (fd[1], STDERR_FILENO); |
|
261 |
else |
|
262 |
close (STDERR_FILENO); |
|
263 |
close (STDIN_FILENO); |
|
264 |
close (fd[1]); |
|
265 |
||
266 |
{ |
|
267 |
const char *shell = settings_opt_get ("cmd_shell"); |
|
268 |
if (!shell) |
|
269 |
shell = getenv ("SHELL"); |
|
270 |
if (!shell) |
|
271 |
shell = "sh"; |
|
272 |
execl (shell, shell, "-c", arg, NULL); |
|
273 |
} |
|
274 |
} |
|
275 |
||
276 |
if (res == -1) { |
|
17
e26e6692b0d5
Use new scr_* functions
Myhailo Danylenko <isbear@ukrpost.net>
parents:
16
diff
changeset
|
277 |
scr_log_print (LPRINT_NORMAL, "Cannot fork child: %s.", strerror (errno)); |
0 | 278 |
close (fd[0]); |
279 |
close (fd[1]); |
|
280 |
return; |
|
281 |
} |
|
282 |
||
283 |
close (fd[1]); |
|
284 |
||
5 | 285 |
{ |
286 |
GError *error = NULL; |
|
287 |
||
288 |
channel = g_io_channel_unix_new (fd[0]); |
|
0 | 289 |
|
5 | 290 |
g_io_channel_set_encoding (channel, NULL, &error); |
291 |
if (error) { |
|
17
e26e6692b0d5
Use new scr_* functions
Myhailo Danylenko <isbear@ukrpost.net>
parents:
16
diff
changeset
|
292 |
scr_log_print (LPRINT_DEBUG, "cmd: Cannot unset channel encoding: %s.", error -> message); |
5 | 293 |
g_clear_error (&error); |
294 |
} |
|
295 |
g_io_channel_set_buffered (channel, FALSE); |
|
296 |
g_io_channel_set_flags (channel, G_IO_FLAG_NONBLOCK, &error); |
|
297 |
if (error) { |
|
17
e26e6692b0d5
Use new scr_* functions
Myhailo Danylenko <isbear@ukrpost.net>
parents:
16
diff
changeset
|
298 |
scr_log_print (LPRINT_DEBUG, "cmd: Cannot set nonblocking flag on channel: %s.", error -> message); |
5 | 299 |
g_error_free (error); |
300 |
} |
|
301 |
g_io_channel_set_close_on_unref (channel, TRUE); |
|
302 |
} |
|
0 | 303 |
|
304 |
{ |
|
305 |
cmd_cb_t *cb = g_new (cmd_cb_t, 1); |
|
306 |
||
5 | 307 |
if (settings_opt_get_int ("cmd_header")) { |
7 | 308 |
if (settings_opt_get_int ("cmd_header_inline") || is_room (jid)) { |
5 | 309 |
gchar *mesg = g_strdup_printf ("$ %s", arg); |
310 |
gchar *utf = to_utf8 (mesg); |
|
311 |
g_free (mesg); |
|
312 |
cmd_send_msg (jid, NULL, utf); |
|
313 |
g_free (utf); |
|
314 |
cb -> subject = NULL; |
|
315 |
} else { |
|
316 |
gchar *header = g_strdup_printf ("[%%02d] $ %s", arg); |
|
317 |
cb -> subject = to_utf8 (header); |
|
318 |
g_free (header); |
|
319 |
} |
|
320 |
} |
|
321 |
||
322 |
cb -> jid = g_strdup (jid); |
|
323 |
cb -> input = g_string_new (NULL); |
|
324 |
cb -> seq = 0; |
|
325 |
cb -> channel = channel; |
|
326 |
cb -> source = g_io_add_watch_full (channel, 0, G_IO_IN|G_IO_ERR|G_IO_HUP|G_IO_NVAL, |
|
327 |
cmd_reader, (gpointer) cb, cmd_destroy_data); |
|
0 | 328 |
|
329 |
cmd_channels = g_slist_append (cmd_channels, cb); |
|
330 |
} |
|
331 |
} |
|
332 |
} |
|
333 |
||
15
891fc0779d50
New module loading scheme
Myhailo Danylenko <isbear@ukrpost.net>
parents:
13
diff
changeset
|
334 |
static void mcmd_init (void) |
0 | 335 |
{ |
336 |
cmd_add ("cmd", "", 0, 0, do_cmd, NULL); |
|
337 |
} |
|
338 |
||
15
891fc0779d50
New module loading scheme
Myhailo Danylenko <isbear@ukrpost.net>
parents:
13
diff
changeset
|
339 |
static void mcmd_uninit (void) |
0 | 340 |
{ |
341 |
GSList *sel; |
|
342 |
||
343 |
cmd_del ("cmd"); |
|
344 |
||
345 |
for (sel = cmd_channels; sel; sel = sel->next) { |
|
346 |
cmd_cb_t *cb = (cmd_cb_t *) sel->data; |
|
347 |
if (cb->source) |
|
348 |
g_source_remove (cb->source); |
|
349 |
if (cb->channel) |
|
350 |
g_io_channel_unref (cb->channel); |
|
351 |
g_free (cb->jid); |
|
352 |
g_free (cb); |
|
353 |
} |
|
354 |
||
355 |
g_slist_free (cmd_channels); |
|
356 |
} |
|
357 |
||
358 |
/* vim: se ts=4 sw=4: */ |