summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/commands/cs_seen.cpp1
-rw-r--r--modules/commands/ms_cancel.cpp56
-rw-r--r--modules/commands/ms_rsend.cpp2
-rw-r--r--modules/commands/ms_send.cpp2
-rw-r--r--modules/commands/ms_sendall.cpp2
-rw-r--r--modules/extra/m_sqlite.cpp11
-rw-r--r--modules/extra/m_ssl_openssl.cpp2
-rw-r--r--modules/protocol/charybdis.cpp32
-rw-r--r--modules/protocol/ratbox.cpp33
9 files changed, 86 insertions, 55 deletions
diff --git a/modules/commands/cs_seen.cpp b/modules/commands/cs_seen.cpp
index 80bc8e548..0eb5ae5cb 100644
--- a/modules/commands/cs_seen.cpp
+++ b/modules/commands/cs_seen.cpp
@@ -260,6 +260,7 @@ class CommandSeen : public Command
{
this->SetDesc(_("Tells you about the last time a user was seen"));
this->SetSyntax(_("\037nick\037"));
+ this->AllowUnregistered(true);
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
diff --git a/modules/commands/ms_cancel.cpp b/modules/commands/ms_cancel.cpp
index 9e6f0ce63..07b7f3050 100644
--- a/modules/commands/ms_cancel.cpp
+++ b/modules/commands/ms_cancel.cpp
@@ -34,27 +34,47 @@ class CommandMSCancel : public Command
MemoInfo *mi = MemoInfo::GetMemoInfo(nname, ischan);
if (mi == NULL)
- source.Reply(ischan ? CHAN_X_NOT_REGISTERED : _(NICK_X_NOT_REGISTERED), nname.c_str());
+ {
+ source.Reply(ischan ? CHAN_X_NOT_REGISTERED : NICK_X_NOT_REGISTERED, nname.c_str());
+ return;
+ }
+
+ ChannelInfo *ci = NULL;
+ NickAlias *na = NULL;
+ if (ischan)
+ {
+ ci = ChannelInfo::Find(nname);
+
+ if (ci == NULL)
+ return; // can't happen
+ }
else
{
- ChannelInfo *ci = NULL;
- NickAlias *na = NULL;
- if (ischan)
- ci = ChannelInfo::Find(nname);
- else
- na = NickAlias::Find(nname);
- for (int i = mi->memos->size() - 1; i >= 0; --i)
- if (mi->GetMemo(i)->unread && source.nc->display.equals_ci(mi->GetMemo(i)->sender))
- {
- FOREACH_MOD(OnMemoDel, (ischan ? ci->name : na->nc->display, mi, mi->GetMemo(i)));
- mi->Del(i);
- source.Reply(_("Last memo to \002%s\002 has been cancelled."), nname.c_str());
- return;
- }
-
- source.Reply(_("No memo was cancelable."));
+ na = NickAlias::Find(nname);
+
+ if (na == NULL)
+ return; // can't happen
}
- return;
+
+ for (int i = mi->memos->size() - 1; i >= 0; --i)
+ {
+ Memo *m = mi->GetMemo(i);
+
+ if (!m->unread)
+ continue;
+
+ NickAlias *sender = NickAlias::Find(m->sender);
+
+ if (sender && sender->nc == source.GetAccount())
+ {
+ FOREACH_MOD(OnMemoDel, (ischan ? ci->name : na->nc->display, mi, m));
+ mi->Del(i);
+ source.Reply(_("Last memo to \002%s\002 has been cancelled."), (ischan ? ci->name : na->nc->display).c_str());
+ return;
+ }
+ }
+
+ source.Reply(_("No memo was cancelable."));
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override
diff --git a/modules/commands/ms_rsend.cpp b/modules/commands/ms_rsend.cpp
index b7744131a..e703ba067 100644
--- a/modules/commands/ms_rsend.cpp
+++ b/modules/commands/ms_rsend.cpp
@@ -51,7 +51,7 @@ class CommandMSRSend : public Command
source.Reply(ACCESS_DENIED);
else
{
- MemoServService::MemoResult result = memoserv->Send(source.GetNick(), nick, text);
+ MemoServService::MemoResult result = memoserv->Send(source.GetAccount()->display, nick, text);
if (result == MemoServService::MEMO_INVALID_TARGET)
source.Reply(_("\002%s\002 is not a registered unforbidden nick or channel."), nick.c_str());
else if (result == MemoServService::MEMO_TOO_FAST)
diff --git a/modules/commands/ms_send.cpp b/modules/commands/ms_send.cpp
index b028706d3..73ffd4c41 100644
--- a/modules/commands/ms_send.cpp
+++ b/modules/commands/ms_send.cpp
@@ -45,7 +45,7 @@ class CommandMSSend : public Command
return;
}
- MemoServService::MemoResult result = memoserv->Send(source.GetNick(), nick, text);
+ MemoServService::MemoResult result = memoserv->Send(source.GetAccount()->display, nick, text);
if (result == MemoServService::MEMO_SUCCESS)
{
source.Reply(_("Memo sent to \002%s\002."), nick.c_str());
diff --git a/modules/commands/ms_sendall.cpp b/modules/commands/ms_sendall.cpp
index 4cc0f350c..8f0514d6f 100644
--- a/modules/commands/ms_sendall.cpp
+++ b/modules/commands/ms_sendall.cpp
@@ -39,7 +39,7 @@ class CommandMSSendAll : public Command
const NickCore *nc = it->second;
if (nc != source.nc)
- memoserv->Send(source.GetNick(), nc->display, text);
+ memoserv->Send(source.GetAccount()->display, nc->display, text);
}
source.Reply(_("A massmemo has been sent to all registered users."));
diff --git a/modules/extra/m_sqlite.cpp b/modules/extra/m_sqlite.cpp
index d8b76011a..0699ee3eb 100644
--- a/modules/extra/m_sqlite.cpp
+++ b/modules/extra/m_sqlite.cpp
@@ -138,7 +138,16 @@ SQLiteService::SQLiteService(Module *o, const Anope::string &n, const Anope::str
{
int db = sqlite3_open_v2(database.c_str(), &this->sql, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, 0);
if (db != SQLITE_OK)
- throw SQL::Exception("Unable to open SQLite database " + database + ": " + sqlite3_errmsg(this->sql));
+ {
+ Anope::string exstr = "Unable to open SQLite database " + database;
+ if (this->sql)
+ {
+ exstr += ": ";
+ exstr += sqlite3_errmsg(this->sql);
+ sqlite3_close(this->sql);
+ }
+ throw SQL::Exception(exstr);
+ }
}
SQLiteService::~SQLiteService()
diff --git a/modules/extra/m_ssl_openssl.cpp b/modules/extra/m_ssl_openssl.cpp
index 00df168de..bdc3a5624 100644
--- a/modules/extra/m_ssl_openssl.cpp
+++ b/modules/extra/m_ssl_openssl.cpp
@@ -147,7 +147,7 @@ class SSLModule : public Module
if (Anope::IsFile(this->certfile.c_str()))
{
- if (!SSL_CTX_use_certificate_file(client_ctx, this->certfile.c_str(), SSL_FILETYPE_PEM) || !SSL_CTX_use_certificate_file(server_ctx, this->certfile.c_str(), SSL_FILETYPE_PEM))
+ if (!SSL_CTX_use_certificate_chain_file(client_ctx, this->certfile.c_str()) || !SSL_CTX_use_certificate_chain_file(server_ctx, this->certfile.c_str()))
throw ConfigException("Error loading certificate");
else
Log(LOG_DEBUG) << "m_ssl_openssl: Successfully loaded certificate " << this->certfile;
diff --git a/modules/protocol/charybdis.cpp b/modules/protocol/charybdis.cpp
index 68bbe12b8..acfc93044 100644
--- a/modules/protocol/charybdis.cpp
+++ b/modules/protocol/charybdis.cpp
@@ -31,20 +31,6 @@ class ChannelModeLargeBan : public ChannelMode
class CharybdisProto : public IRCDProto
{
- BotInfo *FindIntroduced()
- {
- BotInfo *bi = Config->GetClient("OperServ");
-
- if (bi && bi->introduced)
- return bi;
-
- for (botinfo_map::iterator it = BotListByNick->begin(), it_end = BotListByNick->end(); it != it_end; ++it)
- if (it->second->introduced)
- return it->second;
-
- return NULL;
- }
-
public:
CharybdisProto(Module *creator) : IRCDProto(creator, "Charybdis 3.4+")
@@ -70,6 +56,8 @@ class CharybdisProto : public IRCDProto
void SendSGLineDel(const XLine *x) anope_override { ratbox->SendSGLineDel(x); }
void SendAkill(User *u, XLine *x) anope_override { ratbox->SendAkill(u, x); }
void SendAkillDel(const XLine *x) anope_override { ratbox->SendAkillDel(x); }
+ void SendSQLine(User *u, const XLine *x) anope_override { ratbox->SendSQLine(u, x); }
+ void SendSQLineDel(const XLine *x) anope_override { ratbox->SendSQLineDel(x); }
void SendJoin(User *user, Channel *c, const ChannelStatus *status) anope_override { ratbox->SendJoin(user, c, status); }
void SendServer(const Server *server) anope_override { ratbox->SendServer(server); }
void SendChannel(Channel *c) anope_override { ratbox->SendChannel(c); }
@@ -90,22 +78,6 @@ class CharybdisProto : public IRCDProto
UplinkSocket::Message(Me) << "ENCAP * MECHLIST :" << (mechanisms.empty() ? "" : mechlist.substr(1));
}
- void SendSQLine(User *, const XLine *x) anope_override
- {
- /* Calculate the time left before this would expire, capping it at 2 days */
- time_t timeleft = x->expires - Anope::CurTime;
-
- if (timeleft > 172800 || !x->expires)
- timeleft = 172800;
-
- UplinkSocket::Message(FindIntroduced()) << "ENCAP * RESV " << timeleft << " " << x->mask << " 0 :" << x->GetReason();
- }
-
- void SendSQLineDel(const XLine *x) anope_override
- {
- UplinkSocket::Message(Config->GetClient("OperServ")) << "ENCAP * UNRESV " << x->mask;
- }
-
void SendConnect() anope_override
{
UplinkSocket::Message() << "PASS " << Config->Uplinks[Anope::CurrentUplink].password << " TS 6 :" << Me->GetSID();
diff --git a/modules/protocol/ratbox.cpp b/modules/protocol/ratbox.cpp
index d89bff602..82aaa6b2d 100644
--- a/modules/protocol/ratbox.cpp
+++ b/modules/protocol/ratbox.cpp
@@ -17,12 +17,27 @@ static ServiceReference<IRCDProto> hybrid("IRCDProto", "hybrid");
class RatboxProto : public IRCDProto
{
+ BotInfo *FindIntroduced()
+ {
+ BotInfo *bi = Config->GetClient("OperServ");
+
+ if (bi && bi->introduced)
+ return bi;
+
+ for (botinfo_map::iterator it = BotListByNick->begin(), it_end = BotListByNick->end(); it != it_end; ++it)
+ if (it->second->introduced)
+ return it->second;
+
+ return NULL;
+ }
+
public:
RatboxProto(Module *creator) : IRCDProto(creator, "Ratbox 3.0+")
{
DefaultPseudoclientModes = "+oiS";
CanSNLine = true;
CanSQLine = true;
+ CanSQLineChannel = true;
CanSZLine = true;
RequiresID = true;
MaxModes = 4;
@@ -31,12 +46,10 @@ class RatboxProto : public IRCDProto
void SendSVSKillInternal(const MessageSource &source, User *targ, const Anope::string &reason) anope_override { hybrid->SendSVSKillInternal(source, targ, reason); }
void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override { hybrid->SendGlobalNotice(bi, dest, msg); }
void SendGlobalPrivmsg(BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override { hybrid->SendGlobalPrivmsg(bi, dest, msg); }
- void SendSQLine(User *u, const XLine *x) anope_override { hybrid->SendSQLine(u, x); }
void SendSGLine(User *u, const XLine *x) anope_override { hybrid->SendSGLine(u, x); }
void SendSGLineDel(const XLine *x) anope_override { hybrid->SendSGLineDel(x); }
void SendAkill(User *u, XLine *x) anope_override { hybrid->SendAkill(u, x); }
void SendAkillDel(const XLine *x) anope_override { hybrid->SendAkillDel(x); }
- void SendSQLineDel(const XLine *x) anope_override { hybrid->SendSQLineDel(x); }
void SendJoin(User *user, Channel *c, const ChannelStatus *status) anope_override { hybrid->SendJoin(user, c, status); }
void SendServer(const Server *server) anope_override { hybrid->SendServer(server); }
void SendModeInternal(const MessageSource &source, User *u, const Anope::string &buf) anope_override { hybrid->SendModeInternal(source, u, buf); }
@@ -48,6 +61,22 @@ class RatboxProto : public IRCDProto
UplinkSocket::Message(source) << "OPERWALL :" << buf;
}
+ void SendSQLine(User *, const XLine *x) anope_override
+ {
+ /* Calculate the time left before this would expire, capping it at 2 days */
+ time_t timeleft = x->expires - Anope::CurTime;
+
+ if (timeleft > 172800 || !x->expires)
+ timeleft = 172800;
+
+ UplinkSocket::Message(FindIntroduced()) << "ENCAP * RESV " << timeleft << " " << x->mask << " 0 :" << x->GetReason();
+ }
+
+ void SendSQLineDel(const XLine *x) anope_override
+ {
+ UplinkSocket::Message(Config->GetClient("OperServ")) << "ENCAP * UNRESV " << x->mask;
+ }
+
void SendConnect() anope_override
{
UplinkSocket::Message() << "PASS " << Config->Uplinks[Anope::CurrentUplink].password << " TS 6 :" << Me->GetSID();