Changeset 2be3612 in code


Ignore:
Timestamp:
Aug 30, 2017, 12:13:47 AM (8 years ago)
Author:
Mike Belopuhov <mike@…>
Branches:
master
Children:
4a74b5b
Parents:
614260f
git-author:
Mike Belopuhov <mike@…> (08/30/17 00:13:24)
git-committer:
Mike Belopuhov <mike@…> (08/30/17 00:13:47)
Message:

Allow moderators to pass moderation to other users

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cmd.c

    r614260f r2be3612  
    327327        char whom[ICB_MAXNICKLEN];
    328328
    329         if (!ig->mod) {         /* if there is no mod, try grabbing it */
    330                 if (icb_modpermit(is, 0) && icb_pass(ig, ig->mod, is) < 0)
    331                         icb_error(is, "Acquiring group moderation failed.");
    332         } else if (icb_ismod(ig, is)) {
     329        if (icb_ismod(ig, is)) {
     330                /*
     331                 * we're a current group moderator, allow to relinquish
     332                 * the right and to pass it down to everybody else.
     333                 */
    333334                if (strlen(arg) == 0) {
    334335                        /* no argument: relinquish moderator */
     
    345346                        return;
    346347                }
    347                 if (icb_modpermit(s, 0) && icb_pass(ig, ig->mod, s) < 0)
    348                         icb_error(s, "Acquiring group moderation failed.");
     348                if (icb_pass(ig, ig->mod, s) < 0)
     349                        icb_error(is, "Failed to pass group moderation.");
    349350        } else {
    350351                /*
    351352                 * if group is moderated and we're not the moderator,
    352353                 * but modtab is enabled, then check the permission
    353                  * and pass moderation if successful.
     354                 * and pass moderation if successful.  if there's no
     355                 * current moderator, don't enforce the modtab.
    354356                 */
    355                 if (icb_modpermit(is, 1) && icb_pass(ig, ig->mod, is) < 0)
    356                         icb_error(is, "Acquiring group moderation failed.");
     357                if (!icb_modpermit(is, ig->mod ? 1 : 0)) {
     358                        icb_error(is, "Operation not permitted.");
     359                        return;
     360                }
     361                if (icb_pass(ig, ig->mod, is) < 0)
     362                        icb_error(is, "Failed to acquire group moderation.");
    357363        }
    358364}
Note: See TracChangeset for help on using the changeset viewer.