]> jfr.im git - irc/quakenet/newserv.git/commitdiff
ACHIEVEMENTS: Partial achievement update (performed in wrong tree)
authorsplidge <redacted>
Sat, 27 Mar 2010 15:05:18 +0000 (15:05 +0000)
committersplidge <redacted>
Sat, 27 Mar 2010 15:05:18 +0000 (15:05 +0000)
--HG--
branch : achievements

chanserv/chancmds/chanflags.c
chanserv/chanserv.h
chanserv/chanservstdcmds.c
chanserv/chanservuser.c
chanserv/usercmds/userflags.c

index 532765e94d2a93fec3e1d9a75a1076c400fb1f85..0e66e689ad2551260ad7e6692f3792b50afdbbaf 100644 (file)
@@ -28,6 +28,7 @@
  * CMDHELP:                command must be used instead.
  * CMDHELP:  +g AUTOVOICE  Automatically voices any user who has voice access when they join
  * CMDHELP:                the channel.  Same effect as giving all voices the +g chanlev flag.
+ * CMDHELP:  +h ACH'MENTS  Display achievement announcements in channel.
  * CMDHELP:  +j JOINED     Causes Q to remain on the channel.  Cannot be removed.
  * CMDHELP:  +k KNOWNONLY  Any user who joins the channel who is not known (+k) will be kicked.  
  * CMDHELP:                Unless channel mode +i is set they will be banned as well.
index 4a91cf71d6b9abb29f9595c80410a4a829fe0ea2..0799fdcbd4f919ec4b3f6b6b310a0fb86dc9424d 100644 (file)
 #define   QUFLAG_INFO          0x0400  /* +i */
 #define   QUFLAG_DELAYEDGLINE  0x0800  /* +G */
 #define   QUFLAG_NOAUTHLIMIT   0x1000  /* +L */
+#define   QUFLAG_ACHIEVEMENTS  0x2000  /* +c */
 #define   QUFLAG_CLEANUPEXEMPT 0x4000  /* +D */
 #define   QUFLAG_TRUST         0x8000  /* +T */
-#define   QUFLAG_ALL           0xdfff
+#define   QUFLAG_ALL           0xffff
 
 #define UIsNoInfo(x)        ((x)->flags & QUFLAG_NOINFO)
 #define UIsGline(x)         ((x)->flags & QUFLAG_GLINE)
 #define UIsNoAuthLimit(x)   ((x)->flags & QUFLAG_NOAUTHLIMIT)
 #define UIsCleanupExempt(x) ((x)->flags & QUFLAG_CLEANUPEXEMPT)
 #define UIsStaff(x)         ((x)->flags & QUFLAG_STAFF)
+#define UIsAchievements(x)  ((x)->flags & QUFLAG_ACHIEVEMENTS)
 
 #define UHasSuspension(x)   ((x)->flags & (QUFLAG_GLINE|QUFLAG_DELAYEDGLINE|QUFLAG_SUSPENDED))
 
 #define   QCFLAG_VOICEALL     0x1000  /* +v */
 #define   QCFLAG_WELCOME      0x2000  /* +w */
 #define   QCFLAG_SUSPENDED    0x4000  /* +z */
+#define   QCFLAG_ACHIEVEMENTS 0x8000  /* +h */
 
 #define CIsAutoOp(x)        ((x)->flags & QCFLAG_AUTOOP)
 #define CIsBitch(x)         ((x)->flags & QCFLAG_BITCH)
 #define CIsSuspended(x)     ((x)->flags & QCFLAG_SUSPENDED)
 #define CIsInfo(x)          ((x)->flags & QCFLAG_INFO)
 #define CIsNoInfo(x)        ((x)->flags & QCFLAG_NOINFO)
+#define CIsAchievements(x)  ((x)->flags & QCFLAG_ACHIEVEMENTS)
 
 #define CSetAutoOp(x)        ((x)->flags |= QCFLAG_AUTOOP)
 #define CSetBitch(x)         ((x)->flags |= QCFLAG_BITCH)
 #define   QCFLAG_USERCONTROL (QCFLAG_AUTOOP|QCFLAG_BITCH|QCFLAG_AUTOLIMIT| \
                               QCFLAG_ENFORCE|QCFLAG_FORCETOPIC|QCFLAG_AUTOVOICE| \
                               QCFLAG_PROTECT|QCFLAG_TOPICSAVE|QCFLAG_VOICEALL| \
