Jelajahi Sumber

* Add a DP_PLAY queue which is the lowest priority, but is burstable, allowing double messages and 10,000 messages. (ASCII)

Bryan Drewery 16 tahun lalu
induk
melakukan
cac6f2c6a0
4 mengubah file dengan 24 tambahan dan 14 penghapusan
  1. 1 0
      src/dccutil.c
  2. 1 0
      src/dccutil.h
  3. 8 1
      src/mod/server.mod/cmdsserv.c
  4. 14 13
      src/mod/server.mod/server.c

+ 1 - 0
src/dccutil.c

@@ -299,6 +299,7 @@ dprintf(int idx, const char *format, ...)
       case DP_SERVER:
       case DP_HELP:
       case DP_MODE:
+      case DP_PLAY:
       case DP_MODE_NEXT:
       case DP_SERVER_NEXT:
       case DP_HELP_NEXT:

+ 1 - 0
src/dccutil.h

@@ -32,6 +32,7 @@ namespace bd {
 #define DP_HELP_NEXT    0x7FF9
 #define DP_DUMP		0x8000
 #define DP_CACHE	0x8001
+#define DP_PLAY		0x8002
 
 
 

+ 8 - 1
src/mod/server.mod/cmdsserv.c

@@ -115,10 +115,11 @@ static void cmd_clearqueue(int idx, char *par)
     return;
   }
   if (!strcasecmp(par, "all")) {
-    msgs = modeq.tot + mq.tot + hq.tot;
+    msgs = modeq.tot + mq.tot + hq.tot + aq.tot;
     msgq_clear(&modeq);
     msgq_clear(&mq);
     msgq_clear(&hq);
+    msgq_clear(&aq);
     burst = 0;
     double_warned = 0;
     dprintf(idx, "Removed %d message%s from all queues.\n", msgs, 
@@ -137,6 +138,12 @@ static void cmd_clearqueue(int idx, char *par)
     double_warned = 0;
     dprintf(idx, "Removed %d message%s from the help queue.\n", msgs,
         (msgs != 1) ? "s" : "");
+  } else if (!strcasecmp(par, "play")) {
+    msgs = aq.tot;
+    msgq_clear(&aq);
+    double_warned = 0;
+    dprintf(idx, "Removed %d message%s from the play queue.\n", msgs,
+        (msgs != 1) ? "s" : "");
   } else if (!strcasecmp(par, "server")) {
     msgs = mq.tot;
     msgq_clear(&mq);

+ 14 - 13
src/mod/server.mod/server.c

@@ -123,7 +123,7 @@ bind_table_t *BT_ctcr = NULL, *BT_ctcp = NULL, *BT_msgc = NULL;
 #define MAXPENALTY 10
 
 /* Maximum messages to store in each queue. */
-static struct msgq_head mq, hq, modeq, cacheq;
+static struct msgq_head mq, hq, modeq, aq, cacheq;
 
 static const struct {
   struct msgq_head* const q;
@@ -132,17 +132,20 @@ static const struct {
   const char pfx;
   const bool double_msg;
   const bool burst;
-  const int maxqmsg;
-} qdsc[4] = {
-  { &modeq, 	DP_MODE,	"MODE", 	'm',	0,	1, 	300 },
-  { &mq, 	DP_SERVER,	"SERVER", 	's',	0,	1,	300 },
-  { &hq, 	DP_HELP,	"HELP", 	'h',	0,	0,	300 },
-  { &cacheq, 	DP_CACHE,	"CACHE", 	'c',	0,	0,	1000 },
+  const bool connect_burst;
+  const size_t maxqmsg;
+} qdsc[5] = {
+  { &modeq, 	DP_MODE,	"MODE", 	'm',	0,	1, 	1,	300 },
+  { &mq, 	DP_SERVER,	"SERVER", 	's',	0,	1,	1,	300 },
+  { &hq, 	DP_HELP,	"HELP", 	'h',	0,	0,	0,	300 },
+  { &aq, 	DP_PLAY,	"PLAY", 	'p',	1,	1,	0,	10000 },
+  { &cacheq, 	DP_CACHE,	"CACHE", 	'c',	0,	0,	0,	1000 },
 };
 #define Q_MODE 0
 #define Q_SERVER 1
 #define Q_HELP 2
-#define Q_CACHE 3
+#define Q_PLAY 3
+#define Q_CACHE 4
 static int burst;
 
 #include "cmdsserv.c"
@@ -613,6 +616,9 @@ void queue_server(int which, char *buf, int len)
     case DP_HELP:
       which_q = Q_HELP;
       break;
+    case DP_PLAY:
+      which_q = Q_PLAY;
+      break;
     case DP_CACHE:
       which_q = Q_CACHE;
       break;
@@ -1064,11 +1070,6 @@ void server_init()
   strlcpy(botrealname, "A deranged product of evil coders", sizeof(botrealname));
   strlcpy(stackable2cmds, "USERHOST ISON", sizeof(stackable2cmds));
 
-  mq.head = hq.head = modeq.head = NULL;
-  mq.last = hq.last = modeq.last = NULL;
-  mq.tot = hq.tot = modeq.tot = 0;
-  mq.warned = hq.warned = modeq.warned = 0;
-
   /*
    * Init of all the variables *must* be done in _start rather than
    * globally.