Permalink
Browse files

m_joinpartsno No need to send global snonotices, every server can gen…

…erate the notices for itself
  • Loading branch information...
1 parent fe4854c commit b9780148a3ef10ef421ec2e72942d40bf8fd47fa @attilamolnar attilamolnar committed Oct 6, 2012
Showing with 10 additions and 16 deletions.
  1. +10 −16 2.0/m_joinpartsno.cpp
View
@@ -15,13 +15,13 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-
+
#include "inspircd.h"
-
- /* $ModAuthor: Shawn Smith */
- /* $ModDesc: Sends server notices when a user joins/parts a channel. */
- /* $ModDepends: core 2.0-2.1 */
-
+
+/* $ModAuthor: Shawn Smith */
+/* $ModDesc: Sends server notices when a user joins/parts a channel. */
+/* $ModDepends: core 2.0-2.1 */
+
class ModuleJoinPartSNO : public Module
{
public:
@@ -32,27 +32,21 @@ class ModuleJoinPartSNO : public Module
Implementation eventlist[] = { I_OnUserJoin, I_OnUserPart };
ServerInstance->Modules->Attach(eventlist, this, 2);
}
-
+
Version GetVersion()
{
return Version("Creates SNOMask for user joins/parts", VF_VENDOR);
}
-
+
void OnUserJoin(Membership* memb, bool sync, bool created, CUList& except)
{
/* If it's a local user do e, else E. */
- if (IS_LOCAL(memb->user))
- ServerInstance->SNO->WriteToSnoMask('e', "User %s!%s@%s joined %s", memb->user->nick.c_str(), memb->user->ident.c_str(), memb->user->host.c_str(), memb->chan->name.c_str());
- else
- ServerInstance->SNO->WriteGlobalSno('E', "User %s!%s@%s joined %s", memb->user->nick.c_str(), memb->user->ident.c_str(), memb->user->host.c_str(), memb->chan->name.c_str());
+ ServerInstance->SNO->WriteToSnoMask((IS_LOCAL(memb->user) ? 'e' : 'E'), "User %s joined %s", memb->user->GetFullRealHost().c_str(), memb->chan->name.c_str());
}
void OnUserPart(Membership* memb, std::string &partmessage, CUList &except)
{
- if (IS_LOCAL(memb->user))
- ServerInstance->SNO->WriteToSnoMask('p', "User %s!%s@%s parted %s", memb->user->nick.c_str(), memb->user->ident.c_str(), memb->user->host.c_str(), memb->chan->name.c_str());
- else
- ServerInstance->SNO->WriteGlobalSno('P', "User %s!%s@%s parted %s", memb->user->nick.c_str(), memb->user->ident.c_str(), memb->user->host.c_str(), memb->chan->name.c_str());
+ ServerInstance->SNO->WriteToSnoMask((IS_LOCAL(memb->user) ? 'p' : 'P'), "User %s parted %s", memb->user->GetFullRealHost().c_str(), memb->chan->name.c_str());
}
};

0 comments on commit b978014

Please sign in to comment.