فهرست منبع

Migrated pseudo's fixes for eggdrop 1.8. Did not include changes which removed compatibility to older versions. Untested.

Florian Sander 9 سال پیش
والد
کامیت
ddca2eabad
3فایلهای تغییر یافته به همراه45 افزوده شده و 7 حذف شده
  1. 7 6
      README
  2. 2 1
      UPDATES
  3. 36 0
      core/mini_httpd.c

+ 7 - 6
README

@@ -15,25 +15,25 @@ and via http.
 Installation:
 -------------
 
-Stats.mod will work with eggdrop1.6.x and eggdrop1.4.x.
+Stats.mod will work with eggdrop 1.8.x, eggdrop1.6.x and eggdrop1.4.x.
 
-The following instructions assume, ~/eggdrop1.6/ is the directory
+The following instructions assume, ~/eggdrop1.8/ is the directory
 where you installed your eggdrop from. (of course, other source dirs
 will work as well)
 Unfortunately, you need to compile stats.mod within your eggdrop source,
 so if you removed your original compile directory, you'll have to
 compile the whole bot again... sorry.
 
-Put stats.mod.1.4.1.tar.gz in ~/eggdrop1.6/src/mod/,
+Put stats.mod.1.4.1.tar.gz in ~/eggdrop1.8/src/mod/,
 and unpack it (tar xfz stats.mod.1.4.1.tar.gz). Change directory
 back to ~/eggdrop1.6/. Type 'make config' (on eggdrop 1.4, you can skip
 that part) Type 'make', wait until compiling
 is done and use 'make install' to install the bot and stats.mod.
 
-Don't forget to copy the language files from ~/eggdrop1.6/src/mod/stats.mod/ to
+Don't forget to copy the language files from ~/eggdrop1.8/src/mod/stats.mod/ to
 ~/eggdrop/language/ !
 
-All settings can be found in ~/eggdrop1.6/src/mod/stats.mod/stats.conf
+All settings can be found in ~/eggdrop1.8/src/mod/stats.mod/stats.conf
 I suggest to copy it to your eggdrop directory (probably ~/eggdrop/),
 edit it to fit your needs and put a 'source stats.conf' at the end of
 your eggdrop config file. This will execute the config file with every
@@ -235,5 +235,6 @@ Thanks to:
 - Fabian for teaching me plenty of things
 - Johoho, Fox_Muld and many others for various bug reports and suggestions
 - dw for the idea of livestats and for many bug reports
+- Pseudo for fixing compatibility to eggdrop 1.8
 - the eggdev team for developing eggdrop
-- everyone who has been using stats.mod for so long
+- everyone who has been using stats.mod for so long

+ 2 - 1
UPDATES

@@ -1,7 +1,8 @@
 Changes in Stats.mod: (since v1.0.1)
 --------------------
+
 1.4.1
-- Now also works with eggdrop 1.8.
+- Now also works with eggdrop 1.8 (thanks to pseudo!).
 
 1.4.0
 - added TEMPLATES!

+ 36 - 0
core/mini_httpd.c

@@ -611,6 +611,41 @@ static void out_http(int idx, char *buf, void *x)
  */
 static void httpd_accept(int idx, char *buf, int len)
 {
+#if EGG_IS_MIN_VER(10800)
+  int i, j = 0;
+  sockname_t name;
+  unsigned short port;
+
+  Context;
+  if (dcc_total + 1 >= max_dcc) {
+    j = answer(dcc[idx].sock, &name, &port, 0);
+    if (j != -1) {
+      dprintf(-j, "Sorry, too many connections already.\r\n");
+      killsock(j);
+    }
+    return;
+  }
+  if ((i = new_dcc(&LIVESTATS, sizeof(struct stats_clientinfo))) == (-1)) {
+    putlog(LOG_MISC, "*", "Error accepting livestats connection. DCC table is full.");
+    return;
+  }
+  dcc[i].sock = answer(dcc[idx].sock, &dcc[i].sockname,
+                       (short unsigned *) &dcc[i].port, 0);
+  if (dcc[i].sock < 0) {
+    putlog(LOG_MISC, "*", "Stats.mod: Error accepting livestats connection: %s", strerror(errno));
+    lostdcc(i);
+    return;
+  }
+  strcpy(dcc[i].nick, "httpstats");
+  strcpy(dcc[i].host, iptostr(&dcc[idx].sockname.addr.sa));
+  dcc[i].timeval = now;
+  dcc[i].status = 0;
+  ((struct stats_clientinfo *) dcc[i].u.other)->traffic = 0;
+  ((struct stats_clientinfo *) dcc[i].u.other)->code = 200;
+  ((struct stats_clientinfo *) dcc[i].u.other)->browser = NULL;
+  ((struct stats_clientinfo *) dcc[i].u.other)->referer = NULL;
+  ((struct stats_clientinfo *) dcc[i].u.other)->cmd = NULL;
+#else
   unsigned long ip;
   unsigned short port;
   int j = 0, sock, i;
@@ -647,6 +682,7 @@ static void httpd_accept(int idx, char *buf, int len)
   	  (ip >> 8) & 0xff, ip & 0xff); /* dw */
 #endif
   strcpy(dcc[i].host, s);
+#endif
   dcc[i].timeval = now;
   dcc[i].status = 0;
   // init http_connection_data struct