Procházet zdrojové kódy

* Port [3188] to 1.2.14
* Remove the notes system and related commands. (fixes #275)



svn: 3189

Bryan Drewery před 19 roky
rodič
revize
7fd69e5820

+ 1 - 1
autotools/includes/depend.m4

@@ -19,7 +19,7 @@ AC_SUBST(GCC3)dnl
 
 AC_DEFUN([DO_DEPS],
 [
-files="src/Makefile.in src/compat/Makefile.in src/crypto/Makefile.in src/mod/channels.mod/Makefile src/mod/compress.mod/Makefile src/mod/console.mod/Makefile src/mod/ctcp.mod/Makefile src/mod/irc.mod/Makefile src/mod/notes.mod/Makefile src/mod/server.mod/Makefile src/mod/share.mod/Makefile src/mod/transfer.mod/Makefile src/mod/update.mod/Makefile"
+files="src/Makefile.in src/compat/Makefile.in src/crypto/Makefile.in src/mod/channels.mod/Makefile src/mod/compress.mod/Makefile src/mod/console.mod/Makefile src/mod/ctcp.mod/Makefile src/mod/irc.mod/Makefile src/mod/server.mod/Makefile src/mod/share.mod/Makefile src/mod/transfer.mod/Makefile src/mod/update.mod/Makefile"
 for mf in $files; do
   # Strip MF so we end up with the name of the file.
 #  echo "MF: $mf"

+ 1 - 1
configure

@@ -11860,7 +11860,7 @@ case "$srcdir" in
 esac
 
 
-files="src/Makefile.in src/compat/Makefile.in src/crypto/Makefile.in src/mod/channels.mod/Makefile src/mod/compress.mod/Makefile src/mod/console.mod/Makefile src/mod/ctcp.mod/Makefile src/mod/irc.mod/Makefile src/mod/notes.mod/Makefile src/mod/server.mod/Makefile src/mod/share.mod/Makefile src/mod/transfer.mod/Makefile src/mod/update.mod/Makefile"
+files="src/Makefile.in src/compat/Makefile.in src/crypto/Makefile.in src/mod/channels.mod/Makefile src/mod/compress.mod/Makefile src/mod/console.mod/Makefile src/mod/ctcp.mod/Makefile src/mod/irc.mod/Makefile src/mod/server.mod/Makefile src/mod/share.mod/Makefile src/mod/transfer.mod/Makefile src/mod/update.mod/Makefile"
 for mf in $files; do
   # Strip MF so we end up with the name of the file.
 #  echo "MF: $mf"

+ 1 - 0
doc/UPDATES

@@ -5,6 +5,7 @@ Lines prefixed with '-' were disabled before release and are not finished, or ar
 1.2.14 - http://wraith.shatow.net/milestone/1.2.14
 * Fix another bug in shell functions. (fixes #321)
 * Fix bug with bots not retaining flags over share. (fixes #334)
+* Remove the notes system and related commands. (fixes #275)
 
 1.2.13 - http://wraith.shatow.net/milestone/1.2.13
 * Fix cmd_chanset accepting invalid flags

+ 2 - 34
misc/help.txt

@@ -168,9 +168,7 @@ See also: +host, -host%{+m}, +user, -user%{-}
 ::away
 ###  $baway$b [reason]
    Marks you as "away" on the party line. Your away message will show up in
-   the $b'%dwho'$b list, and will be displayed to anyone who tries to send you
-   a note. Your notes will be stored, and then displayed to you as soon as you
-   are no longer away. Saying something on the party line will automatically
+   the $b'%dwho'$b list. Saying something on the party line will automatically
    remove your "away" status, or you can type $b'%dback'$b or $b'%daway'$b by
    itself.
  
@@ -560,7 +558,7 @@ See also: %{+n}+chan, -chan%{-}, chaninfo
    you wish.
    $b'%dchat off'$b removes you from all channels, including the main party line.
    You can still use bot commands and see the console, but you can't talk to
-   anyone except via $b'%dnote'$b. $b'%dchat on'$b returns you to the main party
+   anyone. $b'%dchat on'$b returns you to the main party
    line (channel 0) if you were elsewhere.
    If you prefix the channel with a '*', you will join a local channel.
  
@@ -973,13 +971,6 @@ See also: -exempt, +exempt, console%{+m|m}, chanset, chaninfo%{-}, stick, unstic
      "Local time is now 17:17" for example instead of "Local time is
      now 17:17". Use this to turn telnet codes on or off/change the display
      mode.
-::fwd
-###  $bfwd$b <handle> [desto]
-   This allows you to set a note forwarding address for a user,
-   this means if a note needs to be stored for the user, the
-   bot will attempt to pass it on to the given user@bot, if
-   the bot is not online then the note is still stored locally,
-   if the other user doesn't exist, the note is lost. Boohoo.
 :leaf:getkey:
 ###  $bgetkey$b [channel]
    If there is a key set for channel, it is displayed. If channel is not
@@ -1337,28 +1328,6 @@ See: handle
    Displays all users who do not have a password set.
  
    Specify any argument to give random passes to users.
-::note
-###  $bnote$b <nickname[@bot]> <message>
-   Sends a private note to a user on the partyline. If that user is currently
-   logged in and not marked as away, the message will be received immediately.
-   Otherwise, it will be stored and displayed the next time that user joins the
-   partyline. To send a note to someone on a different bot, add "nick@bot" to
-   the nickname.
- 
-See also: whom, notes
-::notes
-###  $bnotes index$b
-###  $bnotes read$b <# or ALL>
-###  $bnotes erase$b <# or ALL>
-   lets you manipulate notes that have been stored up for you while
-   you were gone.  $b'notes index'$b gives a listing of all the notes
-   stored up: who they are from, and when they were left.
-   $b'notes read'$b lets you read some or all notes, according to a
-   list of numbers and/or intervals separated by semicolon.
-   and $b'notes erase'$b erases notes after you are done with them.
-     ex: notes erase 2-4;8;16-
- 
-See also: note, whom, noteigns
 :leaf:op
 ###  $bop$b <nickname> [channel|*]
    will grant chanop to the person you specify, so long as the bot
@@ -1829,7 +1798,6 @@ See also: whom
       $bBOTNICK$b - This user record is a bot.
       $bPASS$b   - "yes" if she has a password set; "no" otherwise 
                    (bots dont use passwords)
-      $bNOTES$b  - number of stored notes waiting for the user
       $bFLAGS$b  - the list of flags for this user (see below)
       $bLAST$b   - the time or date that the user was last on irc or the partyline
  

+ 0 - 1
src/Makefile.in

@@ -56,7 +56,6 @@ MODOBJS = mod/channels.o \
         mod/console.o \
         mod/ctcp.o \
         mod/irc.o \
-        mod/notes.o \
         mod/server.o \
         mod/share.o \
         mod/transfer.o \

+ 0 - 18
src/botcmd.c

@@ -266,23 +266,6 @@ static void bot_priv(int idx, char *par)
 	case NOTE_ERROR:
 	  botnet_send_priv(idx, conf.bot->nick, from, NULL, "%s %s.", BOT_NOSUCHUSER, to);
 	  break;
-	case NOTE_STORED:
-	  botnet_send_priv(idx, conf.bot->nick, from, NULL, "%s", BOT_NOTESTORED2);
-	  break;
-	case NOTE_FULL:
-	  botnet_send_priv(idx, conf.bot->nick, from, NULL, "%s", BOT_NOTEBOXFULL);
-	  break;
-	case NOTE_AWAY:
-	  botnet_send_priv(idx, conf.bot->nick, from, NULL, "%s %s", to, BOT_NOTEISAWAY);
-	  break;
-	case NOTE_FWD:
-	  botnet_send_priv(idx, conf.bot->nick, from, NULL, "%s %s", "Not online; note forwarded to:", to);
-	  break;
-	case NOTE_TCL:
-	  break;		/* Do nothing */
-	case NOTE_OK:
-	  botnet_send_priv(idx, conf.bot->nick, from, NULL, "%s %s.", BOT_NOTESENTTO, to);
-	  break;
 	}
     }
   } else {			/* Pass it on */
@@ -1067,7 +1050,6 @@ static void bot_away(int idx, char *par)
   }
   etc = newsplit(&par);
   sock = base64_to_int(etc);
-  check_bind_away(bot, idx, par);
   if (par[0]) {
     partystat(bot, sock, PLSTAT_AWAY, 0);
     partyaway(bot, sock, par);

+ 13 - 42
src/botmsg.c

@@ -23,7 +23,6 @@
 #include "botnet.h"
 #include "tandem.h"
 #include "core_binds.h"
-#include "src/mod/notes.mod/notes.h"
 #include <stdarg.h>
 
 static char	OBUF[SGRAB - 110] = "";
@@ -427,7 +426,7 @@ void botnet_send_nkch_part(int butidx, int useridx, char *oldnick)
  */
 int add_note(char *to, char *from, char *msg, int idx, int echo)
 {
-  int status, i, iaway, sock;
+  int status, i, sock;
   char *p = NULL, botf[81] = "", ss[81] = "", ssf[81] = "";
   struct userrec *u;
 
@@ -469,6 +468,7 @@ int add_note(char *to, char *from, char *msg, int idx, int echo)
       botnet_send_priv(i, botf, x, p, "%s", msg);
     return NOTE_OK;		/* Forwarded to the right bot */
   }
+
   /* Might be form "sock:nick" */
   splitc(ssf, from, ':');
   rmspace(ssf);
@@ -478,47 +478,24 @@ int add_note(char *to, char *from, char *msg, int idx, int echo)
     sock = (-1);
   else
     sock = atoi(ss);
-  /* Don't process if there's a note binding for it */
-  if (idx != (-2)) {		/* Notes from bots don't trigger it */
-    if (check_bind_note(from, to, msg)) {
-      if ((idx >= 0) && (echo))
-	dprintf(idx, "-> %s: %s\n", to, msg);
-      return NOTE_TCL;
-    }
-  }
+
   if (!(u = get_user_by_handle(userlist, to))) {
     if (idx >= 0)
       dprintf(idx, "I don't know anyone by that name.\n");
     return NOTE_ERROR;
   }
-  if (is_bot(u)) {
-    if (idx >= 0)
-      dprintf(idx, BOT_NONOTES);
+
+  if (is_bot(u))
     return NOTE_ERROR;
-  }
 
-  status = NOTE_STORED;
-  iaway = 0;
+  status = NOTE_ERROR;
+
   /* Online right now? */
   for (i = 0; i < dcc_total; i++) {
-    if (dcc[i].type && (dcc[i].type->flags & DCT_GETNOTES) &&
+    if (dcc[i].type && (dcc[i].type->flags & DCT_CHAT) &&
 	((sock == (-1)) || (sock == dcc[i].sock)) &&
 	(!egg_strcasecmp(dcc[i].nick, to))) {
-      int aok = 1;
-
-      if (dcc[i].type == &DCC_CHAT)
-	if ((dcc[i].u.chat->away != NULL) &&
-	    (idx != (-2))) {
-	  /* Only check away if it's not from a bot */
-	  aok = 0;
-	  if (idx >= 0)
-	    dprintf(idx, "%s %s: %s\n", dcc[i].nick, BOT_USERAWAY,
-		    dcc[i].u.chat->away);
-	  if (!iaway)
-	    iaway = i;
-	  status = NOTE_AWAY;
-	}
-      if (aok) {
+
 	char *p2 = NULL, *fr = from;
 	int l = 0;
 	char work[1024] = "";
@@ -537,18 +514,12 @@ int add_note(char *to, char *from, char *msg, int idx, int echo)
 	if ((idx >= 0) && (echo))
 	  dprintf(idx, "-> %s: %s\n", to, msg);
 	return NOTE_OK;
-      }
     }
   }
+  /* The user is not online.. why are we getting a bot note for them? */
+
   if (idx == (-2))
     return NOTE_OK;		/* Error msg from a tandembot: don't store */
-  status = storenote(from, to, msg, idx, NULL, 0);
-  if (status < 0) status = NOTE_ERROR;
-  else if (status == NOTE_AWAY) {
-      /* User is away in all sessions -- just notify the user that a
-       * message arrived and was stored. (only oldest session is notified.)
-       */
-      dprintf(iaway, "*** %s.\n", BOT_NOTEARRIVED);
-  }
-  return(status);
+
+  return NOTE_ERROR;
 }

+ 0 - 5
src/botmsg.h

@@ -7,11 +7,6 @@
 /* Return codes for add_note */
 #define NOTE_ERROR      0       /* error                        */
 #define NOTE_OK         1       /* success                      */
-#define NOTE_STORED     2       /* not online; stored           */
-#define NOTE_FULL       3       /* too many notes stored        */
-#define NOTE_TCL        4       /* tcl binding caught it        */
-#define NOTE_AWAY       5       /* away; stored                 */
-#define NOTE_FWD        6       /* away; forwarded              */
 
 void botnet_send_var(int idx, variable_t *);
 void botnet_send_var_broad(int idx, variable_t *);

+ 0 - 2
src/cmds.c

@@ -858,7 +858,6 @@ void channels_report(int, int);
 void transfer_report(int, int);
 void share_report(int, int);
 void update_report(int, int);
-void notes_report(int, int);
 
 static void cmd_status(int idx, char *par)
 {
@@ -886,7 +885,6 @@ static void cmd_status(int idx, char *par)
   transfer_report(idx, all);
   share_report(idx, all);
   update_report(idx, all);
-  notes_report(idx, all);
 }
 
 static void cmd_dccstat(int idx, char *par)

+ 0 - 16
src/core_binds.c

@@ -258,25 +258,9 @@ void check_bind_chof(char *hand, int idx)
   touch_laston(u, "partyline", now);
 }
 
-void check_bind_nkch(const char *ohand, const char *nhand)
-{
-  check_bind(BT_nkch, ohand, NULL, ohand, nhand);
-}
-
-int check_bind_note(const char *from, const char *to, const char *text)
-{
-  return check_bind(BT_note, to, NULL, from, to, text);
-}
-
-void check_bind_away(const char *bot, int idx, const char *msg)
-{
-  check_bind(BT_away, bot, NULL, bot, idx, msg);
-}
-
 void check_bind_time(struct tm *tm)
 {
 	char full[32] = "";
 	egg_snprintf(full, sizeof(full), "%02d %02d %02d %02d %04d", tm->tm_min, tm->tm_hour, tm->tm_mday, tm->tm_mon, tm->tm_year + 1900);
 	check_bind(BT_time, full, NULL, tm->tm_min, tm->tm_hour, tm->tm_mday, tm->tm_mon, tm->tm_year + 1900);
 }
-

+ 0 - 3
src/core_binds.h

@@ -8,9 +8,6 @@ void check_bind_time(struct tm *tm);
 void check_bind_dcc(const char *, int, const char *);
 void real_check_bind_dcc(const char *, int, const char *, Auth *);
 void check_bind_bot(const char *, const char *, const char *);
-int check_bind_note(const char *, const char *, const char *);
-void check_bind_nkch(const char *, const char *);
-void check_bind_away(const char *, int, const char *);
 void check_bind_chon(char *, int);
 void check_bind_chof(char *, int);
 #endif /* !_CORE_BINDS_H */

+ 0 - 1
src/dcc.h

@@ -141,7 +141,6 @@ struct dupwait_info {
  */
 #define DCT_CHAT      BIT0        /* this dcc type receives botnet
                                            chatter                          */
-#define DCT_GETNOTES  DCT_CHAT          /* can receive notes                */
 #define DCT_MASTER    BIT1        /* received master chatter          */
 #define DCT_SHOWWHO   BIT2        /* show the user in .who            */
 #define DCT_REMOTEWHO BIT3        /* show in remote who               */

+ 0 - 5
src/dccutil.c

@@ -28,7 +28,6 @@
 #include "core_binds.h"
 #include "egg_timer.h"
 #include "src/mod/server.mod/server.h"
-#include "src/mod/notes.mod/notes.h"
 #include <stdarg.h>
 
 static struct portmap *root = NULL;
@@ -401,8 +400,6 @@ dcc_chatter(int idx)
 
   show_motd(idx);
 
-  notes_chon(idx);
-
   if (dcc[idx].type == &DCC_CHAT) {
     if (!strcmp(dcc[idx].u.chat->con_chan, "***"))
       strcpy(dcc[idx].u.chat->con_chan, "*");
@@ -600,7 +597,6 @@ not_away(int idx)
   dprintf(idx, "You're not away any more.\n");
   free(dcc[idx].u.chat->away);
   dcc[idx].u.chat->away = NULL;
-  check_bind_away(conf.bot->nick, idx, NULL);
 }
 
 void
@@ -624,7 +620,6 @@ set_away(int idx, char *s)
     }
   }
   dprintf(idx, "You are now away. (%s)\n", s);
-  check_bind_away(conf.bot->nick, idx, s);
 }
 
 

+ 0 - 6
src/lang.h

@@ -16,9 +16,7 @@
 /* Messages referring to bots
  */
 #define BOT_NOTHERE		"That bot isn't here.\n"
-#define BOT_NONOTES		"That's a bot.  You can't leave notes for a bot.\n"
 #define BOT_USERAWAY		"is away"
-#define BOT_NOTEARRIVED		"Note arrived for you"
 #define BOT_MSGDIE		"Bot shut down beginning...."
 #define BOT_NOSUCHUSER		"No such user"
 #define BOT_NOCHANNELS		"no channels"
@@ -26,10 +24,6 @@
 #define BOT_OTHERPEOPLE		"Other people on the bot"
 /* was: BOT_OUTDATEDWHOM - 0xb1e */
 #define BOT_LINKATTEMPT		"Attempting to link"
-#define BOT_NOTESTORED2		"Not online; note stored."
-#define BOT_NOTEBOXFULL		"Notebox is full, sorry."
-#define BOT_NOTEISAWAY		"is away; note stored."
-#define BOT_NOTESENTTO		"Note sent to"
 #define BOT_DISCONNECTED	"Disconnected from:"
 #define BOT_CANTLINKTHERE	"Can't link there"
 #define BOT_CANTUNLINK		"Can't unlink"

+ 0 - 2
src/main.c

@@ -644,7 +644,6 @@ static char *fake_md5 = "596a96cc7bf9108cd896f33c44aedc8a";
 void console_init();
 void ctcp_init();
 void update_init();
-void notes_init();
 void server_init();
 void irc_init();
 void channels_init();
@@ -776,7 +775,6 @@ printf("out: %s\n", out);
   transfer_init();
   share_init();
   update_init();
-  notes_init();
   console_init();
   chanprog();
 

+ 0 - 2
src/mod/Makefile.in

@@ -22,7 +22,6 @@ mods = channels.mod \
 	console.mod \
 	ctcp.mod \
 	irc.mod \
-	notes.mod \
 	server.mod \
 	share.mod \
 	transfer.mod \
@@ -32,7 +31,6 @@ mod_objs = channels.mod_o \
 	console.mod_o \
 	ctcp.mod_o \
 	irc.mod_o \
-	notes.mod_o \
 	server.mod_o \
 	share.mod_o \
 	transfer.mod_o \

+ 0 - 30
src/mod/notes.mod/Makefile

@@ -1,30 +0,0 @@
-# Makefile for src/mod/notes.mod
-
-srcdir = .
-depcomp = /bin/sh ../../../autotools/depcomp
-
-#This line is simply for configure to generate .deps/
-OBJS = notes.o
-
-include ./.deps/includes
-
-doofus:
-	@echo ""
-	@echo "Let's try this from the right directory..."
-	@echo ""
-	@cd ../../../ && make
-
-static: ../notes.o
-
-../notes.o:
-	@echo -e "Compiling: \033[1mnotes\033[0m"
-	source='notes.c' object='$@' depfile='.deps/notes.Po' tmpdepfile='.deps/notes.TPo' depmode=$(CCDEPMODE) $(depcomp) \
-	$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(srcdir)/notes.c
-	@rm -f ../notes.o
-	@mv notes.o ../
-
-clean:
-	@rm -f .depend *.o *~
-
-distclean: clean
-

+ 0 - 102
src/mod/notes.mod/cmdsnote.c

@@ -1,102 +0,0 @@
-/*
- * cmdsnote.c -- part of notes.mod
- *   handles all notes interaction over the party line
- *
- */
-
-
-static void cmd_fwd(int idx, char *par)
-{
-  if (!par[0]) {
-    dprintf(idx, "%s: fwd <handle> [user@bot]\n", NOTES_USAGE);
-    return;
-  }
-
-  struct userrec *u1 = get_user_by_handle(userlist, newsplit(&par));
-
-  if (!u1) {
-    dprintf(idx, "%s\n", NOTES_NO_SUCH_USER);
-    return;
-  }
-
-  if ((u1->flags & USER_OWNER) && egg_strcasecmp(u1->handle, dcc[idx].nick)) {
-    dprintf(idx, "%s\n", NOTES_FWD_OWNER);
-    return;
-  }
-  if (!par[0]) {
-    putlog(LOG_CMDS, "*", "#%s# fwd %s", dcc[idx].nick, u1->handle);
-    dprintf(idx, NOTES_FWD_FOR, u1->handle);
-    set_user(&USERENTRY_FWD, u1, NULL);
-    return;
-  }
-  /* Thanks to vertex & dw */
-  if (strchr(par, '@') == NULL) {
-    dprintf(idx, "%s\n", NOTES_FWD_BOTNAME);
-    return;
-  }
-  putlog(LOG_CMDS, "*", "#%s# fwd %s %s", dcc[idx].nick, u1->handle, par);
-  dprintf(idx, NOTES_FWD_CHANGED, u1->handle, par);
-  set_user(&USERENTRY_FWD, u1, par);
-}
-
-static void cmd_notes(int idx, char *par)
-{
-  if (!par[0]) {
-    dprintf(idx, "%s: notes index\n", NOTES_USAGE);
-    dprintf(idx, "       notes read <# or ALL>\n");
-    dprintf(idx, "       notes erase <# or ALL>\n");
-    dprintf(idx, "       %s\n", NOTES_MAYBE);
-    dprintf(idx, "       ex: notes erase 2-4;8;16-\n");
-    return;
-  }
-  char *fcn = newsplit(&par);
-
-  if (!egg_strcasecmp(fcn, "index"))
-    notes_read(dcc[idx].nick, "", "+", idx);
-  else if (!egg_strcasecmp(fcn, "read")) {
-    if (!egg_strcasecmp(par, "all"))
-      notes_read(dcc[idx].nick, "", "-", idx);
-    else
-      notes_read(dcc[idx].nick, "", par, idx);
-  } else if (!egg_strcasecmp(fcn, "erase")) {
-    if (!egg_strcasecmp(par, "all"))
-      notes_del(dcc[idx].nick, "", "-", idx);
-    else
-      notes_del(dcc[idx].nick, "", par, idx);
-  } else {
-    dprintf(idx, "%s\n", NOTES_MUSTBE);
-    return;
-  }
-  putlog(LOG_CMDS, "*", "#%s# notes %s %s", dcc[idx].nick, fcn, par);
-}
-
-static void cmd_note(int idx, char *par)
-{
-  char handle[512] = "", *p = newsplit(&par);
-  int echo;
-
-  if (!par[0]) {
-    dprintf(idx, "%s: note <to-whom> <message>\n", NOTES_USAGE);
-    return;
-  }
-  while ((*par == ' ') || (*par == '<') || (*par == '>'))
-    par++;			/* These are now illegal *starting* notes
-				 * characters */
-  echo = (dcc[idx].status & STAT_ECHO);
-  splitc(handle, p, ',');
-  while (handle[0]) {
-    rmspace(handle);
-    add_note(handle, dcc[idx].nick, par, idx, echo);
-    splitc(handle, p, ',');
-  }
-  rmspace(p);
-  add_note(p, dcc[idx].nick, par, idx, echo);
-}
-
-static cmd_t notes_cmds[] =
-{
-  {"fwd",	"m",	(Function) cmd_fwd,		NULL, 0},
-  {"notes",	"",	(Function) cmd_notes,		NULL, 0},
-  {"note",	"",	(Function) cmd_note,		NULL, 0},
-  {NULL,	NULL,	NULL,				NULL, 0}
-};

+ 0 - 770
src/mod/notes.mod/notes.c

@@ -1,770 +0,0 @@
-/*
- * notes.c -- part of notes.mod
- *   reading and sending notes
- *   killing old notes and changing the destinations
- *   note cmds
- *   note ignores
- *
- */
-
-
-#include "notes.h"
-#include "src/common.h"
-#include "src/chanprog.h"
-#include "src/main.h"
-#include "src/botnet.h"
-#include "src/userrec.h"
-#include "src/userent.h"
-#include "src/misc_file.h"
-#include "src/misc.h"
-#include "src/users.h"
-#include "src/egg_timer.h"
-
-#include "src/tandem.h"
-#include "src/tclhash.h"
-#include "src/botmsg.h" /* NOTE DEFINES */
-
-#include <fcntl.h>
-#include <sys/stat.h> /* chmod(..) */
-
-static int maxnotes = 50;	/* Maximum number of notes to allow stored
-				 * for each user */
-static int note_life = 60;	/* Number of DAYS a note lives */
-static char notefile[121] = ".n";	/* Name of the notefile */
-static int allow_fwd = 1;	/* Allow note forwarding */
-static int notify_users = 1;	/* Notify users they have notes every hour? */
-
-static struct user_entry_type USERENTRY_FWD =
-{
-  NULL,				/* always 0 ;) */
-  NULL,
-  NULL,
-  NULL,
-  NULL,
-  NULL,
-  NULL,
-  fwd_display,
-  "FWD"
-};
-
-#include "cmdsnote.c"
-
-
-void fwd_display(int idx, struct user_entry *e, struct userrec *u)
-{
-  if (dcc[idx].user && (dcc[idx].user->flags & USER_MASTER))
-    dprintf(idx, NOTES_FORWARD_TO, e->u.string);
-}
-
-/* Determine how many notes are waiting for a user.
- */
-int num_notes(const char *user)
-{
-  if (!notefile[0])
-    return 0;
-
-  FILE *f = NULL;
-
-  f = fopen(notefile, "r");
-  if (f == NULL)
-    return 0;
-
-  int tot = 0;
-  char s[513] = "", *to = NULL, *s1 = NULL;
-
-  while (!feof(f)) {
-    fgets(s, 512, f);
-    if (!feof(f)) {
-      if (s[strlen(s) - 1] == '\n')
-	s[strlen(s) - 1] = 0;
-      rmspace(s);
-      if ((s[0]) && (s[0] != '#') && (s[0] != ';')) {	/* Not comment */
-	s1 = s;
-	to = newsplit(&s1);
-	if (!egg_strcasecmp(to, user))
-	  tot++;
-      }
-    }
-  }
-  fclose(f);
-  return tot;
-}
-
-/* Change someone's handle.
- */
-static void notes_change(const char *oldnick, const char *newnick)
-{
-  if (!egg_strcasecmp(oldnick, newnick))
-    return;
-  if (!notefile[0])
-    return;
-
-  FILE *f = NULL, *g = NULL;
-  char s[513] = "", *to = NULL, *s1 = NULL;
-  int tot = 0;
-
-  f = fopen(notefile, "r");
-  if (f == NULL)
-    return;
-  simple_sprintf(s, "%s~new", notefile);
-  g = fopen(s, "w");
-  if (g == NULL) {
-    fclose(f);
-    return;
-  }
-  fixmod(s);
-  while (!feof(f)) {
-    fgets(s, 512, f);
-    if (!feof(f)) {
-      if (s[strlen(s) - 1] == '\n')
-	s[strlen(s) - 1] = 0;
-      rmspace(s);
-      if ((s[0]) && (s[0] != '#') && (s[0] != ';')) {	/* Not comment */
-	s1 = s;
-	to = newsplit(&s1);
-	if (!egg_strcasecmp(to, oldnick)) {
-	  tot++;
-	  fprintf(g, "%s %s\n", newnick, s1);
-	} else
-	  fprintf(g, "%s %s\n", to, s1);
-      } else
-	fprintf(g, "%s\n", s);
-    }
-  }
-  fclose(f);
-  fclose(g);
-  unlink(notefile);
-  simple_sprintf(s, "%s~new", notefile);
-  movefile(s, notefile);
-  putlog(LOG_MISC, "*", NOTES_SWITCHED_NOTES, tot, tot == 1 ? "" : "s",
-         oldnick, newnick);
-}
-
-/* Get rid of old useless notes.
- */
-static void expire_notes()
-{
-  if (!notefile[0])
-    return;
-
-  FILE *f = NULL, *g = NULL;
-  char s[513] = "", *to = NULL, *from = NULL, *ts = NULL, *s1 = NULL;
-  int tot = 0, lapse;
-
-  f = fopen(notefile, "r");
-  if (f == NULL)
-    return;
-  simple_sprintf(s, "%s~new", notefile);
-  g = fopen(s, "w");
-  if (g == NULL) {
-    fclose(f);
-    return;
-  }
-  fixmod(s);
-  while (!feof(f)) {
-    fgets(s, 512, f);
-    if (!feof(f)) {
-      if (s[strlen(s) - 1] == '\n')
-	s[strlen(s) - 1] = 0;
-      rmspace(s);
-      if ((s[0]) && (s[0] != '#') && (s[0] != ';')) {	/* Not comment */
-	s1 = s;
-	to = newsplit(&s1);
-	from = newsplit(&s1);
-	ts = newsplit(&s1);
-	lapse = (now - (time_t) atoi(ts)) / 86400;
-	if (lapse > note_life)
-	  tot++;
-	else if (!get_user_by_handle(userlist, to))
-	  tot++;
-	else
-	  fprintf(g, "%s %s %s %s\n", to, from, ts, s1);
-      } else
-	fprintf(g, "%s\n", s);
-    }
-  }
-  fclose(f);
-  fclose(g);
-  unlink(notefile);
-  simple_sprintf(s, "%s~new", notefile);
-  movefile(s, notefile);
-  if (tot > 0)
-    putlog(LOG_MISC, "*", NOTES_EXPIRED, tot, tot == 1 ? "" : "s");
-}
-
-/* Add note to notefile.
- */
-int storenote(char *argv1, char *argv2, char *argv3, int idx, char *who, int bufsize)
-{
-  FILE *f = NULL;
-  char u[20] = "", *f1 = NULL, *to = NULL, work[1024] = "";
-  struct userrec *ur = NULL, *ur2 = NULL;
-
-  if (who && bufsize > 0) who[0] = 0;
-  ur = get_user_by_handle(userlist, argv2);
-  if (ur && allow_fwd && (f1 = (char *) get_user(&USERENTRY_FWD, ur))) {
-    char fwd[161] = "", fwd2[161] = "", *f2 = NULL, *p = NULL, *q = NULL, *r = NULL;
-    int ok = 1;
-
-    /* User is valid & has a valid forwarding address */
-     strcpy(fwd, f1);		/* Only 40 bytes are stored in the userfile */
-     p = strchr(fwd, '@');
-    if (p && !egg_strcasecmp(p + 1, conf.bot->nick)) {
-      *p = 0;
-      if (!egg_strcasecmp(fwd, argv2))
-	/* They're forwarding to themselves on the same bot, llama's */
-	ok = 0;
-      strcpy(fwd2, fwd);
-      splitc(fwd2, fwd2, '@');
-      /* Get the user record of the user that we're forwarding to locally */
-      ur2 = get_user_by_handle(userlist, fwd2);
-      if (!ur2)
-	ok = 0;
-      if ((f2 = (char *) get_user(&USERENTRY_FWD, ur2))) {
-	strcpy(fwd2, f2);
-	splitc(fwd2, fwd2, '@');
-	if (!egg_strcasecmp(fwd2, argv2))
-	/* They're forwarding to someone who forwards back to them! */
-	ok = 0;
-      }
-      p = NULL;
-    }
-    if ((argv1[0] != '@') && ((argv3[0] == '<') || (argv3[0] == '>')))
-       ok = 0;			/* Probablly fake pre 1.3 hax0r */
-
-    if (ok && (!p || in_chain(p + 1))) {
-      if (p)
-	p++;
-      q = argv3;
-      while (ok && q && (q = strchr(q, '<'))) {
-	q++;
-	if ((r = strchr(q, ' '))) {
-	  *r = 0;
-	  if (!egg_strcasecmp(fwd, q))
-	    ok = 0;
-	  *r = ' ';
-	}
-      }
-      if (ok) {
-	if (p && strchr(argv1, '@')) {
-	  simple_sprintf(work, "<%s@%s >%s %s", argv2, conf.bot->nick,
-			 argv1, argv3);
-	  simple_sprintf(u, "@%s", conf.bot->nick);
-	  p = u;
-	} else {
-	  simple_sprintf(work, "<%s@%s %s", argv2, conf.bot->nick,
-			 argv3);
-	  p = argv1;
-	}
-      }
-    } else
-      ok = 0;
-    if (ok) {
-      if ((add_note(fwd, p, work, idx, 0) == NOTE_OK) && (idx >= 0))
-	dprintf(idx, "Not online; forwarded to %s.\n", f1);
-      if (who) strncpy(who, f1, bufsize);
-      to = NULL;
-    } else {
-      strcpy(work, argv3);
-      to = argv2;
-    }
-  } else
-    to = argv2;
-  if (to) {
-    if (notefile[0] == 0) {
-      if (idx >= 0)
-	dprintf(idx, "%s\n", "Notes are not supported by this bot.");
-    } else if (num_notes(to) >= maxnotes) {
-      if (idx >= 0)
-	dprintf(idx, "%s\n", "Sorry, that user has too many notes already.");
-    } else {			/* Time to unpack it meaningfully */
-      f = fopen(notefile, "a");
-      if (f == NULL)
-	f = fopen(notefile, "w");
-      if (f == NULL) {
-	if (idx >= 0)
-	  dprintf(idx, "%s\n", "Cant create notefile.  Sorry.");
-	putlog(LOG_MISC, "*", "%s", "Notefile unreachable!");
-      } else {
-	char *p = NULL, *from = argv1;
-	size_t len = 0;
-
-	fixmod(notefile);
-	while ((argv3[0] == '<') || (argv3[0] == '>')) {
-	  p = newsplit(&(argv3));
-	  if (*p == '<')
-	    len += simple_sprintf(work + len, "via %s, ", p + 1);
-	  else if (argv1[0] == '@')
-	    from = p + 1;
-	}
-	fprintf(f, "%s %s %li %s%s\n", to, from, now, len ? work : "", argv3);
-	fclose(f);
-	if (idx >= 0)
-	  dprintf(idx, "%s.\n", "Stored message");
-      }
-    }
-  }
-  return 0;
-}
-
-/* Convert a string like "2-4;8;16-"
- * in an array {2, 4, 8, 8, 16, maxnotes, -1}
- */
-static void notes_parse(int dl[], const char *s)
-{
-  int i = 0;
-  int idl = 0;
-
-  do {
-    while (s[i] == ';')
-      i++;
-    if (s[i]) {
-      if (s[i] == '-')
-	dl[idl] = 1;
-      else
-	dl[idl] = atoi(s + i);
-      idl++;
-      while ((s[i]) && (s[i] != '-') && (s[i] != ';'))
-	i++;
-      if (s[i] == '-') {
-	dl[idl] = atoi(s + i + 1);	/* Will be 0 if not a number */
-	if (dl[idl] == 0)
-	  dl[idl] = maxnotes;
-      } else
-	dl[idl] = dl[idl - 1];
-      idl++;
-      while ((s[i]) && (s[i] != ';'))
-	i++;
-    }
-  }
-  while ((s[i]) && (idl < 124));
-  dl[idl] = -1;
-}
-
-/* Return true if 'in' is in intervals of 'dl'
- */
-static int notes_in(int dl[], int in)
-{
-  int i = 0;
-
-  while (dl[i] != -1) {
-    if ((dl[i] <= in) && (in <= dl[i + 1]))
-      return 1;
-    i += 2;
-  }
-  return 0;
-}
-
-/*
- * srd="+" : index
- * srd="-" : read all msgs
- * else    : read msg in list : (ex: .notes read 5-9;12;13;18-)
- * idx=-1  : /msg
- */
-void notes_read(const char *hand, const char *nick, const char *srd, int idx)
-{
-  FILE *f = NULL;
-  char s[601] = "", *to = NULL, *dt = NULL, *from = NULL, *s1 = NULL, wt[100] = "";
-  time_t tt;
-  int ix = 1;
-  int ir = 0;
-  int rd[128];			/* Is it enough ? */
-  int i;
-
-  if (srd[0] == 0)
-    srd = "-";
-  if (!notefile[0]) {
-    if (idx >= 0)
-      dprintf(idx, "%s.\n", NOTES_NO_MESSAGES);
-    else
-      dprintf(DP_HELP, "NOTICE %s :%s.\n", nick, NOTES_NO_MESSAGES);
-    return;
-  }
-  f = fopen(notefile, "r");
-  if (f == NULL) {
-    if (idx >= 0)
-      dprintf(idx, "%s.\n", NOTES_NO_MESSAGES);
-    else
-      dprintf(DP_HELP, "NOTICE %s :%s.\n", nick, NOTES_NO_MESSAGES);
-    return;
-  }
-  notes_parse(rd, srd);
-  while (!feof(f)) {
-    fgets(s, 600, f);
-    i = strlen(s);
-    if (i > 0 && s[i - 1] == '\n')
-      s[i - 1] = 0;
-    if (!feof(f)) {
-      rmspace(s);
-      if ((s[0]) && (s[0] != '#') && (s[0] != ';')) {	/* Not comment */
-	s1 = s;
-	to = newsplit(&s1);
-	if (!egg_strcasecmp(to, hand)) {
-	  int lapse;
-
-	  from = newsplit(&s1);
-	  dt = newsplit(&s1);
-	  tt = atoi(dt);
-	  egg_strftime(wt, sizeof wt, "%b %d %H:%M %Z", gmtime(&tt));
-	  dt = wt;
-	  lapse = (int) ((now - tt) / 86400);
-	  if (lapse > note_life - 7) {
-	    if (lapse >= note_life)
-	      strcat(dt, NOTES_EXPIRE_TODAY);
-	    else
-	      sprintf(&dt[strlen(dt)], NOTES_EXPIRE_XDAYS, note_life - lapse,
-		      (note_life - lapse) == 1 ? "" : "S");
-	  }
-	  if (srd[0] == '+') {
-	    if (idx >= 0) {
-	      if (ix == 1)
-		dprintf(idx, "### %s:\n", NOTES_WAITING);
-	      dprintf(idx, "  %2d. %s (%s)\n", ix, from, dt);
-	    } else {
-	      dprintf(DP_HELP, "NOTICE %s :%2d. %s (%s)\n",
-		      nick, ix, from, dt);
-	    }
-	  } else if (notes_in(rd, ix)) {
-	    if (idx >= 0)
-	      dprintf(idx, "%2d. %s (%s): %s\n", ix, from, dt, s1);
-	    else
-	      dprintf(DP_HELP, "NOTICE %s :%2d. %s (%s): %s\n",
-		      nick, ix, from, dt, s1);
-	    ir++;
-	  }
-	  ix++;
-	}
-      }
-    }
-  }
-  fclose(f);
-  if ((srd[0] != '+') && (ir == 0) && (ix > 1)) {
-    if (idx >= 0)
-      dprintf(idx, "%s.\n", NOTES_NOT_THAT_MANY);
-    else
-      dprintf(DP_HELP, "NOTICE %s :%s.\n", nick, NOTES_NOT_THAT_MANY);
-  }
-  if (srd[0] == '+') {
-    if (ix == 1) {
-      if (idx >= 0)
-	dprintf(idx, "%s.\n", NOTES_NO_MESSAGES);
-      else
-	dprintf(DP_HELP, "NOTICE %s :%s.\n", nick, NOTES_NO_MESSAGES);
-    } else {
-      if (idx >= 0)
-	dprintf(idx, "### %s.\n", NOTES_DCC_USAGE_READ);
-      else
-	dprintf(DP_HELP, "NOTICE %s :(%d total)\n", nick, ix - 1);
-    }
-  } else if ((ir == 0) && (ix == 1)) {
-    if (idx >= 0)
-      dprintf(idx, "%s.\n", NOTES_NO_MESSAGES);
-    else
-      dprintf(DP_HELP, "NOTICE %s :%s.\n", nick, NOTES_NO_MESSAGES);
-  }
-}
-
-/*
- * sdl="-" : erase all msgs
- * else    : erase msg in list : (ex: .notes erase 2-4;8;16-)
- * idx=-1  : /msg
- */
-void notes_del(const char *hand, const char *nick, const char *sdl, int idx)
-{
-  FILE *f = NULL, *g = NULL;
-  char s[513] = "", *to = NULL, *s1 = NULL;
-  int in = 1;
-  int er = 0;
-  int dl[128];			/* Is it enough ? */
-
-  if (sdl[0] == 0)
-    sdl = "-";
-  if (!notefile[0]) {
-    if (idx >= 0)
-      dprintf(idx, "%s.\n", NOTES_NO_MESSAGES);
-    else
-      dprintf(DP_HELP, "NOTICE %s :%s.\n", nick, NOTES_NO_MESSAGES);
-    return;
-  }
-  f = fopen(notefile, "r");
-  if (f == NULL) {
-    if (idx >= 0)
-      dprintf(idx, "%s.\n", NOTES_NO_MESSAGES);
-    else
-      dprintf(DP_HELP, "NOTICE %s :%s.\n", nick, NOTES_NO_MESSAGES);
-    return;
-  }
-  simple_sprintf(s, "%s~new", notefile);
-  g = fopen(s, "w");
-  if (g == NULL) {
-    if (idx >= 0)
-      dprintf(idx, "%s. :(\n", NOTES_FAILED_CHMOD);
-    else
-      dprintf(DP_HELP, "NOTICE %s :%s. :(\n", nick, NOTES_FAILED_CHMOD);
-    fclose(f);
-    return;
-  }
-  fixmod(s);
-  notes_parse(dl, sdl);
-  while (!feof(f)) {
-    fgets(s, 512, f);
-    if (s[strlen(s) - 1] == '\n')
-      s[strlen(s) - 1] = 0;
-    if (!feof(f)) {
-      rmspace(s);
-      if ((s[0]) && (s[0] != '#') && (s[0] != ';')) {	/* Not comment */
-	s1 = s;
-	to = newsplit(&s1);
-	if (!egg_strcasecmp(to, hand)) {
-	  if (!notes_in(dl, in))
-	    fprintf(g, "%s %s\n", to, s1);
-	  else
-	    er++;
-	  in++;
-	} else
-	  fprintf(g, "%s %s\n", to, s1);
-      } else
-	fprintf(g, "%s\n", s);
-    }
-  }
-  fclose(f);
-  fclose(g);
-  unlink(notefile);
-  simple_sprintf(s, "%s~new", notefile);
-  movefile(s, notefile);
-  if ((er == 0) && (in > 1)) {
-    if (idx >= 0)
-      dprintf(idx, "%s.\n", NOTES_NOT_THAT_MANY);
-    else
-      dprintf(DP_HELP, "NOTICE %s :%s.\n", nick, NOTES_NOT_THAT_MANY);
-  } else if (in == 1) {
-    if (idx >= 0)
-      dprintf(idx, "%s.\n", NOTES_NO_MESSAGES);
-    else
-      dprintf(DP_HELP, "NOTICE %s :%s.\n", nick, NOTES_NO_MESSAGES);
-  } else {
-    if (er == (in - 1)) {
-      if (idx >= 0)
-	dprintf(idx, "%s.\n", NOTES_ERASED_ALL);
-      else
-	dprintf(DP_HELP, "NOTICE %s :%s.\n", nick, NOTES_ERASED_ALL);
-    } else {
-      if (idx >= 0)
-	dprintf(idx, "%s %d note%s; %d %s.\n", NOTES_ERASED, er,
-		(er != 1) ? "s" : "", in - 1 - er, NOTES_LEFT);
-      else
-	dprintf(DP_HELP, "NOTICE %s :Erased %d note%s; %d %s.\n", nick,
-		er, (er != 1) ? "s" : "", in - 1 - er, NOTES_LEFT);
-    }
-  }
-}
-
-/* notes <pass> <func>
- */
-static int msg_notes(char *nick, char *host, struct userrec *u, char *par)
-{
-  if (!u)
-    return 0;
-  if (u->bot)
-    return 1;
-  if (!par[0]) {
-    dprintf(DP_HELP, "NOTICE %s :%s: NOTES <pass> INDEX\n", nick, NOTES_USAGE);
-    dprintf(DP_HELP, "NOTICE %s :       NOTES <pass> TO <hand> <msg>\n", nick);
-    dprintf(DP_HELP, "NOTICE %s :       NOTES <pass> READ <# or ALL>\n", nick);
-    dprintf(DP_HELP, "NOTICE %s :       NOTES <pass> ERASE <# or ALL>\n", nick);
-    dprintf(DP_HELP, "NOTICE %s :       %s\n", nick, NOTES_MAYBE);
-    dprintf(DP_HELP, "NOTICE %s :       ex: NOTES mypass ERASE 2-4;8;16-\n", nick);
-    return 1;
-  }
-
-  char *pwd = NULL, *fcn = NULL;
-
-  if (!u_pass_match(u, "-")) {
-    /* they have a password set */
-    pwd = newsplit(&par);
-    if (!u_pass_match(u, pwd))
-      return 0;
-  }
-  fcn = newsplit(&par);
-  if (!egg_strcasecmp(fcn, "INDEX"))
-    notes_read(u->handle, nick, "+", -1);
-  else if (!egg_strcasecmp(fcn, "READ")) {
-    if (!egg_strcasecmp(par, "ALL"))
-      notes_read(u->handle, nick, "-", -1);
-    else
-      notes_read(u->handle, nick, par, -1);
-  } else if (!egg_strcasecmp(fcn, "ERASE")) {
-    if (!egg_strcasecmp(par, "ALL"))
-      notes_del(u->handle, nick, "-", -1);
-    else
-      notes_del(u->handle, nick, par, -1);
-  } else if (!egg_strcasecmp(fcn, "TO")) {
-    char *to = NULL;
-    int i;
-    FILE *f = NULL;
-    struct userrec *u2 = NULL;
-
-    to = newsplit(&par);
-    if (!par[0]) {
-      dprintf(DP_HELP, "NOTICE %s :%s: NOTES <pass> TO <hand> <message>\n",
-	      nick, NOTES_USAGE);
-      return 0;
-    }
-    u2 = get_user_by_handle(userlist, to);
-    if (!u2) {
-      dprintf(DP_HELP, "NOTICE %s :%s\n", nick, NOTES_USERF_UNKNOWN);
-      return 1;
-    } else if (is_bot(u2)) {
-      dprintf(DP_HELP, "NOTICE %s :%s\n", nick, NOTES_NOTTO_BOT);
-      return 1;
-    }
-    for (i = 0; i < dcc_total; i++) {
-      if (dcc[i].type && (!egg_strcasecmp(dcc[i].nick, to)) &&
-	  (dcc[i].type->flags & DCT_GETNOTES)) {
-	int aok = 1;
-
-	if (dcc[i].type->flags & DCT_CHAT)
-	  if (dcc[i].u.chat->away != NULL)
-	    aok = 0;
-	if (!(dcc[i].type->flags & DCT_CHAT))
-	  aok = 0;		/* Assume non dcc-chat == something weird, so
-				 * store notes for later */
-	if (aok) {
-	  dprintf(i, "\007%s [%s]: %s\n", u->handle, NOTES_OUTSIDE, par);
-	  dprintf(DP_HELP, "NOTICE %s :%s\n", nick, NOTES_DELIVERED);
-	  return 1;
-	}
-      }
-    }
-    if (notefile[0] == 0) {
-      dprintf(DP_HELP, "NOTICE %s :%s\n", nick, NOTES_UNSUPPORTED);
-      return 1;
-    }
-    f = fopen(notefile, "a");
-    if (f == NULL)
-      f = fopen(notefile, "w");
-    if (f == NULL) {
-      dprintf(DP_HELP, "NOTICE %s :%s", nick, NOTES_NOTEFILE_FAILED);
-      putlog(LOG_MISC, "*", "* %s", NOTES_NOTEFILE_UNREACHABLE);
-      return 1;
-    }
-    fixmod(notefile);
-    fprintf(f, "%s %s %li %s\n", to, u->handle, now, par);
-    fclose(f);
-    dprintf(DP_HELP, "NOTICE %s :%s\n", nick, NOTES_DELIVERED);
-    return 1;
-  } else
-    dprintf(DP_HELP, "NOTICE %s :%s INDEX, READ, ERASE, TO\n",
-	    nick, NOTES_DCC_USAGE_READ);
-  putlog(LOG_CMDS, "*", "(%s!%s) !%s! NOTES %s %s", nick, host, u->handle, fcn,
-	 par[0] ? "..." : "");
-  return 1;
-}
-
-static void notes_hourly()
-{
-  expire_notes();
-  if (notify_users) {
-    register struct chanset_t	*chan = NULL;
-    register memberlist	*m = NULL;
-    int k;
-    register int l;
-    char s1[256] = "";
-    struct userrec *u = NULL;
-
-    for (chan = chanset; chan; chan = chan->next) {
-      for (m = chan->channel.member; m && m->nick[0]; m = m->next) {
-	simple_sprintf(s1, "%s!%s", m->nick, m->userhost);
-	u = get_user_by_host(s1);
-	if (u) {
-	  k = num_notes(u->handle);
-	  for (l = 0; l < dcc_total; l++)
-	    if (dcc[l].type && (dcc[l].type->flags & DCT_CHAT) &&
-		!egg_strcasecmp(dcc[l].nick, u->handle)) {
-	      k = 0;		/* They already know they have notes */
-	      break;
-	    }
-	  if (k) {
-	    dprintf(DP_HELP, "NOTICE %s :You have %d note%s waiting on %s.\n",
-		    m->nick, k, k == 1 ? "" : "s", botname);
-	    dprintf(DP_HELP, "NOTICE %s :%s /MSG %s NOTES <pass> INDEX\n",
-		        m->nick, NOTES_FORLIST, botname);
-	  }
-	}
-      }
-    }
-    for (l = 0; l < dcc_total; l++) {
-     if (dcc[l].type) {
-      k = num_notes(dcc[l].nick);
-      if ((k > 0) && (dcc[l].type->flags & DCT_CHAT)) {
-	dprintf(l, NOTES_WAITING2, k, k == 1 ? "" : "s");
-	dprintf(l, NOTES_DCC_USAGE_READ2);
-      }
-     }
-    }
-  }
-}
-
-static void away_notes(char *bot, int idx, char *msg)
-{
-  if (egg_strcasecmp(bot, conf.bot->nick))
-    return;
-  if (msg && msg[0])
-    dprintf(idx, "%s\n", NOTES_STORED);
-  else
-    notes_read(dcc[idx].nick, 0, "+", idx);
-}
-
-int notes_chon(int idx)
-{
-  if (dcc[idx].type == &DCC_CHAT)
-    notes_read(dcc[idx].nick, 0, "+", idx);
-  return 0;
-}
-
-static cmd_t notes_nkch[] =
-{
-  {"*",		"",	(Function) notes_change,	"notes", 0},
-  {NULL,	NULL,	NULL,				NULL, 0}
-};
-
-static cmd_t notes_away[] =
-{
-  {"*",		"",	(Function) away_notes,		"notes", 0},
-  {NULL,	NULL,	NULL,				NULL, 0}
-};
-
-static cmd_t notes_msgs[] =
-{
-  {"notes",	"",	(Function) msg_notes,		NULL, LEAF},
-  {NULL,	NULL,	NULL,				NULL, 0}
-};
-
-static int notes_server_setup(char *mod)
-{
-  add_builtins("msg", notes_msgs);
-  return 0;
-}
-
-void notes_report(int idx, int details)
-{
-  if (details) {
-    if (notefile[0])
-      dprintf(idx, "    Notes can be stored, in: %s\n", notefile);
-    else
-      dprintf(idx, "    Notes can not be stored.\n");
-  }
-}
-
-void notes_init()
-{
-  timer_create_secs(3600, "notes_hourly", (Function) notes_hourly);
-
-  add_builtins("dcc", notes_cmds);
-  add_builtins("away", notes_away);
-  add_builtins("nkch", notes_nkch);
-
-  notes_server_setup(0);
-  egg_memcpy(&USERENTRY_FWD, &USERENTRY_INFO, sizeof(void *) * 12);
-  add_entry_type(&USERENTRY_FWD);
-}

+ 0 - 70
src/mod/notes.mod/notes.h

@@ -1,70 +0,0 @@
-/*
- * notes.h -- part of notes.mod
- *
- */
-
-#ifndef _EGG_MOD_NOTES_NOTES_H
-#define _EGG_MOD_NOTES_NOTES_H
-
-#include "src/common.h"
-#include "src/users.h"
-
-#define NOTES_IGNKEY "NOTESIGNORE"
-
-/* language #define's */
-
-
-#define NOTES_USAGE			"Usage"
-#define NOTES_USERF_UNKNOWN		"I don't know anyone by that name.\n"
-#define NOTES_FORWARD_TO		"  Forward notes to: %.70s\n"
-#define NOTES_SWITCHED_NOTES		"Switched %d note%s from %s to %s."
-#define NOTES_EXPIRED			"Expired %d note%s"
-#define NOTES_FORWARD_NOTONLINE		"Not online; forwarded to %s.\n"
-#define NOTES_UNSUPPORTED		"Notes are not supported by this bot."
-#define NOTES_NOTES2MANY		"Sorry, that user has too many notes already."
-#define NOTES_NOTEFILE_FAILED		"Can't create notefile.  Sorry."
-#define NOTES_NOTEFILE_UNREACHABLE	"Notefile unreachable!"
-#define NOTES_STORED_MESSAGE		"Stored message"
-#define NOTES_NO_MESSAGES		"You have no messages"
-#define NOTES_EXPIRE_TODAY		" -- EXPIRES TODAY"
-#define NOTES_EXPIRE_XDAYS		" -- EXPIRES IN %d DAY%s"
-#define NOTES_WAITING			"You have the following notes waiting"
-#define NOTES_NOT_THAT_MANY		"You don't have that many messages"
-#define NOTES_DCC_USAGE_READ		"Use 'notes read' to read them."
-#define NOTES_FAILED_CHMOD		"Can't modify the note file"
-#define NOTES_ERASED_ALL		"Erased all notes"
-#define NOTES_ERASED			"Erased"
-#define NOTES_LEFT			"left"
-#define NOTES_MAYBE			"# may be numbers and/or intervals separated by ;"
-#define NOTES_NOTTO_BOT			"That's a bot.  You can't leave notes for a bot."
-#define NOTES_OUTSIDE			"Outside yadda yadda"
-#define NOTES_DELIVERED			"Note delivered."
-#define NOTES_FORLIST			"For a list:"
-#define NOTES_WAITING_ON		"NOTICE %s :You have %d note%s waiting on %s.\n"
-#define NOTES_WAITING2			"### You have %d note%s waiting.\n"
-#define NOTES_DCC_USAGE_READ2		"### Use 'notes read' to read them.\n"
-#define NOTES_STORED			"Notes will be stored."
-#define NOTES_IGN_OTHERS		"You are not allowed to change note ignores for %s\n"
-#define NOTES_UNKNOWN_USER		"User %s does not exist.\n"
-#define NOTES_IGN_NEW			"Now ignoring notes from %s\n"
-#define NOTES_IGN_ALREADY		"Already ignoring %s\n"
-#define NOTES_IGN_REM			"No longer ignoring notes from %s\n"
-#define NOTES_IGN_NOTFOUND		"Note ignore %s not found in list.\n"
-#define NOTES_IGN_NONE			"No note ignores present.\n"
-#define NOTES_IGN_FOR			"Note ignores for %s:\n"
-#define NOTES_NO_SUCH_USER		"No such user."
-#define NOTES_FWD_OWNER			"Can't change notes forwarding of the bot owner.\n"
-#define NOTES_FWD_FOR			"Wiped notes forwarding for %s\n"
-#define NOTES_FWD_BOTNAME		"You must supply a botname to forward to."
-#define NOTES_FWD_CHANGED		"Changed notes forwarding for %s to: %s\n"
-#define NOTES_MUSTBE			"Function must be one of INDEX, READ, or ERASE."
-
-void notes_read(const char *, const char *, const char *, int);
-void notes_del(const char *, const char *, const char *, int);
-void fwd_display(int, struct user_entry *, struct userrec *);
-int num_notes(const char *);
-void notes_report(int, int);
-int storenote(char *, char *, char *, int, char *, int);
-int notes_chon(int);
-
-#endif				/* _EGG_MOD_NOTES_H */

+ 1 - 1
src/userrec.c

@@ -502,7 +502,7 @@ int change_handle(struct userrec *u, char *newh)
   /* Nothing that will confuse the userfile */
   if (!newh[1] && strchr(BADHANDCHARS, newh[0]))
     return 0;
-  check_bind_nkch(u->handle, newh);
+
   /* Yes, even send bot nick changes now: */
   if (!noshare)
     shareout("h %s %s\n", u->handle, newh);

+ 4 - 6
src/users.c

@@ -31,7 +31,6 @@
 #include "chan.h"
 #include "tandem.h"
 #include "src/mod/channels.mod/channels.h"
-#include "src/mod/notes.mod/notes.h"
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include "misc_file.h"
@@ -356,7 +355,6 @@ static void
 tell_user(int idx, struct userrec *u)
 {
   char s[81] = "", s1[81] = "", format[81] = "";
-  int n = num_notes(u->handle);
   time_t now2;
   struct chanuserrec *ch = NULL;
   struct chanset_t *chan = NULL;
@@ -376,8 +374,8 @@ tell_user(int idx, struct userrec *u)
       egg_strftime(s1, 6, "%H:%M", gmtime(&li->laston));
   }
   if (!u->bot) {
-    egg_snprintf(format, sizeof format, "%%-%us %%-5s%%5d %%-15s %%s (%%-10.10s)\n", HANDLEN);
-    dprintf(idx, format, u->handle, get_user(&USERENTRY_PASS, u) ? "yes" : "no", n, s, s1, (li && li->lastonplace) ? li->lastonplace : "nowhere");
+    egg_snprintf(format, sizeof format, "%%-%us %%-5s %%-15s %%s (%%-10.10s)\n", HANDLEN);
+    dprintf(idx, format, u->handle, get_user(&USERENTRY_PASS, u) ? "yes" : "no", s, s1, (li && li->lastonplace) ? li->lastonplace : "nowhere");
   } else {	/* BOT */
     egg_snprintf(format, sizeof format, "%%-%us %%-8s %%s (%%-10.10s)\n", HANDLEN);
     dprintf(idx, format, u->handle, s, s1, (li && li->lastonplace) ? li->lastonplace : "nowhere");
@@ -436,7 +434,7 @@ void tell_user_ident(int idx, char *id)
     egg_snprintf(format, sizeof format, "%%-%us FLAGS    LAST\n", HANDLEN);
     dprintf(idx, format, "BOTNICK");
   } else {
-    egg_snprintf(format, sizeof format, "%%-%us PASS NOTES FLAGS           LAST\n", HANDLEN);
+    egg_snprintf(format, sizeof format, "%%-%us PASS FLAGS           LAST\n", HANDLEN);
     dprintf(idx, format, "HANDLE");
   }
   tell_user(idx, u);
@@ -458,7 +456,7 @@ void tell_users_match(int idx, char *mtch, int start, int limit, char *chname, i
     egg_snprintf(format, sizeof format, "%%-%us FLAGS    LAST\n", HANDLEN);
     dprintf(idx, format, "BOTNICK");
   } else {
-    egg_snprintf(format, sizeof format, "%%-%us PASS NOTES FLAGS           LAST\n", HANDLEN);
+    egg_snprintf(format, sizeof format, "%%-%us PASS FLAGS           LAST\n", HANDLEN);
     dprintf(idx, format, "HANDLE");
   }
   if (start > 1)