comment/comment.c
author Mikael Berthe <mikael@lilotux.net>
Sat, 13 Oct 2012 14:34:18 +0200
changeset 44 3f94f3522960
parent 40 5cd4b42ada91
permissions -rw-r--r--
[killpresence] Add a command /probe to send a presence probe
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
99fd216641d8 Add module "comment", autotools stuff...
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     1
/*
37
a05815df848c Update headers
Mikael Berthe <mikael@lilotux.net>
parents: 8
diff changeset
     2
 *  Module "comment"    -- adds a dummy /# command
a05815df848c Update headers
Mikael Berthe <mikael@lilotux.net>
parents: 8
diff changeset
     3
 *                        (ignore the rest of the command line)
a05815df848c Update headers
Mikael Berthe <mikael@lilotux.net>
parents: 8
diff changeset
     4
 *
a05815df848c Update headers
Mikael Berthe <mikael@lilotux.net>
parents: 8
diff changeset
     5
 * Copyright (C) 2010 Mikael Berthe <mikael@lilotux.net>
a05815df848c Update headers
Mikael Berthe <mikael@lilotux.net>
parents: 8
diff changeset
     6
 *
a05815df848c Update headers
Mikael Berthe <mikael@lilotux.net>
parents: 8
diff changeset
     7
 * This module is free software: you can redistribute it and/or modify
a05815df848c Update headers
Mikael Berthe <mikael@lilotux.net>
parents: 8
diff changeset
     8
 * it under the terms of the GNU General Public License as published by
a05815df848c Update headers
Mikael Berthe <mikael@lilotux.net>
parents: 8
diff changeset
     9
 * the Free Software Foundation, either version 2 of the License, or
a05815df848c Update headers
Mikael Berthe <mikael@lilotux.net>
parents: 8
diff changeset
    10
 * (at your option) any later version.
a05815df848c Update headers
Mikael Berthe <mikael@lilotux.net>
parents: 8
diff changeset
    11
 *
a05815df848c Update headers
Mikael Berthe <mikael@lilotux.net>
parents: 8
diff changeset
    12
 * This program is distributed in the hope that it will be useful,
a05815df848c Update headers
Mikael Berthe <mikael@lilotux.net>
parents: 8
diff changeset
    13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
a05815df848c Update headers
Mikael Berthe <mikael@lilotux.net>
parents: 8
diff changeset
    14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
a05815df848c Update headers
Mikael Berthe <mikael@lilotux.net>
parents: 8
diff changeset
    15
 * GNU General Public License for more details.
a05815df848c Update headers
Mikael Berthe <mikael@lilotux.net>
parents: 8
diff changeset
    16
 *
a05815df848c Update headers
Mikael Berthe <mikael@lilotux.net>
parents: 8
diff changeset
    17
 * You should have received a copy of the GNU General Public License
a05815df848c Update headers
Mikael Berthe <mikael@lilotux.net>
parents: 8
diff changeset
    18
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
a05815df848c Update headers
Mikael Berthe <mikael@lilotux.net>
parents: 8
diff changeset
    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... */