~registry/ngircd/testing

« back to all changes in this revision

Viewing changes to src/ngircd/irc-macros.h

  • Committer: DNS
  • Date: 2013-08-27 14:48:36 UTC
  • mfrom: (2671.5.8)
  • Revision ID: git-v1:bdb2850b399a7fac6a70fe24bd1f58dbd78cc307
Merge branch 'master' into testing

· Remove Conf_PreventLocalChans and Conf_PreventMLChans, obsolete now
· Remove RPL_HELP_MSG

Fixed conflicts with:
        doc/sample-ngircd.conf.tmpl
        man/ngircd.conf.5.tmpl
        src/ngircd/conf.c
        src/ngircd/irc-channel.c
        src/ngircd/irc-info.c
        src/ngircd/messages.h

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 * ngIRCd -- The Next Generation IRC Daemon
3
 
 * Copyright (c)2001-2013 Alexander Barton (alex@barton.de).
 
3
 * Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors.
4
4
 *
5
5
 * This program is free software; you can redistribute it and/or modify
6
6
 * it under the terms of the GNU General Public License as published by
24
24
 * return from the function.
25
25
 */
26
26
#define _IRC_ARGC_EQ_OR_RETURN_(Client, Req, Count) \
27
 
if (Req->argc != Count) \
 
27
if (Req->argc != Count) { \
 
28
        IRC_SetPenalty(Client, 2); \
28
29
        return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG, \
29
 
                                  Client_ID(Client), Req->command);
 
30
                                  Client_ID(Client), Req->command); \
 
31
}
30
32
 
31
33
/**
32
34
 * Make sure that number of passed parameters is less or equal than Max.
35
37
 * return from the function.
36
38
 */
37
39
#define _IRC_ARGC_LE_OR_RETURN_(Client, Req, Max) \
38
 
if (Req->argc > Max) \
 
40
if (Req->argc > Max) { \
 
41
        IRC_SetPenalty(Client, 2); \
39
42
        return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG, \
40
 
                                  Client_ID(Client), Req->command);
 
43
                                  Client_ID(Client), Req->command); \
 
44
}
41
45
 
42
46
/**
43
47
 * Make sure that number of passed parameters is greater or equal than Min.
46
50
 * return from the function.
47
51
 */
48
52
#define _IRC_ARGC_GE_OR_RETURN_(Client, Req, Min) \
49
 
if (Req->argc < Min) \
 
53
if (Req->argc < Min) { \
 
54
        IRC_SetPenalty(Client, 2); \
50
55
        return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG, \
51
 
                                  Client_ID(Client), Req->command);
 
56
                                  Client_ID(Client), Req->command); \
 
57
}
52
58
 
53
59
/**
54
60
 * Make sure that number of passed parameters is in between Min and Max.
57
63
 * parameters, send an error to the client and return from the function.
58
64
 */
59
65
#define _IRC_ARGC_BETWEEN_OR_RETURN_(Client, Req, Min, Max) \
60
 
if (Req->argc < Min || Req->argc > Max) \
 
66
if (Req->argc < Min || Req->argc > Max) { \
 
67
        IRC_SetPenalty(Client, 2); \
61
68
        return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG, \
62
 
                                  Client_ID(Client), Req->command);
 
69
                                  Client_ID(Client), Req->command); \
 
70
}
63
71
 
64
72
/**
65
73
 * Get sender of an IRC command.