From dde67b9765bc485d807f181bba108c00f4c44dba Mon Sep 17 00:00:00 2001 From: brain Date: Fri, 21 Mar 2008 19:42:08 +0000 Subject: Add capability for m_services_account to broadcast login events, with the user who is logging in and their login name git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9149 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/account.h | 27 +++++++++++++++++++++++++++ src/modules/m_sasl.cpp | 6 ++++++ src/modules/m_services_account.cpp | 10 ++++++++++ 3 files changed, 43 insertions(+) create mode 100644 src/modules/account.h (limited to 'src/modules') diff --git a/src/modules/account.h b/src/modules/account.h new file mode 100644 index 000000000..833fe7aee --- /dev/null +++ b/src/modules/account.h @@ -0,0 +1,27 @@ +/* +------------------------------------+ + * | Inspire Internet Relay Chat Daemon | + * +------------------------------------+ + * + * InspIRCd: (C) 2002-2008 InspIRCd Development Team + * See: http://www.inspircd.org/wiki/index.php/Credits + * + * This program is free but copyrighted software; see + * the file COPYING for details. + * + * --------------------------------------------------- + */ + +#ifndef __ACCOUNT_H__ +#define __ACCOUNT_H__ + +#include +#include + +class AccountData +{ + public: + User* user; + std::string account; +}; + +#endif diff --git a/src/modules/m_sasl.cpp b/src/modules/m_sasl.cpp index fc4a75fe3..87d87d978 100644 --- a/src/modules/m_sasl.cpp +++ b/src/modules/m_sasl.cpp @@ -13,6 +13,7 @@ #include "inspircd.h" #include "m_cap.h" +#include "account.h" /* $ModDesc: Provides support for atheme SASL via AUTHENTICATE. */ @@ -83,6 +84,11 @@ class ModuleSASL : public Module target->WriteServ("AUTHENTICATE %s", line.c_str()); } } + else if (ev->GetEventID() == "account_login") + { + AccountData* ac = (AccountData*)ev->GetData(); + ac->user->WriteServ("903 %s :SASL authentication successful", ac->user->nick); + } } }; diff --git a/src/modules/m_services_account.cpp b/src/modules/m_services_account.cpp index fe7f52f22..4bb6f9268 100644 --- a/src/modules/m_services_account.cpp +++ b/src/modules/m_services_account.cpp @@ -12,6 +12,7 @@ */ #include "inspircd.h" +#include "account.h" /* $ModDesc: Povides support for ircu-style services accounts, including chmode +R, etc. */ @@ -304,6 +305,15 @@ class ModuleServicesAccount : public Module // remove any accidental leading/trailing spaces trim(*text); dest->Extend("accountname", text); + + if (IS_LOCAL(dest)) + dest->WriteServ("900 %s %s %s :You are now logged in as %s", dest->nick, dest->GetFullHost(), text->c_str(), text->c_str()); + + AccountData ac; + ac.user = dest; + ac.account = *text; + Event n((char*)&ac, this, "account_login"); + n.Send(ServerInstance); } } } -- cgit v1.2.3