Changeset 1d2125a in code for icb.c


Ignore:
Timestamp:
Mar 2, 2014, 1:50:57 AM (11 years ago)
Author:
Mike Belopuhov <mike@…>
Branches:
master
Children:
59a7416
Parents:
d554223
git-author:
Mike Belopuhov <mike@…> (03/02/14 01:48:34)
git-committer:
Mike Belopuhov <mike@…> (03/02/14 01:50:57)
Message:

Add support for the moderator table that specifies (currently up
to 50) users that are allowed to become moderators.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icb.c

    rd554223 r1d2125a  
    3535void   icb_login(struct icb_session *, char *, char *, char *);
    3636int    icb_dowho(struct icb_session *, struct icb_group *);
     37int    icb_modpermit(struct icb_session *);
    3738char  *icb_nextfield(char **);
    3839
     
    518519
    519520/*
     521 *  icb_modpermit: checks user against the moderators table if it has
     522 *                 been populated
     523 */
     524int
     525icb_modpermit(struct icb_session *is)
     526{
     527        extern char modtab[ICB_MTABLEN][ICB_MAXNICKLEN];
     528        extern int modtabcnt;
     529
     530        if (modtabcnt == 0 ||
     531            bsearch(is->nick, modtab, modtabcnt, ICB_MAXNICKLEN,
     532            (int (*)(const void *, const void *))strcmp))
     533                return (1);
     534        return (0);
     535}
     536
     537/*
    520538 *  icb_pass: passes moderation of group "ig" from "from" to "to",
    521539 *            returns -1 if "from" is not a moderator, 1 if passed
     
    530548                return (-1);
    531549        if (!from && !to)
     550                return (-1);
     551        if (to && !icb_modpermit(to))
    532552                return (-1);
    533553        ig->mod = to;
Note: See TracChangeset for help on using the changeset viewer.