summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2008-03-21 19:42:08 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2008-03-21 19:42:08 +0000
commitdde67b9765bc485d807f181bba108c00f4c44dba (patch)
tree99aa38a52b8fc6c94ad05b2087d34456377d4f5f
parente541d870345bd0f7066049a17ddc497b603e7f04 (diff)
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
-rw-r--r--src/modules/account.h27
-rw-r--r--src/modules/m_sasl.cpp6
-rw-r--r--src/modules/m_services_account.cpp10
3 files changed, 43 insertions, 0 deletions
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 <map>
+#include <string>
+
+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);
}
}
}