Author: Isomer <isomer@coders.net>
authorPerry Lorier <isomer@undernet.org>
Sun, 15 Apr 2001 06:58:57 +0000 (06:58 +0000)
committerPerry Lorier <isomer@undernet.org>
Sun, 15 Apr 2001 06:58:57 +0000 (06:58 +0000)
Log message:

Lots of little changes I've been sitting on, mostly minor cleanups to m_*.c

git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@404 c9e4aea6-c8fd-4c43-8297-357d70d61c8c

13 files changed:
RELEASE.NOTES
doc/rfc1459.unet
include/ircd_reply.h
include/s_user.h
ircd/ircd_reply.c
ircd/m_admin.c
ircd/m_away.c
ircd/m_connect.c
ircd/m_desynch.c
ircd/m_endburst.c
ircd/m_help.c
ircd/m_info.c
ircd/s_user.c

index 911323590ba566fde53c0cc8e3cd3c78cba9f1fd..4e17c49fff2688221f40d8f7bf6575b0c1f0f177 100644 (file)
@@ -139,3 +139,5 @@ The kernel has a kernel destination cache size of 4096.  If the kernel sees
 more than 4096 IP's in 60s it warns 'dst cache overflow'.  This limit can be
 changed by modifying /proc/sys/net/ipv4/route/max_size.
 
+A patch to select is also recommended if you have regular poll/select
+errors.
\ No newline at end of file
index 84d106a03ae5c82acced5aec9fc769546c6c3c8c..6a3f36b6cf103e3fccf4ff4f6cd386cc2bf2de05 100644 (file)
@@ -1718,7 +1718,8 @@ RFC 1459              Internet Relay Chat Protocol              May 1993
    The admin message is used to find the name of the administrator of
    the given server, or current server if <server> parameter is omitted.
    Each server must have the ability to forward ADMIN messages to other
-   servers.
+   servers.  The given server may be a nick, where the server that the
+   nick is on will be queried.
 
    Numeric Replies:
 
index 4ea9e5afec3eb359004657d5ccf45c04abfd6f20..9df7d96a2a755de1b0412f0b8eb6678ececc0c52 100644 (file)
@@ -28,7 +28,6 @@ extern int protocol_violation(struct Client* cptr, const char* pattern, ...);
 extern int need_more_params(struct Client* cptr, const char* cmd);
 extern int send_error_to_client(struct Client* cptr, int error, ...);
 extern int send_reply(struct Client* to, int reply, ...);
-extern int send_admin_info(struct Client* to);
 
 #define SND_EXPLICIT   0x40000000      /* first arg is a pattern to use */
 
index c8457add24c2a26ab4986b0cf4f473a0eb701389..fec38e238f7e0fd10718d881659c9329fc0d55d0 100644 (file)
@@ -63,7 +63,6 @@ extern int          register_user(struct Client* cptr, struct Client* sptr,
 
 extern void         user_count_memory(size_t* count_out, size_t* bytes_out);
 
-extern int user_set_away(struct User* user, char* message);
 extern int do_nick_name(char* nick);
 extern int set_nick_name(struct Client* cptr, struct Client* sptr,
                          const char* nick, int parc, char* parv[]);
index 3a222a3f8cf2e7fcd4e9b25c8192c5a7339fb445..39d651459d14f66db927fc590afab098b307c5cd 100644 (file)
@@ -106,16 +106,5 @@ int send_reply(struct Client *to, int reply, ...)
   return 0; /* convenience return */
 }
 
-int send_admin_info(struct Client* sptr)
-{
-  const struct LocalConf* admin = conf_get_local();
-  assert(0 != sptr);
-
-  send_reply(sptr, RPL_ADMINME,    cli_name(&me));
-  send_reply(sptr, RPL_ADMINLOC1,  admin->location1);
-  send_reply(sptr, RPL_ADMINLOC2,  admin->location2);
-  send_reply(sptr, RPL_ADMINEMAIL, admin->contact);
-  return 0;
-}
 
 
index 839d7148846249972cf44916e401e9eea62c0c10..a6bbcce070d32bf5ee137997a448f37d908cbb71 100644 (file)
 
 #include <assert.h>
 
