]> jfr.im git - irc/rqf/shadowircd.git/commitdiff
Change \s to space when writing xline.conf, to be compatible with older versions.
authorJilles Tjoelker <redacted>
Fri, 8 May 2009 11:40:09 +0000 (13:40 +0200)
committerJilles Tjoelker <redacted>
Fri, 8 May 2009 11:40:09 +0000 (13:40 +0200)
modules/m_xline.c

index 1aff1c9b51351e20ba147379cfca587f2a6d7fe7..d0fe3ed677be61feb32372837ea7da3098dfd301 100644 (file)
@@ -326,6 +326,40 @@ write_xline(struct Client *source_p, struct ConfItem *aconf)
        char buffer[BUFSIZE * 2];
        FILE *out;
        const char *filename;
+       char *mangle_gecos;
+
+       if(strstr(aconf->name, "\\s"))
+       {
+               char *tmp = LOCAL_COPY(aconf->name);
+               char *orig = tmp;
+               char *new = tmp; 
+               while(*orig)
+               {
+                       if(*orig == '\\' && *(orig + 1) != '\0')
+                       {
+                               if(*(orig + 1) == 's')
+                               {
+                                       *new++ = ' ';
+                                       orig += 2;   
+                               }
+                               /* otherwise skip that and the escaped
+                                * character after it, so we dont mistake
+                                * \\s as \s --fl
+                                */
+                               else
+                               {   
+                                       *new++ = *orig++;
+                                       *new++ = *orig++;
+                               }
+                       }
+                       else
+                               *new++ = *orig++;
+               }
+
+               *new = '\0';
+               mangle_gecos = tmp;
+       } else
+               mangle_gecos = aconf->name;
 
        filename = ConfigFileEntry.xlinefile;
 
@@ -337,7 +371,7 @@ write_xline(struct Client *source_p, struct ConfItem *aconf)
        }
 
        rb_sprintf(buffer, "\"%s\",\"0\",\"%s\",\"%s\",%ld\n",
-                  aconf->name, aconf->passwd,
+                  mangle_gecos, aconf->passwd,
                   get_oper_name(source_p), (long) rb_current_time());
 
        if(fputs(buffer, out) == -1)