Include channel name in the status message sent to channel operators.
authorMichael Poole <mdpoole@troilus.org>
Tue, 25 May 2004 03:10:01 +0000 (03:10 +0000)
committerMichael Poole <mdpoole@troilus.org>
Tue, 25 May 2004 03:10:01 +0000 (03:10 +0000)
Assign to chptr before trying to dereference it.

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

ChangeLog
ircd/m_invite.c

index 12ebed2127b91edc0289d58471e2140608d5ff01..4118438a2e64b5d866bbdc645ccf92af2106b9a0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2004-05-24  Michael Poole <mdpoole@troilus.org>
+
+       * ircd/m_invite.c (m_invite): Include channel name in invitation
+       announcements.
+       (ms_invite): Likewise, and also fix a use-before-assignment bug in
+       them.
+
 2004-05-18  Michael Poole <mdpoole@troilus.org>
 
        Announce invitations to other channel operators.
index d36e1df2d25099d393db2726a581e98ff005ae53..19a00d3b1a25bb20d87c4c0600bff74d4731206f 100644 (file)
@@ -183,8 +183,8 @@ int m_invite(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
     if (feature_bool(FEAT_ANNOUNCE_INVITES)) {
       sendcmdto_channel_butserv_butone(&me, get_error_numeric(RPL_ISSUEDINVITE)->str,
                                        NULL, chptr, sptr, SKIP_NONOPS, 
-                                       "%C %C :%C has been invited by %C",
-                                       acptr, sptr, acptr, sptr);
+                                       "%H %C %C :%C has been invited by %C",
+                                       chptr, acptr, sptr, acptr, sptr);
       sendcmdto_channel_servers_butone(sptr, NULL, TOK_INVITE, chptr, sptr, 0,
                                        "%s :%H", cli_name(acptr), chptr);
       if (MyConnect(acptr))
@@ -242,27 +242,6 @@ int ms_invite(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
     send_reply(sptr, ERR_NOSUCHNICK, parv[1]);
     return 0;
   }
-  if (feature_bool(FEAT_ANNOUNCE_INVITES)) {
-    sendcmdto_channel_butserv_butone(&me, get_error_numeric(RPL_ISSUEDINVITE)->str,
-                                     NULL, chptr, sptr, SKIP_NONOPS, 
-                                     "%C %C :%C has been invited by %C",
-                                     acptr, sptr, acptr, sptr);
-    sendcmdto_channel_servers_butone(sptr, NULL, TOK_INVITE, chptr, sptr, 0,
-                                     "%s :%H", cli_name(acptr), chptr);
-    if (MyConnect(acptr))
-      sendcmdto_one(sptr, CMD_INVITE, acptr, "%s :%H", cli_name(acptr), chptr);
-    return 0;
-  }
-  if (!MyUser(acptr)) {
-    /*
-     * just relay the message
-     */
-    sendcmdto_one(sptr, CMD_INVITE, acptr, "%s :%s", cli_name(acptr), parv[2]);
-    return 0;
-  }
-
-  if (is_silenced(sptr, acptr))
-    return 0;
 
   if (!(chptr = FindChannel(parv[2]))) {
     /*
@@ -277,11 +256,27 @@ int ms_invite(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
     send_reply(sptr, ERR_NOTONCHANNEL, chptr->chname);
     return 0;
   }
+
   if (find_channel_member(acptr, chptr)) {
     send_reply(sptr, ERR_USERONCHANNEL, cli_name(acptr), chptr->chname);
     return 0;
   }
-  add_invite(acptr, chptr);
+
+  if (is_silenced(sptr, acptr))
+    return 0;
+
+  if (MyConnect(acptr))
+      add_invite(acptr, chptr);
+
+  if (feature_bool(FEAT_ANNOUNCE_INVITES)) {
+    sendcmdto_channel_butserv_butone(&me, get_error_numeric(RPL_ISSUEDINVITE)->str,
+                                     NULL, chptr, sptr, SKIP_NONOPS, 
+                                     "%H %C %C :%C has been invited by %C",
+                                     chptr, acptr, sptr, acptr, sptr);
+    sendcmdto_channel_servers_butone(sptr, NULL, TOK_INVITE, chptr, sptr, 0,
+                                     "%s :%H", cli_name(acptr), chptr);
+  }
+
   sendcmdto_one(sptr, CMD_INVITE, acptr, "%s :%H", cli_name(acptr), chptr);
   return 0;
 }