+static int send_admin_info(struct Client* sptr)
+{
+  const struct LocalConf* admin = conf_get_local();
+  assert(0 != sptr);
+
+  send_reply(sptr, RPL_ADMINME,    cli_name(&me));
+  send_reply(sptr, RPL_ADMINLOC1,  admin->location1);
+  send_reply(sptr, RPL_ADMINLOC2,  admin->location2);
+  send_reply(sptr, RPL_ADMINEMAIL, admin->contact);
+  return 0;
+}
+
+
 /*
  * m_admin - generic message handler
  *
@@ -110,7 +123,10 @@ int m_admin(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
 
   if (parc > 1) {
     struct Client *acptr;
-    if (!(acptr = find_match_server(parv[1])))
+    acptr = FindUser(parv[1]);
+    if (acptr)
+      parv[1] = cli_name(cli_user(acptr)->server);
+    else if (!(acptr = find_match_server(parv[1])))
       return send_reply(sptr, ERR_NOSUCHSERVER, parv[1]);
 
     parv[1] = cli_name(acptr);
index 787e570bd32087b2853e2ee4592b6e63517dae1f..79127a30c8b9fba17d69fb975ca2759e8f9f73bd 100644 (file)
@@ -89,6 +89,7 @@
 #endif /* 0 */
 #include "client.h"
 #include "ircd.h"
+#include "ircd_alloc.h"
 #include "ircd_reply.h"
 #include "ircd_string.h"
 #include "msg.h"
 
 #include <assert.h>
 