-                              QCFLAG_WELCOME|QCFLAG_KNOWNONLY)
+                              QCFLAG_WELCOME|QCFLAG_KNOWNONLY|QCFLAG_ACHIEVEMENTS )
 
 #define   QCFLAG_ALL          0x7fff
 
 #define   QCMD_ALIAS          0x0100 /* Don't list on SHOWCOMMANDS */
 #define   QCMD_HIDDEN         QCMD_ALIAS
 
+#define   QCMD_ACHIEVEMENTS   0x0400 /* Allows access to achievement commands */
+
 #define   CS_INIT_DB          0x1    /* Loading database.. */
 #define   CS_INIT_NOUSER      0x2    /* Loaded DB, waiting for user to be created */
 #define   CS_INIT_READY       0x3    /* Ready for action! */
@@ -515,6 +521,8 @@ typedef struct regchan {
   short               chanoppos;                              /* Position in the array */  
 } regchan;
 
+struct achievement_record;
+
 /* Registered user */
 typedef struct reguser {
 #ifdef CS_PARANOID
index 1c0277c883897a78ed684670478594cb310980f5..88b0674ba4a95843a2a7a50b7fdfa76242122e18 100644 (file)
@@ -181,6 +181,25 @@ int cs_doshowcommands(void *source, int cargc, char **cargv) {
        (!rup || !UIsDev(rup) || !IsOper(sender)))
       continue;
     
+    /* Commands flagged QCMD_ACHIEVEMENTS:
+     *  Always invalid before 01/04/2010.
+     *  Valid after 02/04/2010 only if you have the flag set */
+    if (cmdlist[i]->level & QCMD_ACHIEVEMENTS) {
+      if (time(NULL) < ACHIEVEMENTS_START)
+        continue;
+      
+      if ((time(NULL) > 1270162800) && 
+        !UIsAchievements(rup))
+        continue;
+    }
+    
+    /* Commands flagged QCMD_TITLES:
+     *  Only valid on 01/04/2010. */
+    if ((cmdlist[i]->level & QCMD_TITLES) && 
+        ((time(NULL) < ACHIEVEMENTS_START) ||
+         (time(NULL) > ACHIEVEMENTS_END))))
+      continue;
+    
     /* We passed all the checks, send the message */    
     chanservsendmessage(sender, "%-20s %s",ct, message);
   }
index d3a1a31eb166513f90a1062c92470c23129848b2..5d3a655fbcaff6793f9b2c632b1daf013e203ece 100644 (file)
@@ -174,6 +174,20 @@ void chanservuserhandler(nick *target, int message, void **params) {
        break;
       }
       
+      if ((cmd->level & QCMD_ACHIEVEMENTS) && !UIsDev(rup) &&
+          ((time(NULL) < ACHIEVEMENTS_START) || 
+           ((time(NULL) > ACHIEVEMENTS_END) && !UIsAchievements(rup)))) {
+        chanservstdmessage(sender, QM_UNKNOWNCMD, cargv[0]);
+        break;
+      } 
+    
+      if ((cmd->level & QCMD_TITLES) && !UIsDev(rup) &&
+          ((time(NULL) < ACHIEVEMENTS_START) ||
+           (time(NULL) > ACHIEVEMENTS_END))) {
+        chanservstdmessage(sender, QM_UNKNOWNCMD, cargv[0]);
+        break;
+      }
+      
       cmd->calls++;
       
       if (cmd->maxparams < (cargc-1)) {
index 17b8a4cfd6cef9a1ef4037214a002705c7ed9ae2..9702143323aec955f9871cb570a3db3f656b097f 100644 (file)
  * CMDHELP: Changes your current user flags, where:
  * CMDHELP: flags - changes to apply, in the usual flag letters preceded by +/- format.
  * CMDHELP: Valid user flags are:
- * CMDHELP:  +n NOTICE  - causes the bot to sent you NOTICEs.  If this flag is not set the
- * CMDHELP:               bot will communicate using PRIVMSG.
+ * CMDHELP:  +c ACH'MENTS - enables achievements system - allows use of achievement commands
+ * CMDHELP:                 and sends achievement messages.
+ * CMDHELP:  +n NOTICE    - causes the bot to sent you NOTICEs.  If this flag is not set the
+ * CMDHELP:                 bot will communicate using PRIVMSG.
  */
 
 #include "../chanserv.h"