author | Mikael Berthe <mikael@lilotux.net> |
Mon, 09 Jul 2012 21:18:32 +0200 | |
changeset 41 | 4e2be5f94743 |
parent 40 | 5cd4b42ada91 |
permissions | -rw-r--r-- |
1
99fd216641d8
Add module "comment", autotools stuff...
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
1 |
/* |
37 | 2 |
* Module "comment" -- adds a dummy /# command |
3 |
* (ignore the rest of the command line) |
|
4 |
* |
|
5 |
* Copyright (C) 2010 Mikael Berthe <mikael@lilotux.net> |
|
6 |
* |
|
7 |
* This module is free software: you can redistribute it and/or modify |
|
8 |
* it under the terms of the GNU General Public License as published by |
|
9 |
* the Free Software Foundation, either version 2 of the License, or |
|
10 |
* (at your option) any later version. |
|
11 |
* |
|
12 |
* This program is distributed in the hope that it will be useful, |
|
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 |
* GNU General Public License for more details. |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License |
|
18 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
19 |
*/ |
|
1
99fd216641d8
Add module "comment", autotools stuff...
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
20 |
|
99fd216641d8
Add module "comment", autotools stuff...
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
21 |
#include <mcabber/modules.h> |
99fd216641d8
Add module "comment", autotools stuff...
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
22 |
#include <mcabber/commands.h> |
99fd216641d8
Add module "comment", autotools stuff...
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
23 |
|
99fd216641d8
Add module "comment", autotools stuff...
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
24 |
static void comment_init(void); |
99fd216641d8
Add module "comment", autotools stuff...
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
25 |
static void comment_uninit(void); |
99fd216641d8
Add module "comment", autotools stuff...
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
26 |
|
99fd216641d8
Add module "comment", autotools stuff...
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
27 |
/* Module description */ |
99fd216641d8
Add module "comment", autotools stuff...
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
28 |
module_info_t info_comment = { |
8
53b0091ecd47
Update modules to the new API scheme
Mikael Berthe <mikael@lilotux.net>
parents:
1
diff
changeset
|
29 |
.branch = MCABBER_BRANCH, |
53b0091ecd47
Update modules to the new API scheme
Mikael Berthe <mikael@lilotux.net>
parents:
1
diff
changeset
|
30 |
.api = MCABBER_API_VERSION, |
53b0091ecd47
Update modules to the new API scheme
Mikael Berthe <mikael@lilotux.net>
parents:
1
diff
changeset
|
31 |
.version = "1.00", |
53b0091ecd47
Update modules to the new API scheme
Mikael Berthe <mikael@lilotux.net>
parents:
1
diff
changeset
|
32 |
.description = "Comment (no-op) pseudo-command\n" |
53b0091ecd47
Update modules to the new API scheme
Mikael Berthe <mikael@lilotux.net>
parents:
1
diff
changeset
|
33 |
"(Pretty useless!)", |
53b0091ecd47
Update modules to the new API scheme
Mikael Berthe <mikael@lilotux.net>
parents:
1
diff
changeset
|
34 |
.requires = NULL, |
53b0091ecd47
Update modules to the new API scheme
Mikael Berthe <mikael@lilotux.net>
parents:
1
diff
changeset
|
35 |
.init = comment_init, |
53b0091ecd47
Update modules to the new API scheme
Mikael Berthe <mikael@lilotux.net>
parents:
1
diff
changeset
|
36 |
.uninit = comment_uninit, |
53b0091ecd47
Update modules to the new API scheme
Mikael Berthe <mikael@lilotux.net>
parents:
1
diff
changeset
|
37 |
.next = NULL, |
1
99fd216641d8
Add module "comment", autotools stuff...
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
38 |
}; |
99fd216641d8
Add module "comment", autotools stuff...
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
39 |
|
40
5cd4b42ada91
Sync with current mcabber API
Mikael Berthe <mikael@lilotux.net>
parents:
37
diff
changeset
|
40 |
#ifdef MCABBER_API_HAVE_CMD_ID |
5cd4b42ada91
Sync with current mcabber API
Mikael Berthe <mikael@lilotux.net>
parents:
37
diff
changeset
|
41 |
static gpointer comment_cmdid; |
5cd4b42ada91
Sync with current mcabber API
Mikael Berthe <mikael@lilotux.net>
parents:
37
diff
changeset
|
42 |
#endif |
5cd4b42ada91
Sync with current mcabber API
Mikael Berthe <mikael@lilotux.net>
parents:
37
diff
changeset
|
43 |
|
1
99fd216641d8
Add module "comment", autotools stuff...
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
44 |
static void do_comment(char *args) |
99fd216641d8
Add module "comment", autotools stuff...
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
45 |
{ |
99fd216641d8
Add module "comment", autotools stuff...
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
46 |
/* This is actually a no-op! */ |
99fd216641d8
Add module "comment", autotools stuff...
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
47 |
} |
99fd216641d8
Add module "comment", autotools stuff...
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
48 |
|
99fd216641d8
Add module "comment", autotools stuff...
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
49 |
/* Initialization */ |
99fd216641d8
Add module "comment", autotools stuff...
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
50 |
static void comment_init(void) |
99fd216641d8
Add module "comment", autotools stuff...
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
51 |
{ |
99fd216641d8
Add module "comment", autotools stuff...
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
52 |
/* Add command */ |
40
5cd4b42ada91
Sync with current mcabber API
Mikael Berthe <mikael@lilotux.net>
parents:
37
diff
changeset
|
53 |
#ifdef MCABBER_API_HAVE_CMD_ID |
5cd4b42ada91
Sync with current mcabber API
Mikael Berthe <mikael@lilotux.net>
parents:
37
diff
changeset
|
54 |
comment_cmdid = cmd_add("#", "Ignore", 0, 0, do_comment, NULL); |
5cd4b42ada91
Sync with current mcabber API
Mikael Berthe <mikael@lilotux.net>
parents:
37
diff
changeset
|
55 |
#else |
1
99fd216641d8
Add module "comment", autotools stuff...
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
56 |
cmd_add("#", "Ignore", 0, 0, do_comment, NULL); |
40
5cd4b42ada91
Sync with current mcabber API
Mikael Berthe <mikael@lilotux.net>
parents:
37
diff
changeset
|
57 |
#endif |
1
99fd216641d8
Add module "comment", autotools stuff...
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
58 |
} |
99fd216641d8
Add module "comment", autotools stuff...
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
59 |
|
99fd216641d8
Add module "comment", autotools stuff...
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
60 |
/* Deinitialization */ |
99fd216641d8
Add module "comment", autotools stuff...
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
61 |
static void comment_uninit(void) |
99fd216641d8
Add module "comment", autotools stuff...
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
62 |
{ |
99fd216641d8
Add module "comment", autotools stuff...
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
63 |
/* Unregister command */ |
40
5cd4b42ada91
Sync with current mcabber API
Mikael Berthe <mikael@lilotux.net>
parents:
37
diff
changeset
|
64 |
#ifdef MCABBER_API_HAVE_CMD_ID |
5cd4b42ada91
Sync with current mcabber API
Mikael Berthe <mikael@lilotux.net>
parents:
37
diff
changeset
|
65 |
cmd_del(comment_cmdid); |
5cd4b42ada91
Sync with current mcabber API
Mikael Berthe <mikael@lilotux.net>
parents:
37
diff
changeset
|
66 |
#else |
1
99fd216641d8
Add module "comment", autotools stuff...
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
67 |
cmd_del("comment"); |
40
5cd4b42ada91
Sync with current mcabber API
Mikael Berthe <mikael@lilotux.net>
parents:
37
diff
changeset
|
68 |
#endif |
1
99fd216641d8
Add module "comment", autotools stuff...
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
69 |
} |
99fd216641d8
Add module "comment", autotools stuff...
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
70 |
|
99fd216641d8
Add module "comment", autotools stuff...
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
71 |
/* vim: set expandtab cindent cinoptions=>2\:2(0: For Vim users... */ |