author | Mikael Berthe <mikael@lilotux.net> |
Sat, 13 Oct 2012 14:34:18 +0200 | |
changeset 44 | 3f94f3522960 |
parent 40 | 5cd4b42ada91 |
permissions | -rw-r--r-- |
21
9798e3aaa851
Add module extsayng, rename previous one to extsay_old
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
1 |
/* |
37 | 2 |
* Module "extsay" -- adds a /extsay command |
3 |
* Spawns an external editor, using screen |
|
4 |
* See the README file |
|
5 |
* |
|
6 |
* Copyright (C) 2010 Mikael Berthe <mikael@lilotux.net> |
|
7 |
* |
|
8 |
* This module is free software: you can redistribute it and/or modify |
|
9 |
* it under the terms of the GNU General Public License as published by |
|
10 |
* the Free Software Foundation, either version 2 of the License, or |
|
11 |
* (at your option) any later version. |
|
12 |
* |
|
13 |
* This program is distributed in the hope that it will be useful, |
|
14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
16 |
* GNU General Public License for more details. |
|
17 |
* |
|
18 |
* You should have received a copy of the GNU General Public License |
|
19 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
20 |
*/ |
|
21
9798e3aaa851
Add module extsayng, rename previous one to extsay_old
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
21 |
|
9798e3aaa851
Add module extsayng, rename previous one to extsay_old
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
22 |
#include <unistd.h> |
9798e3aaa851
Add module extsayng, rename previous one to extsay_old
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
23 |
#include <stdlib.h> |
29
b6fb487c2658
[extsay] Enable /extsay ./resourcename
Mikael Berthe <mikael@lilotux.net>
parents:
25
diff
changeset
|
24 |
#include <string.h> |
21
9798e3aaa851
Add module extsayng, rename previous one to extsay_old
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
25 |
#include <sys/wait.h> |
9798e3aaa851
Add module extsayng, rename previous one to extsay_old
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
26 |
#include <glib/gstdio.h> |
9798e3aaa851
Add module extsayng, rename previous one to extsay_old
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
27 |
|
9798e3aaa851
Add module extsayng, rename previous one to extsay_old
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
28 |
#include <mcabber/modules.h> |
9798e3aaa851
Add module extsayng, rename previous one to extsay_old
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
29 |
#include <mcabber/commands.h> |
9798e3aaa851
Add module extsayng, rename previous one to extsay_old
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
30 |
#include <mcabber/settings.h> |
9798e3aaa851
Add module extsayng, rename previous one to extsay_old
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
31 |
#include <mcabber/compl.h> |
25
a98004eb58cd
[extsay] Expand extsay_script_path path name
Mikael Berthe <mikael@lilotux.net>
parents:
24
diff
changeset
|
32 |
#include <mcabber/utils.h> |
21
9798e3aaa851
Add module extsayng, rename previous one to extsay_old
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
33 |
#include <mcabber/logprint.h> |
9798e3aaa851
Add module extsayng, rename previous one to extsay_old
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
34 |
|
35
337add12c399
Rename the extsayng module to extsay
Mikael Berthe <mikael@lilotux.net>
parents:
31
diff
changeset
|
35 |
static void extsay_init(void); |
337add12c399
Rename the extsayng module to extsay
Mikael Berthe <mikael@lilotux.net>
parents:
31
diff
changeset
|
36 |
static void extsay_uninit(void); |
21
9798e3aaa851
Add module extsayng, rename previous one to extsay_old
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
37 |
|
9798e3aaa851
Add module extsayng, rename previous one to extsay_old
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
38 |
/* Module description */ |
35
337add12c399
Rename the extsayng module to extsay
Mikael Berthe <mikael@lilotux.net>
parents:
31
diff
changeset
|
39 |
module_info_t info_extsay = { |
21
9798e3aaa851
Add module extsayng, rename previous one to extsay_old
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
40 |
.branch = MCABBER_BRANCH, |
9798e3aaa851
Add module extsayng, rename previous one to extsay_old
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
41 |
.api = MCABBER_API_VERSION, |
35
337add12c399
Rename the extsayng module to extsay
Mikael Berthe <mikael@lilotux.net>
parents:
31
diff
changeset
|
42 |
.version = "0.02", |
21
9798e3aaa851
Add module extsayng, rename previous one to extsay_old
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
43 |
.description = "Use external editor to send a message", |
9798e3aaa851
Add module extsayng, rename previous one to extsay_old
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
44 |
.requires = NULL, |
35
337add12c399
Rename the extsayng module to extsay
Mikael Berthe <mikael@lilotux.net>
parents:
31
diff
changeset
|
45 |
.init = extsay_init, |
337add12c399
Rename the extsayng module to extsay
Mikael Berthe <mikael@lilotux.net>
parents:
31
diff
changeset
|
46 |
.uninit = extsay_uninit, |
21
9798e3aaa851
Add module extsayng, rename previous one to extsay_old
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
47 |
.next = NULL, |
9798e3aaa851
Add module extsayng, rename previous one to extsay_old
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
48 |
}; |
9798e3aaa851
Add module extsayng, rename previous one to extsay_old
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
49 |
|
40
5cd4b42ada91
Sync with current mcabber API
Mikael Berthe <mikael@lilotux.net>
parents:
37
diff
changeset
|
50 |
#ifdef MCABBER_API_HAVE_CMD_ID |
5cd4b42ada91
Sync with current mcabber API
Mikael Berthe <mikael@lilotux.net>
parents:
37
diff
changeset
|
51 |
static gpointer extsay_cmdid; |
5cd4b42ada91
Sync with current mcabber API
Mikael Berthe <mikael@lilotux.net>
parents:
37
diff
changeset
|
52 |
#endif |
5cd4b42ada91
Sync with current mcabber API
Mikael Berthe <mikael@lilotux.net>
parents:
37
diff
changeset
|
53 |
|
24
81cbb47f1aa6
[extsay] Add options to split the screen window
Mikael Berthe <mikael@lilotux.net>
parents:
23
diff
changeset
|
54 |
|
81cbb47f1aa6
[extsay] Add options to split the screen window
Mikael Berthe <mikael@lilotux.net>
parents:
23
diff
changeset
|
55 |
// Run the external helper script with parameters |
23
cf95a475825c
[extsay] Multiple improvements
Mikael Berthe <mikael@lilotux.net>
parents:
21
diff
changeset
|
56 |
static void screen_run_script(const gchar *args) |
21
9798e3aaa851
Add module extsayng, rename previous one to extsay_old
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
57 |
{ |
9798e3aaa851
Add module extsayng, rename previous one to extsay_old
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
58 |
GError *err = NULL; |
24
81cbb47f1aa6
[extsay] Add options to split the screen window
Mikael Berthe <mikael@lilotux.net>
parents:
23
diff
changeset
|
59 |
gchar *argv[] = { "screen", "-r", "-X", "screen", NULL, |
81cbb47f1aa6
[extsay] Add options to split the screen window
Mikael Berthe <mikael@lilotux.net>
parents:
23
diff
changeset
|
60 |
NULL, NULL, NULL, NULL }; |
81cbb47f1aa6
[extsay] Add options to split the screen window
Mikael Berthe <mikael@lilotux.net>
parents:
23
diff
changeset
|
61 |
gchar strwinheight[32]; |
25
a98004eb58cd
[extsay] Expand extsay_script_path path name
Mikael Berthe <mikael@lilotux.net>
parents:
24
diff
changeset
|
62 |
gchar *fpath; |
a98004eb58cd
[extsay] Expand extsay_script_path path name
Mikael Berthe <mikael@lilotux.net>
parents:
24
diff
changeset
|
63 |
gboolean winsplit, ret; |
21
9798e3aaa851
Add module extsayng, rename previous one to extsay_old
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
64 |
|
24
81cbb47f1aa6
[extsay] Add options to split the screen window
Mikael Berthe <mikael@lilotux.net>
parents:
23
diff
changeset
|
65 |
// screen -r -X screen $path/extsay.sh [jid [winsplit [height]]] |
25
a98004eb58cd
[extsay] Expand extsay_script_path path name
Mikael Berthe <mikael@lilotux.net>
parents:
24
diff
changeset
|
66 |
fpath = (gchar*)settings_opt_get("extsay_script_path"); |
21
9798e3aaa851
Add module extsayng, rename previous one to extsay_old
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
67 |
|
24
81cbb47f1aa6
[extsay] Add options to split the screen window
Mikael Berthe <mikael@lilotux.net>
parents:
23
diff
changeset
|
68 |
// Helper script path |
25
a98004eb58cd
[extsay] Expand extsay_script_path path name
Mikael Berthe <mikael@lilotux.net>
parents:
24
diff
changeset
|
69 |
if (!fpath || !fpath[0]) { |
21
9798e3aaa851
Add module extsayng, rename previous one to extsay_old
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
70 |
scr_log_print(LPRINT_NORMAL, "Please set option 'extsay_script_path'."); |
9798e3aaa851
Add module extsayng, rename previous one to extsay_old
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
71 |
return; |
9798e3aaa851
Add module extsayng, rename previous one to extsay_old
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
72 |
} |
25
a98004eb58cd
[extsay] Expand extsay_script_path path name
Mikael Berthe <mikael@lilotux.net>
parents:
24
diff
changeset
|
73 |
fpath = expand_filename(fpath); |
a98004eb58cd
[extsay] Expand extsay_script_path path name
Mikael Berthe <mikael@lilotux.net>
parents:
24
diff
changeset
|
74 |
argv[4] = fpath; |
21
9798e3aaa851
Add module extsayng, rename previous one to extsay_old
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
75 |
|
24
81cbb47f1aa6
[extsay] Add options to split the screen window
Mikael Berthe <mikael@lilotux.net>
parents:
23
diff
changeset
|
76 |
// Helper script parameter #1 |
21
9798e3aaa851
Add module extsayng, rename previous one to extsay_old
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
77 |
if (args && *args) |
9798e3aaa851
Add module extsayng, rename previous one to extsay_old
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
78 |
argv[5] = (gchar*)args; |
9798e3aaa851
Add module extsayng, rename previous one to extsay_old
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
79 |
else |
9798e3aaa851
Add module extsayng, rename previous one to extsay_old
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
80 |
argv[5] = "."; |
9798e3aaa851
Add module extsayng, rename previous one to extsay_old
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
81 |
|
25
a98004eb58cd
[extsay] Expand extsay_script_path path name
Mikael Berthe <mikael@lilotux.net>
parents:
24
diff
changeset
|
82 |
// Update parameters for the helper script |
a98004eb58cd
[extsay] Expand extsay_script_path path name
Mikael Berthe <mikael@lilotux.net>
parents:
24
diff
changeset
|
83 |
winsplit = settings_opt_get_int("extsay_split_win"); |
24
81cbb47f1aa6
[extsay] Add options to split the screen window
Mikael Berthe <mikael@lilotux.net>
parents:
23
diff
changeset
|
84 |
if (winsplit) { |
81cbb47f1aa6
[extsay] Add options to split the screen window
Mikael Berthe <mikael@lilotux.net>
parents:
23
diff
changeset
|
85 |
gint winheight = settings_opt_get_int("extsay_win_height"); |
81cbb47f1aa6
[extsay] Add options to split the screen window
Mikael Berthe <mikael@lilotux.net>
parents:
23
diff
changeset
|
86 |
argv[6] = "winsplit"; // Helper script parameter #2 |
81cbb47f1aa6
[extsay] Add options to split the screen window
Mikael Berthe <mikael@lilotux.net>
parents:
23
diff
changeset
|
87 |
if (winheight > 0 && winheight < 256) { |
81cbb47f1aa6
[extsay] Add options to split the screen window
Mikael Berthe <mikael@lilotux.net>
parents:
23
diff
changeset
|
88 |
snprintf(strwinheight, sizeof strwinheight, "%d", winheight); |
81cbb47f1aa6
[extsay] Add options to split the screen window
Mikael Berthe <mikael@lilotux.net>
parents:
23
diff
changeset
|
89 |
argv[7] = strwinheight; // Helper script parameter #3 |
81cbb47f1aa6
[extsay] Add options to split the screen window
Mikael Berthe <mikael@lilotux.net>
parents:
23
diff
changeset
|
90 |
} |
81cbb47f1aa6
[extsay] Add options to split the screen window
Mikael Berthe <mikael@lilotux.net>
parents:
23
diff
changeset
|
91 |
} |
81cbb47f1aa6
[extsay] Add options to split the screen window
Mikael Berthe <mikael@lilotux.net>
parents:
23
diff
changeset
|
92 |
|
21
9798e3aaa851
Add module extsayng, rename previous one to extsay_old
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
93 |
ret = g_spawn_async(NULL, argv, NULL, |
23
cf95a475825c
[extsay] Multiple improvements
Mikael Berthe <mikael@lilotux.net>
parents:
21
diff
changeset
|
94 |
G_SPAWN_SEARCH_PATH | |
cf95a475825c
[extsay] Multiple improvements
Mikael Berthe <mikael@lilotux.net>
parents:
21
diff
changeset
|
95 |
G_SPAWN_STDOUT_TO_DEV_NULL|G_SPAWN_STDERR_TO_DEV_NULL, |
21
9798e3aaa851
Add module extsayng, rename previous one to extsay_old
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
96 |
NULL, NULL, NULL, &err); |
9798e3aaa851
Add module extsayng, rename previous one to extsay_old
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
97 |
|
9798e3aaa851
Add module extsayng, rename previous one to extsay_old
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
98 |
if (!ret) |
9798e3aaa851
Add module extsayng, rename previous one to extsay_old
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
99 |
scr_LogPrint(LPRINT_NORMAL, err->message); |
25
a98004eb58cd
[extsay] Expand extsay_script_path path name
Mikael Berthe <mikael@lilotux.net>
parents:
24
diff
changeset
|
100 |
|
a98004eb58cd
[extsay] Expand extsay_script_path path name
Mikael Berthe <mikael@lilotux.net>
parents:
24
diff
changeset
|
101 |
g_free(fpath); |
21
9798e3aaa851
Add module extsayng, rename previous one to extsay_old
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
102 |
} |
9798e3aaa851
Add module extsayng, rename previous one to extsay_old
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
103 |
|
35
337add12c399
Rename the extsayng module to extsay
Mikael Berthe <mikael@lilotux.net>
parents:
31
diff
changeset
|
104 |
static void do_extsay(gchar *args) |
21
9798e3aaa851
Add module extsayng, rename previous one to extsay_old
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
105 |
{ |
29
b6fb487c2658
[extsay] Enable /extsay ./resourcename
Mikael Berthe <mikael@lilotux.net>
parents:
25
diff
changeset
|
106 |
gboolean expandfjid = FALSE; |
30 | 107 |
gchar *fjid; |
23
cf95a475825c
[extsay] Multiple improvements
Mikael Berthe <mikael@lilotux.net>
parents:
21
diff
changeset
|
108 |
|
29
b6fb487c2658
[extsay] Enable /extsay ./resourcename
Mikael Berthe <mikael@lilotux.net>
parents:
25
diff
changeset
|
109 |
if (args && !strncmp(args, "." JID_RESOURCE_SEPARATORSTR, 2)) |
b6fb487c2658
[extsay] Enable /extsay ./resourcename
Mikael Berthe <mikael@lilotux.net>
parents:
25
diff
changeset
|
110 |
expandfjid = TRUE; |
b6fb487c2658
[extsay] Enable /extsay ./resourcename
Mikael Berthe <mikael@lilotux.net>
parents:
25
diff
changeset
|
111 |
|
b6fb487c2658
[extsay] Enable /extsay ./resourcename
Mikael Berthe <mikael@lilotux.net>
parents:
25
diff
changeset
|
112 |
if (!args || !*args || expandfjid || !g_strcmp0(args, ".")) { |
b6fb487c2658
[extsay] Enable /extsay ./resourcename
Mikael Berthe <mikael@lilotux.net>
parents:
25
diff
changeset
|
113 |
const gchar *res = args+2; |
b6fb487c2658
[extsay] Enable /extsay ./resourcename
Mikael Berthe <mikael@lilotux.net>
parents:
25
diff
changeset
|
114 |
gpointer bud; |
b6fb487c2658
[extsay] Enable /extsay ./resourcename
Mikael Berthe <mikael@lilotux.net>
parents:
25
diff
changeset
|
115 |
|
23
cf95a475825c
[extsay] Multiple improvements
Mikael Berthe <mikael@lilotux.net>
parents:
21
diff
changeset
|
116 |
if (!current_buddy) { |
cf95a475825c
[extsay] Multiple improvements
Mikael Berthe <mikael@lilotux.net>
parents:
21
diff
changeset
|
117 |
scr_LogPrint(LPRINT_NORMAL, "Please select a buddy."); |
cf95a475825c
[extsay] Multiple improvements
Mikael Berthe <mikael@lilotux.net>
parents:
21
diff
changeset
|
118 |
return; |
cf95a475825c
[extsay] Multiple improvements
Mikael Berthe <mikael@lilotux.net>
parents:
21
diff
changeset
|
119 |
} |
cf95a475825c
[extsay] Multiple improvements
Mikael Berthe <mikael@lilotux.net>
parents:
21
diff
changeset
|
120 |
|
cf95a475825c
[extsay] Multiple improvements
Mikael Berthe <mikael@lilotux.net>
parents:
21
diff
changeset
|
121 |
bud = BUDDATA(current_buddy); |
cf95a475825c
[extsay] Multiple improvements
Mikael Berthe <mikael@lilotux.net>
parents:
21
diff
changeset
|
122 |
if (!(buddy_gettype(bud) & |
cf95a475825c
[extsay] Multiple improvements
Mikael Berthe <mikael@lilotux.net>
parents:
21
diff
changeset
|
123 |
(ROSTER_TYPE_USER|ROSTER_TYPE_AGENT|ROSTER_TYPE_ROOM))) { |
cf95a475825c
[extsay] Multiple improvements
Mikael Berthe <mikael@lilotux.net>
parents:
21
diff
changeset
|
124 |
scr_LogPrint(LPRINT_NORMAL, "This is not a user."); |
cf95a475825c
[extsay] Multiple improvements
Mikael Berthe <mikael@lilotux.net>
parents:
21
diff
changeset
|
125 |
return; |
cf95a475825c
[extsay] Multiple improvements
Mikael Berthe <mikael@lilotux.net>
parents:
21
diff
changeset
|
126 |
} |
cf95a475825c
[extsay] Multiple improvements
Mikael Berthe <mikael@lilotux.net>
parents:
21
diff
changeset
|
127 |
|
cf95a475825c
[extsay] Multiple improvements
Mikael Berthe <mikael@lilotux.net>
parents:
21
diff
changeset
|
128 |
args = (gchar*)buddy_getjid(bud); |
29
b6fb487c2658
[extsay] Enable /extsay ./resourcename
Mikael Berthe <mikael@lilotux.net>
parents:
25
diff
changeset
|
129 |
if (expandfjid && *res) { |
30 | 130 |
char *res_utf8 = to_utf8(res); |
131 |
fjid = g_strdup_printf("%s%c%s", args, JID_RESOURCE_SEPARATOR, res_utf8); |
|
132 |
g_free(res_utf8); |
|
31
816373e58b6c
[extsay] Fix previous commit
Mikael Berthe <mikael@lilotux.net>
parents:
30
diff
changeset
|
133 |
} else { |
816373e58b6c
[extsay] Fix previous commit
Mikael Berthe <mikael@lilotux.net>
parents:
30
diff
changeset
|
134 |
fjid = g_strdup(args); |
29
b6fb487c2658
[extsay] Enable /extsay ./resourcename
Mikael Berthe <mikael@lilotux.net>
parents:
25
diff
changeset
|
135 |
} |
b6fb487c2658
[extsay] Enable /extsay ./resourcename
Mikael Berthe <mikael@lilotux.net>
parents:
25
diff
changeset
|
136 |
} else { |
30 | 137 |
fjid = to_utf8(args); |
23
cf95a475825c
[extsay] Multiple improvements
Mikael Berthe <mikael@lilotux.net>
parents:
21
diff
changeset
|
138 |
} |
cf95a475825c
[extsay] Multiple improvements
Mikael Berthe <mikael@lilotux.net>
parents:
21
diff
changeset
|
139 |
|
30 | 140 |
if (check_jid_syntax(fjid)) |
29
b6fb487c2658
[extsay] Enable /extsay ./resourcename
Mikael Berthe <mikael@lilotux.net>
parents:
25
diff
changeset
|
141 |
scr_LogPrint(LPRINT_NORMAL, "Please specify a valid Jabber ID."); |
b6fb487c2658
[extsay] Enable /extsay ./resourcename
Mikael Berthe <mikael@lilotux.net>
parents:
25
diff
changeset
|
142 |
else |
30 | 143 |
screen_run_script(fjid); // Launch helper script with resulting JID |
29
b6fb487c2658
[extsay] Enable /extsay ./resourcename
Mikael Berthe <mikael@lilotux.net>
parents:
25
diff
changeset
|
144 |
|
30 | 145 |
g_free(fjid); |
21
9798e3aaa851
Add module extsayng, rename previous one to extsay_old
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
146 |
} |
9798e3aaa851
Add module extsayng, rename previous one to extsay_old
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
147 |
|
35
337add12c399
Rename the extsayng module to extsay
Mikael Berthe <mikael@lilotux.net>
parents:
31
diff
changeset
|
148 |
static void extsay_init(void) |
21
9798e3aaa851
Add module extsayng, rename previous one to extsay_old
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
149 |
{ |
40
5cd4b42ada91
Sync with current mcabber API
Mikael Berthe <mikael@lilotux.net>
parents:
37
diff
changeset
|
150 |
#ifdef MCABBER_API_HAVE_CMD_ID |
5cd4b42ada91
Sync with current mcabber API
Mikael Berthe <mikael@lilotux.net>
parents:
37
diff
changeset
|
151 |
extsay_cmdid = cmd_add("extsay", "Use external editor to write a message", |
5cd4b42ada91
Sync with current mcabber API
Mikael Berthe <mikael@lilotux.net>
parents:
37
diff
changeset
|
152 |
COMPL_JID, 0, do_extsay, NULL); |
5cd4b42ada91
Sync with current mcabber API
Mikael Berthe <mikael@lilotux.net>
parents:
37
diff
changeset
|
153 |
#else |
21
9798e3aaa851
Add module extsayng, rename previous one to extsay_old
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
154 |
cmd_add("extsay", "Use external editor to write a message", |
35
337add12c399
Rename the extsayng module to extsay
Mikael Berthe <mikael@lilotux.net>
parents:
31
diff
changeset
|
155 |
COMPL_JID, 0, do_extsay, NULL); |
40
5cd4b42ada91
Sync with current mcabber API
Mikael Berthe <mikael@lilotux.net>
parents:
37
diff
changeset
|
156 |
#endif |
21
9798e3aaa851
Add module extsayng, rename previous one to extsay_old
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
157 |
} |
9798e3aaa851
Add module extsayng, rename previous one to extsay_old
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
158 |
|
35
337add12c399
Rename the extsayng module to extsay
Mikael Berthe <mikael@lilotux.net>
parents:
31
diff
changeset
|
159 |
static void extsay_uninit(void) |
21
9798e3aaa851
Add module extsayng, rename previous one to extsay_old
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
160 |
{ |
40
5cd4b42ada91
Sync with current mcabber API
Mikael Berthe <mikael@lilotux.net>
parents:
37
diff
changeset
|
161 |
#ifdef MCABBER_API_HAVE_CMD_ID |
5cd4b42ada91
Sync with current mcabber API
Mikael Berthe <mikael@lilotux.net>
parents:
37
diff
changeset
|
162 |
cmd_del(extsay_cmdid); |
5cd4b42ada91
Sync with current mcabber API
Mikael Berthe <mikael@lilotux.net>
parents:
37
diff
changeset
|
163 |
#else |
21
9798e3aaa851
Add module extsayng, rename previous one to extsay_old
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
164 |
cmd_del("extsay"); |
40
5cd4b42ada91
Sync with current mcabber API
Mikael Berthe <mikael@lilotux.net>
parents:
37
diff
changeset
|
165 |
#endif |
21
9798e3aaa851
Add module extsayng, rename previous one to extsay_old
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
166 |
} |
9798e3aaa851
Add module extsayng, rename previous one to extsay_old
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
167 |
|
9798e3aaa851
Add module extsayng, rename previous one to extsay_old
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
168 |
/* vim: set expandtab cindent cinoptions=>2\:2(0: For Vim users... */ |