* 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.
#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! */
short chanoppos; /* Position in the array */
} regchan;
+struct achievement_record;
+
/* Registered user */
typedef struct reguser {
#ifdef CS_PARANOID
(!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);
}
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)) {
* 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"