+/*
+ * user_set_away - set user away state
+ * returns 1 if client is away or changed away message, 0 if 
+ * client is removing away status.
+ * NOTE: this function may modify user and message, so they
+ * must be mutable.
+ */
+static int user_set_away(struct User* user, char* message)
+{
+  char* away;
+  assert(0 != user);
+
+  away = user->away;
+
+  if (EmptyString(message)) {
+    /*
+     * Marking as not away
+     */
+    if (away) {
+      MyFree(away);
+      user->away = 0;
+    }
+  }
+  else {
+    /*
+     * Marking as away
+     */
+    unsigned int len = strlen(message);
+
+    if (len > TOPICLEN) {
+      message[TOPICLEN] = '\0';
+      len = TOPICLEN;
+    }
+    if (away)
+      away = (char*) MyRealloc(away, len + 1);
+    else
+      away = (char*) MyMalloc(len + 1);
+    assert(0 != away);
+
+    user->away = away;
+    strcpy(away, message);
+  }
+  return (user->away != 0);
+}
+
+
 /*
  * m_away - generic message handler template
  * - Added 14 Dec 1988 by jto.
  *
  * parv[0] = sender prefix
  * parv[1] = away message
+ *
+ * TODO: Throttle aways - many people have a script which resets the away
+ *       message every 10 seconds which really chews the bandwidth.
  */
 int m_away(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
 {
index cbc75bbef3254d4ed7706335200cf913daf1a7bc..43d704ab24fe574fad0075df04f6b97c31ad080f 100644 (file)
@@ -138,6 +138,7 @@ int ms_connect(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
      * checked it's args, if we don't have parc == 4, something
      * isn't right.
      */
+    protocol_violation(sptr, "Too few parameters to connect");
     return need_more_params(sptr, "CONNECT");
   }
 
index eee568fd892fd4027e3dcc10fb08e133bd4c1049..dcb7e22fad99d61f5a2541062f8f5d19b27a00d1 100644 (file)
@@ -119,33 +119,3 @@ int ms_desynch(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
 
   return 0;
 }
-
-#if 0
-/*
- * m_desynch
- *
- * Writes to all +g users; for sending wall type debugging/anti-hack info.
- * Added 23 Apr 1998  --Run
- *
- * parv[0] - sender prefix
- * parv[parc-1] - message text
- */
-int m_desynch(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
-{
-  if (IsServer(sptr) && parc >= 2)
-  {
-    int i;
-    struct Client *acptr;
-    /* Send message to local +g clients as if it were a wallops */
-    sprintf_irc(sendbuf, ":%s WALLOPS :%s", parv[0], parv[parc - 1]); /* XXX DEAD */
-    for (i = 0; i <= HighestFd; i++)
-      if ((acptr = LocalClientArray[i]) && !IsServer(acptr) && !IsMe(acptr) &&
-          SendDebug(acptr))
-        sendbufto_one(acptr); /* XXX DEAD */
-    /* Send message to remote +g clients */
-    sendto_g_serv_butone(cptr, "%s DESYNCH :%s", NumServ(sptr), parv[parc - 1]); /* XXX DEAD */
-  }
-  return 0;
-}
-#endif /* 0 */
-
index c987428cbbfac02b77b7379d3c55ceb2e64f3bba..9243d30bf4d41ae7b9e06433626abe18b12d9c2f 100644 (file)
@@ -166,51 +166,3 @@ int ms_end_of_burst_ack(struct Client *cptr, struct Client *sptr, int parc, char
 
   return 0;
 }
-
-
-#if 0
-/*
- * m_end_of_burst  - Added Xorath 6-14-96, rewritten by Run 24-7-96
- *                 - and fixed by record and Kev 8/1/96
- *                 - and really fixed by Run 15/8/96 :p
- * This the last message in a net.burst.
- * It clears a flag for the server sending the burst.
- *
- * parv[0] - sender prefix
- */
-int m_end_of_burst(struct Client *cptr, struct Client *sptr, int parc, char **parv)
-{
-  if (!IsServer(sptr))
-    return 0;
-
-  sendto_op_mask(SNO_NETWORK, "Completed net.burst from %s.", sptr->name); /* XXX DEAD */
-  sendto_serv_butone(cptr, "%s EB", NumServ(sptr)); /* XXX DEAD */
-  ClearBurst(sptr);
-  SetBurstAck(sptr);
-  if (MyConnect(sptr))
-    sendto_one(sptr, "%s EA", NumServ(&me)); /* XXX DEAD */
-
-  return 0;
-}
-/*
- * m_end_of_burst_ack
- *
- * This the acknowledge message of the `END_OF_BURST' message.
- * It clears a flag for the server receiving the burst.
- *
- * parv[0] - sender prefix
- */
-int m_end_of_burst_ack(struct Client *cptr, struct Client *sptr, int parc, char **parv)
-{
-  if (!IsServer(sptr))
-    return 0;
-
-  sendto_op_mask(SNO_NETWORK, "%s acknowledged end of net.burst.", sptr->name); /* XXX DEAD */
-  sendto_serv_butone(cptr, "%s EA", NumServ(sptr)); /* XXX DEAD */
-  ClearBurstAck(sptr);
-
-  return 0;
-}
-
-#endif /* 0 */
-
index 36d53eb3e261d8f3c40be0c3f62d565d9bf8edec..a56341fe8a150c8eafe171e903be72f44a187664 100644 (file)
@@ -111,20 +111,3 @@ int m_help(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
   return 0;
 }
 
-
-#if 0
-/*
- * m_help
- *
- * parv[0] = sender prefix
- */
-int m_help(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
-{
-  int i;
-
-  for (i = 0; msgtab[i].cmd; i++)
-    sendto_one(sptr, ":%s NOTICE %s :%s", me.name, parv[0], msgtab[i].cmd); /* XXX DEAD */
-  return 0;
-}
-#endif /* 0 */
-
index ea3db75dd231dd1d3f2d9519e30ccc3aeae1861d..6c08e84f861e119d1ab6e8597eaecd25ea35de01 100644 (file)
@@ -96,6 +96,7 @@
 #include "numnicks.h"
 #include "s_misc.h"
 #include "s_user.h"
+#include "s_conf.h"
 #include "send.h"
 #include "version.h"
 
@@ -111,27 +112,21 @@ int m_info(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
 {
   const char **text = infotext;
 
-  if (hunt_server_cmd(sptr, CMD_INFO, cptr, 1, ":%C", 1, parc, parv) ==
+  if (hunt_server_cmd(sptr, CMD_INFO, cptr, 1, ":%C", 1, parc, parv) !=
       HUNTED_ISME)
+       return 0;
+
+  while (text[2])
   {
-    while (text[2])
-    {
-      if (!IsOper(sptr))
-       send_reply(sptr, RPL_INFO, *text);
-      text++;
-    }
-    if (IsOper(sptr))
-    {
-      while (*text)
-       send_reply(sptr, RPL_INFO, *text++);
-      send_reply(sptr, RPL_INFO, "");
-    }
-    send_reply(sptr, SND_EXPLICIT | RPL_INFO, ":Birth Date: %s, compile # %s",
-              creation, generation);
-    send_reply(sptr, SND_EXPLICIT | RPL_INFO, ":On-line since %s",
-              myctime(cli_firsttime(&me)));
-    send_reply(sptr, RPL_ENDOFINFO);
+    send_reply(sptr, RPL_INFO, *text);
+    text++;
   }
+  send_reply(sptr, SND_EXPLICIT | RPL_INFO, ":Birth Date: %s, compile # %s",
+      creation, generation);
+  send_reply(sptr, SND_EXPLICIT | RPL_INFO, ":On-line since %s",
+      myctime(cli_firsttime(&me)));
+  send_reply(sptr, RPL_ENDOFINFO);
+
   return 0;
 }
 
@@ -148,27 +143,26 @@ int ms_info(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
   if (IsServer(sptr))
     return 0;
 
-  if (hunt_server_cmd(sptr, CMD_INFO, cptr, 1, ":%C", 1, parc, parv) ==
+  if (hunt_server_cmd(sptr, CMD_INFO, cptr, 1, ":%C", 1, parc, parv) !=
       HUNTED_ISME)
+       return 0;
+  while (text[2])
   {
-    while (text[2])
-    {
-      if (!IsOper(sptr))
-       send_reply(sptr, RPL_INFO, *text);
-      text++;
-    }
-    if (IsOper(sptr))
-    {
-      while (*text)
-       send_reply(sptr, RPL_INFO, *text++);
-      send_reply(sptr, RPL_INFO, "");
-    }
-    send_reply(sptr, SND_EXPLICIT | RPL_INFO, ":Birth Date: %s, compile # %s",
-              creation, generation);
-    send_reply(sptr, SND_EXPLICIT | RPL_INFO, ":On-line since %s",
-              myctime(cli_firsttime(&me)));
-    send_reply(sptr, RPL_ENDOFINFO);
+    if (!IsOper(sptr))
+      send_reply(sptr, RPL_INFO, *text);
+    text++;
+  }
+  if (IsOper(sptr))
+  {
+    while (*text)
+      send_reply(sptr, RPL_INFO, *text++);
+    send_reply(sptr, RPL_INFO, "");
   }
+  send_reply(sptr, SND_EXPLICIT | RPL_INFO, ":Birth Date: %s, compile # %s",
+      creation, generation);
+  send_reply(sptr, SND_EXPLICIT | RPL_INFO, ":On-line since %s",
+      myctime(cli_firsttime(&me)));
+  send_reply(sptr, RPL_ENDOFINFO);
   return 0;
 }
 
@@ -206,39 +200,3 @@ int mo_info(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
   return 0;
 }
 
-  
-#if 0
-/*
- * m_info
- *
- * parv[0] = sender prefix
- * parv[1] = servername
- */
-int m_info(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
-{
-  const char **text = infotext;
-
-  if (hunt_server(1, cptr, sptr, "%s%s " TOK_INFO " :%s", 1, parc, parv) == HUNTED_ISME) /* XXX DEAD */
-  {
-    while (text[2])
-    {
-      if (!IsOper(sptr))
-        sendto_one(sptr, rpl_str(RPL_INFO), me.name, parv[0], *text); /* XXX DEAD */
-      text++;
-    }
-    if (IsOper(sptr))
-    {
-      while (*text)
-        sendto_one(sptr, rpl_str(RPL_INFO), me.name, parv[0], *text++); /* XXX DEAD */
-      sendto_one(sptr, rpl_str(RPL_INFO), me.name, parv[0], ""); /* XXX DEAD */
-    }
-    sendto_one(sptr, ":%s %d %s :Birth Date: %s, compile # %s", /* XXX DEAD */
-        me.name, RPL_INFO, parv[0], creation, generation);
-    sendto_one(sptr, ":%s %d %s :On-line since %s", /* XXX DEAD */
-        me.name, RPL_INFO, parv[0], myctime(me.firsttime));
-    sendto_one(sptr, rpl_str(RPL_ENDOFINFO), me.name, parv[0]); /* XXX DEAD */
-  }
-  return 0;
-}
-#endif /* 0 */
-
index b4695ede58b6b27342d0fc91376884920196833d..c607f1b88258bbb9dd65e99645f1842c53a73783 100644 (file)
@@ -130,50 +130,6 @@ void user_count_memory(size_t* count_out, size_t* bytes_out)
   *bytes_out = userCount * sizeof(struct User);
 }
 
-/*
- * user_set_away - set user away state
- * returns 1 if client is away or changed away message, 0 if 
- * client is removing away status.
- * NOTE: this function may modify user and message, so they
- * must be mutable.
- */
-int user_set_away(struct User* user, char* message)
-{
-  char* away;
-  assert(0 != user);
-
-  away = user->away;
-
-  if (EmptyString(message)) {
-    /*
-     * Marking as not away
-     */
-    if (away) {
-      MyFree(away);
-      user->away = 0;
-    }
-  }
-  else {
-    /*
-     * Marking as away
-     */
-    unsigned int len = strlen(message);
-
-    if (len > TOPICLEN) {
-      message[TOPICLEN] = '\0';
-      len = TOPICLEN;
-    }
-    if (away)
-      away = (char*) MyRealloc(away, len + 1);
-    else
-      away = (char*) MyMalloc(len + 1);
-    assert(0 != away);
-
-    user->away = away;
-    strcpy(away, message);
-  }
-  return (user->away != 0);
-}
 
 /*
  * next_client