diff options
Diffstat (limited to 'modules/extra')
| -rw-r--r-- | modules/extra/m_chanstats.cpp | 4 | ||||
| -rw-r--r-- | modules/extra/m_ldap_authentication.cpp | 5 | ||||
| -rw-r--r-- | modules/extra/m_statusupdate.cpp | 4 | ||||
| -rw-r--r-- | modules/extra/m_xmlrpc_main.cpp | 80 | ||||
| -rw-r--r-- | modules/extra/ns_maxemail.cpp | 6 |
5 files changed, 34 insertions, 65 deletions
diff --git a/modules/extra/m_chanstats.cpp b/modules/extra/m_chanstats.cpp index 5cde232d0..ed9a5f444 100644 --- a/modules/extra/m_chanstats.cpp +++ b/modules/extra/m_chanstats.cpp @@ -444,10 +444,10 @@ class MChanstats : public Module query.setValue("smileys_other", smileys_other); this->RunQuery(query); } - void OnDelCore(User *u) anope_override + void OnDelCore(NickCore *nc) anope_override { query = "DELETE FROM `" + prefix + "chanstats` WHERE `nick` = @nick@;"; - query.setValue("nick", GetDisplay(u)); + query.setValue("nick", nc->display); this->RunQuery(query); } void OnChangeCoreDisplay(NickCore *nc, const Anope::string &newdisplay) anope_override diff --git a/modules/extra/m_ldap_authentication.cpp b/modules/extra/m_ldap_authentication.cpp index e1a214561..97583ece3 100644 --- a/modules/extra/m_ldap_authentication.cpp +++ b/modules/extra/m_ldap_authentication.cpp @@ -264,7 +264,10 @@ class NSIdentifyLDAP : public Module if (c == NULL || source == NULL || !this->ldap) return EVENT_CONTINUE; - User *u = source->u; + User *u = source->GetUser(); + if (!u) + return EVENT_CONTINUE; + if (u->HasExt("m_ldap_authentication_authenticated")) { u->Shrink("m_ldap_authentication_authenticated"); diff --git a/modules/extra/m_statusupdate.cpp b/modules/extra/m_statusupdate.cpp index 3caf09f64..3c6e60246 100644 --- a/modules/extra/m_statusupdate.cpp +++ b/modules/extra/m_statusupdate.cpp @@ -31,7 +31,7 @@ class StatusUpdate : public Module ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation)); } - void OnAccessAdd(ChannelInfo *ci, User *u, ChanAccess *access) anope_override + void OnAccessAdd(ChannelInfo *ci, CommandSource &, ChanAccess *access) anope_override { if (ci->c) for (CUserList::iterator it = ci->c->users.begin(), it_end = ci->c->users.end(); it != it_end; ++it) @@ -48,7 +48,7 @@ class StatusUpdate : public Module } } - void OnAccessDel(ChannelInfo *ci, User *u, ChanAccess *access) anope_override + void OnAccessDel(ChannelInfo *ci, CommandSource &, ChanAccess *access) anope_override { if (ci->c) for (CUserList::iterator it = ci->c->users.begin(), it_end = ci->c->users.end(); it != it_end; ++it) diff --git a/modules/extra/m_xmlrpc_main.cpp b/modules/extra/m_xmlrpc_main.cpp index 544935f7f..da2d09f22 100644 --- a/modules/extra/m_xmlrpc_main.cpp +++ b/modules/extra/m_xmlrpc_main.cpp @@ -1,45 +1,6 @@ #include "module.h" #include "xmlrpc.h" -// XXX We no longer need this, we need to modify CommandSource to allow commands to go back here -class XMLRPCUser : public User -{ - Anope::string out; - NickAlias *na; - - public: - XMLRPCUser(const Anope::string &nnick) : User(nnick, Config->NSEnforcerUser, Config->NSEnforcerHost, ""), na(findnick(nick)) - { - this->realname = "XMLRPC User"; - this->server = Me; - } - - void SendMessage(const BotInfo *, Anope::string msg) anope_override - { - this->out += msg + "\n"; - } - - NickCore *Account() const anope_override - { - return (na ? *na->nc : NULL); - } - - bool IsIdentified(bool CheckNick = false) const anope_override - { - return na; - } - - bool IsRecognized(bool CheckSecure = true) const anope_override - { - return na; - } - - const Anope::string &GetOut() - { - return this->out; - } -}; - class MyXMLRPCEvent : public XMLRPCEvent { public: @@ -60,7 +21,7 @@ class MyXMLRPCEvent : public XMLRPCEvent } private: - void DoCommand(XMLRPCServiceInterface *iface, XMLRPCClientSocket *source, XMLRPCRequest *request) + void DoCommand(XMLRPCServiceInterface *iface, XMLRPCClientSocket *, XMLRPCRequest *request) { Anope::string service = request->data.size() > 0 ? request->data[0] : ""; Anope::string user = request->data.size() > 1 ? request->data[1] : ""; @@ -77,27 +38,32 @@ class MyXMLRPCEvent : public XMLRPCEvent { request->reply("result", "Success"); - dynamic_reference<User> u = finduser(user); - bool created = false; - if (!u) - { - u = new XMLRPCUser(user); - created = true; - request->reply("online", "no"); - } - else - request->reply("online", "yes"); + NickAlias *na = findnick(user); - bi->OnMessage(u, command); + Anope::string out; - if (created && u) + struct XMLRPCommandReply : CommandReply { - User *useru = u; - XMLRPCUser *myu = anope_dynamic_static_cast<XMLRPCUser *>(useru); - if (!myu->GetOut().empty()) - request->reply("return", iface->Sanitize(myu->GetOut())); - delete u; + Anope::string &str; + + XMLRPCommandReply(Anope::string &s) : str(s) { } + + void SendMessage(const BotInfo *source, const Anope::string &msg) anope_override + { + str += msg + "\n"; + }; } + reply(out); + + CommandSource source(user, NULL, na ? *na->nc : NULL, &reply); + source.c = NULL; + source.owner = bi; + source.service = bi; + + RunCommand(source, command); + + if (!out.empty()) + request->reply("return", iface->Sanitize(out)); } } } diff --git a/modules/extra/ns_maxemail.cpp b/modules/extra/ns_maxemail.cpp index d8d7d3ec6..121da057b 100644 --- a/modules/extra/ns_maxemail.cpp +++ b/modules/extra/ns_maxemail.cpp @@ -24,7 +24,7 @@ class NSMaxEmail : public Module if (this->NSEmailMax < 1 || email.empty()) return false; - if (this->CountEmail(email, source.u) < this->NSEmailMax) + if (this->CountEmail(email, source.nc) < this->NSEmailMax) return false; if (this->NSEmailMax == 1) @@ -35,7 +35,7 @@ class NSMaxEmail : public Module return true; } - int CountEmail(const Anope::string &email, User *u) + int CountEmail(const Anope::string &email, NickCore *unc) { int count = 0; @@ -46,7 +46,7 @@ class NSMaxEmail : public Module { const NickCore *nc = it->second; - if (!(u->Account() && u->Account() == nc) && !nc->email.empty() && nc->email.equals_ci(email)) + if (unc != nc && !nc->email.empty() && nc->email.equals_ci(email)) ++count; } |
