]> jfr.im git - irc/evilnet/x3.git/blobdiff - src/helpfile.c
SVSPART trace / alert support (level 999). Just like the recent SVSJOIN support
[irc/evilnet/x3.git] / src / helpfile.c
index 649f99c2a23add7dca94f4613026af5557bd60ad..37a51e1fde5e11b0ddabdcb556475266c76b212d 100644 (file)
@@ -3,7 +3,7 @@
  *
  * This file is part of x3.
  *
- * srvx is free software; you can redistribute it and/or modify
+ * x3 is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
@@ -23,6 +23,7 @@
 #include "log.h"
 #include "modcmd.h"
 #include "nickserv.h"
+#include "spamserv.h"
 
 #if defined(HAVE_DIRENT_H)
 #include <dirent.h>
@@ -41,7 +42,7 @@ static const struct message_entry msgtab[] = {
 #define DEFAULT_LINE_SIZE      MAX_LINE_SIZE
 #define DEFAULT_TABLE_SIZE      80
 
-extern struct userNode *global, *chanserv, *opserv, *nickserv;
+extern struct userNode *global, *chanserv, *opserv, *nickserv, *spamserv;
 struct userNode *message_dest;
 struct userNode *message_source;
 struct language *lang_C;
@@ -275,7 +276,7 @@ table_send(struct userNode *from, const char *to, unsigned int size, irc_send_fu
     char line[MAX_LINE_SIZE+1];
     struct handle_info *hi;
     char *sepstr = NULL;
-    int sepsize = 0;
+    unsigned int sepsize = 0;
 
     if (IsChannelName(to) || *to == '$') {
         message_dest = NULL;
@@ -359,16 +360,21 @@ table_send(struct userNode *from, const char *to, unsigned int size, irc_send_fu
                         line[pos++] = ' ';
                 line[pos++] = ' ';
             }
+            line[pos++] = ' ';
         }
         line[pos] = 0;
-        sepsize = strlen_vis(line);
-        sepstr = malloc(sepsize + 1);
-        memset(sepstr, '-', sepsize);
-        sepstr[sepsize] = 0;
-        if(hi && hi->userlist_style != HI_STYLE_CLEAN)
+
+        /* Dont show ---- bars in 'clean' style. */
+        if(!(hi && hi->userlist_style == HI_STYLE_CLEAN)) {
+            //sepsize = strlen_vis(line);
+            sepsize = tot_width * nreps;
+            sepstr = malloc(sepsize + 1);
+            memset(sepstr, '-', sepsize);
+            sepstr[sepsize] = 0;
             irc_send(from, to, sepstr); /* ----------------- */
-        irc_send(from, to, line);   /* alpha  beta   roe */
-        if(hi && hi->userlist_style != HI_STYLE_CLEAN)
+        }
+        irc_send(from, to, line);       /* alpha  beta   roe */
+        if(!(hi && hi->userlist_style == HI_STYLE_CLEAN)) 
             irc_send(from, to, sepstr); /* ----------------- */
         ii = 1;
     }
@@ -396,20 +402,27 @@ table_send(struct userNode *from, const char *to, unsigned int size, irc_send_fu
             line[pos++] = ' ';
         }
     }
-    if (!(table.flags & TABLE_NO_HEADERS)) {
-        /* Send end bar & free its memory */
-        if(sepsize > 5)
+    /* Send end bar */
+    if (!(table.flags & TABLE_NO_HEADERS) && 
+        !(table.flags & TABLE_NO_FOOTER) && 
+        !(hi && hi->userlist_style == HI_STYLE_CLEAN)) {
+        char endstr[MAX_LINE_SIZE+1];
+        sprintf(endstr, "End (%d rows)", table.length-1);
+
+        /* Copy above into the sepstr, centered */
+        if(sepsize > strlen(endstr)+2)
         {
-           sepstr[sepsize/2-1] = 'E';
-           sepstr[sepsize/2] = 'n';
-           sepstr[sepsize/2+1]= 'd';
+           char* eptr = endstr;
+           char* sptr = sepstr+(sepsize/2) - (strlen(endstr)+2)/2;
+           while(*eptr)
+               *sptr++ = *eptr++;
         }
-
-        if(hi && hi->userlist_style != HI_STYLE_CLEAN)
-            irc_send(from, to, sepstr);
-        free(sepstr);
+        irc_send(from, to, sepstr);
     }
 
+    if(!(hi && hi->userlist_style == HI_STYLE_CLEAN))
+      free(sepstr);
+
     if (!(table.flags & TABLE_NO_FREE)) {
         /* Deallocate table memory (but not the string memory). */
         for (ii=0; ii<table.length; ii++)
@@ -560,6 +573,9 @@ vsend_message(const char *dest, struct userNode *src, struct handle_info *handle
        case 'N':
             value = nickserv ? nickserv->nick : "NickServ";
             break;
+        case 'X':
+            value = spamserv ? spamserv->nick : "SpamServ";
+            break;
         case 's':
             value = self->name;
             break;