]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_ircv3_invitenotify.cpp
Sync helpop chmodes s and p with docs
[user/henk/code/inspircd.git] / src / modules / m_ircv3_invitenotify.cpp
index 3783ff33c48149e8494c984e1fabee9052dfc79c..4908fcdaf674a5c9c198a71fb9ea073cf59efb5b 100644 (file)
@@ -1,7 +1,8 @@
 /*
  * InspIRCd -- Internet Relay Chat Daemon
  *
- *   Copyright (C) 2015 Attila Molnar <attilamolnar@hush.com>
+ *   Copyright (C) 2018 Sadie Powell <sadie@witchery.services>
+ *   Copyright (C) 2015, 2018 Attila Molnar <attilamolnar@hush.com>
  *
  * This file is part of InspIRCd.  InspIRCd is free software: you can
  * redistribute it and/or modify it under the terms of the GNU General Public
@@ -32,8 +33,8 @@ class ModuleIRCv3InviteNotify : public Module
 
        void OnUserInvite(User* source, User* dest, Channel* chan, time_t expiry, unsigned int notifyrank, CUList& notifyexcepts) CXX11_OVERRIDE
        {
-               std::string msg = "INVITE ";
-               msg.append(dest->nick).append(1, ' ').append(chan->name);
+               ClientProtocol::Messages::Invite invitemsg(source, dest, chan);
+               ClientProtocol::Event inviteevent(ServerInstance->GetRFCEvents().invite, invitemsg);
                const Channel::MemberMap& users = chan->GetUsers();
                for (Channel::MemberMap::const_iterator i = users.begin(); i != users.end(); ++i)
                {
@@ -47,8 +48,10 @@ class ModuleIRCv3InviteNotify : public Module
                        if (memb->getRank() < notifyrank)
                                continue;
 
+                       // Caps are only set on local users
+                       LocalUser* const localuser = static_cast<LocalUser*>(user);
                        // Send and add the user to the exceptions so they won't get the NOTICE invite announcement message
-                       user->WriteFrom(source, msg);
+                       localuser->Send(inviteevent);
                        notifyexcepts.insert(user);
                }
        }
@@ -61,7 +64,7 @@ class ModuleIRCv3InviteNotify : public Module
 
        Version GetVersion() CXX11_OVERRIDE
        {
-               return Version("Provides the invite-notify IRCv3.2 extension", VF_VENDOR);
+               return Version("Provides the IRCv3 invite-notify client capability.", VF_VENDOR);
        }
 };