]> jfr.im git - irc/quakenet/snircd-patchqueue.git/commitdiff
welcome: when unsetting an entry, move the ones after that one place up
authorwiebe <redacted>
Mon, 5 Apr 2010 17:31:21 +0000 (19:31 +0200)
committerwiebe <redacted>
Mon, 5 Apr 2010 17:31:21 +0000 (19:31 +0200)
welcome.patch

index 83fa1b6c2b674e709e5c3a6b107781b41bae535a..6dc289f36a5dc5cdea81ad96c01069c013a07c86 100644 (file)
@@ -768,7 +768,7 @@ diff -r 4676d2565f9b ircd/s_user.c
 diff -r 4676d2565f9b ircd/welcome.c
 --- /dev/null
 +++ b/ircd/welcome.c
-@@ -0,0 +1,570 @@
+@@ -0,0 +1,584 @@
 +/*
 + * IRC - Internet Relay Chat, ircd/welcome.c
 + * Copyright (C) 1990 Jarkko Oikarinen and
@@ -967,7 +967,10 @@ diff -r 4676d2565f9b ircd/welcome.c
 +  int namearray, time_t timestamp, char *who, unsigned int flags)
 +{
 +  char msg[BUFSIZE];                    /* msg for snomask, logging, etc. */
-+  char text[WELCOMELEN + 1];         /* save old text */ 
++  char text[WELCOMELEN + 1];            /* save old text */
++  int i;                                /* loop variable */
++  int empty = namearray;                /* first empty spot in array after arrayname */
++  int end = WELCOME_MAX_ENTRIES -1;     /* last element to check in array */ 
 +
 +  /* debug */
 +  Debug((DEBUG_DEBUG, "welcome_unset(\"%s\", \"%s\", %d, %d, %Tu, \"%s\", 0x%04x)",
@@ -990,6 +993,17 @@ diff -r 4676d2565f9b ircd/welcome.c
 +  if (!(flags & (WELCOME_LOCAL|WELCOME_INSERT)))
 +    welcome_propagate(cptr, sptr, nameint, timestamp, who, "", flags);
 +
++  /* correct end for local offset */
++  if (flags & WELCOME_LOCAL)
++    end += WELCOME_MAX_ENTRIES;
++
++  /* found first empty spot */
++  for (i = namearray; i < end; i++)
++    welcome_make(i, WelcomeArray[i+1].text, WelcomeArray[i+1].who, timestamp);
++
++  /* clear last entry */
++  welcome_make(end, "", who, timestamp);
++
 +  return 0;
 +}
 +