Add timestamps to S<->S INVITE messages and use them.
authorMichael Poole <mdpoole@troilus.org>
Thu, 20 Jan 2005 04:00:29 +0000 (04:00 +0000)
committerMichael Poole <mdpoole@troilus.org>
Thu, 20 Jan 2005 04:00:29 +0000 (04:00 +0000)
git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@1299 c9e4aea6-c8fd-4c43-8297-357d70d61c8c

ChangeLog
ircd/m_invite.c

index f0e64b7a5093fb6aa948f7a821d51c7fad09274c..0a538929c37bbf06c76a73364d6b68846489f053 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2005-01-19  Michael Poole <mdpoole@troilus.org>
+
+       * ircd/m_invite.c (m_invite, ms_invite): Include timestamp in
+       outbound INVITE messages.  On incoming INVITEs, ignore if the
+       timestamp is too recent or if the timestamp is missing and the
+       peer server is in burst.
+
 2005-01-15  Michael Poole <mdpoole@troilus.org>
 
        * RELEASE.NOTES: Mention CIDR support for Client, Operator, bans
index 2b8cbcff0980fbe478960b14c4fbb7b4b2d9b338..fff07191bfe1cbda0ab9548b9236972667d76fb8 100644 (file)
@@ -190,9 +190,11 @@ int m_invite(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
       /* Announce to servers with channel operators, but skip acptr,
        * since they will be notified below. */
       sendcmdto_channel_servers_butone(sptr, NULL, TOK_INVITE, chptr, acptr, SKIP_NONOPS,
-                                       "%s :%H", cli_name(acptr), chptr);
+                                       "%s %H %Tu", cli_name(acptr),
+                                       chptr, chptr->creationtime);
     }
-    sendcmdto_one(sptr, CMD_INVITE, acptr, "%s :%H", cli_name(acptr), chptr);
+    sendcmdto_one(sptr, CMD_INVITE, acptr, "%s %H %Tu", cli_name(acptr),
+                  chptr, chptr->creationtime);
   }
 
   return 0;
@@ -204,6 +206,7 @@ int m_invite(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
  *   parv[0] - sender prefix
  *   parv[1] - user to invite
  *   parv[2] - channel name
+ *   parv[3] - (optional) channel timestamp
  *
  * - INVITE now is accepted only if who does it is chanop (this of course
  *   implies that channel must exist and he must be on it).
@@ -213,11 +216,15 @@ int m_invite(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
  *
  * - Invite with no parameters now lists the channels you are invited to.
  *                                                         - Isomer 23 Oct 99
+ *
+ * - Invite with too-late timestamp, or with no timestamp from a bursting
+ *   server, is silently discarded.                   - Entrope 19 Jan 05
  */
 int ms_invite(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
 {
   struct Client *acptr;
   struct Channel *chptr;
+  time_t invite_ts;
   
   if (IsServer(sptr)) {
     /*
@@ -253,6 +260,13 @@ int ms_invite(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
     return 0;
   }
 
+  if (parc > 3) {
+    invite_ts = atoi(parv[3]);
+    if (invite_ts > chptr->creationtime)
+      return 0;
+  } else if (IsBurstOrBurstAck(cptr))
+    return 0;
+
   if (!IsChannelService(sptr) && !find_channel_member(sptr, chptr)) {
     send_reply(sptr, ERR_NOTONCHANNEL, chptr->chname);
     return 0;
@@ -278,10 +292,13 @@ int ms_invite(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
     /* Announce to servers with channel operators, but skip acptr,
      * since they will be notified below. */
     sendcmdto_channel_servers_butone(sptr, NULL, TOK_INVITE, chptr, acptr, SKIP_NONOPS,
-                                     "%s :%H", cli_name(acptr), chptr);
+                                     "%s %H %Tu", cli_name(acptr), chptr,
+                                     chptr->creationtime);
   }
 
-  sendcmdto_one(sptr, CMD_INVITE, acptr, "%s :%H", cli_name(acptr), chptr);
+  sendcmdto_one(sptr, CMD_INVITE, acptr,
+                "%s %H %Tu",
+                cli_name(acptr), chptr, chptr->creationtime);
   return 0;
 }