Browse Source

* Fixed dcc truncating at 511

svn: 1117
Bryan Drewery 22 years ago
parent
commit
bf375f9703
2 changed files with 14 additions and 17 deletions
  1. 1 0
      doc/UPDATES
  2. 13 17
      src/dccutil.c

+ 1 - 0
doc/UPDATES

@@ -41,6 +41,7 @@ This is a summary of ChangeLog basically.
 37.Fixed a ton of unchecked buffers in cmds.c.
 37.Fixed a ton of unchecked buffers in cmds.c.
 38.All dcc cmds are now logged regardless if they are valid.
 38.All dcc cmds are now logged regardless if they are valid.
 39.Changed the log showing 'HUB: change BLAH' into debugging.
 39.Changed the log showing 'HUB: change BLAH' into debugging.
+40.Fixed some truncating with long text on dcc.
 
 
 1.1.7
 1.1.7
 
 

+ 13 - 17
src/dccutil.c

@@ -180,46 +180,42 @@ void dprintf(int idx, const char *format, ...)
 
 
 void chatout(const char *format, ...)
 void chatout(const char *format, ...)
 {
 {
-  int i, len;
-  char s[601] = "";
+  int i;
+  char s[1025] = "", *p = NULL;
   va_list va;
   va_list va;
 
 
   va_start(va, format);
   va_start(va, format);
-  egg_vsnprintf(s, 511, format, va);
+  egg_vsnprintf(s, 1024, format, va);
   va_end(va);
   va_end(va);
 
 
-  len = strlen(s);
-  if (len > 511)
-    len = 511;
-  s[len + 1] = 0;
+  if ((p = strrchr(s, '\n')))
+    *p++ = 0;
 
 
   for (i = 0; i < dcc_total; i++)
   for (i = 0; i < dcc_total; i++)
     if ((dcc[i].type == &DCC_CHAT) && !(dcc[i].simul))
     if ((dcc[i].type == &DCC_CHAT) && !(dcc[i].simul))
       if (dcc[i].u.chat->channel >= 0)
       if (dcc[i].u.chat->channel >= 0)
-        dprintf(i, "%s", s);
-
+        dprintf(i, "%s\n", s);
 }
 }
 
 
 /* Print to all on this channel but one.
 /* Print to all on this channel but one.
  */
  */
 void chanout_but(int x, int chan, const char *format, ...)
 void chanout_but(int x, int chan, const char *format, ...)
 {
 {
-  int i, len;
-  char s[601] = "";
+  int i;
+  char s[1025] = "", *p = NULL;
   va_list va;
   va_list va;
 
 
   va_start(va, format);
   va_start(va, format);
-  egg_vsnprintf(s, 511, format, va);
+  egg_vsnprintf(s, 1024, format, va);
   va_end(va);
   va_end(va);
-  len = strlen(s);
-  if (len > 511)
-    len = 511;
-  s[len + 1] = 0;
+
+  if ((p = strrchr(s, '\n')))
+    *p = 0;
 
 
   for (i = 0; i < dcc_total; i++)
   for (i = 0; i < dcc_total; i++)
     if ((dcc[i].type == &DCC_CHAT) && (i != x) && !(dcc[i].simul))
     if ((dcc[i].type == &DCC_CHAT) && (i != x) && !(dcc[i].simul))
       if (dcc[i].u.chat->channel == chan)
       if (dcc[i].u.chat->channel == chan)
-        dprintf(i, "%s", s);
+        dprintf(i, "%s\n", s);
 }
 }
 
 
 void dcc_chatter(int idx)
 void dcc_chatter(int idx)