summaryrefslogtreecommitdiff
path: root/src/uplink.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2013-08-01 13:16:18 +0000
committerAdam <Adam@anope.org>2013-08-01 13:39:35 +0000
commit1e625b6837fdf96616cfc49700aa28d184a7c171 (patch)
tree6b6f06deaf769dd6b1a7853f90d26183828986f1 /src/uplink.cpp
parent402c624e455d13cc811bef2e8d1639846e892a34 (diff)
Use MessageSource as the source for many IRCDProto funcs
Keep track of what user modes are oper only/server only/etc
Diffstat (limited to 'src/uplink.cpp')
-rw-r--r--src/uplink.cpp35
1 files changed, 16 insertions, 19 deletions
diff --git a/src/uplink.cpp b/src/uplink.cpp
index d29af3bea..b5439dda1 100644
--- a/src/uplink.cpp
+++ b/src/uplink.cpp
@@ -58,7 +58,6 @@ void Uplink::Connect()
UplinkSock->Connect(ip, u.port);
}
-
UplinkSocket::UplinkSocket() : Socket(-1, Config->Uplinks[Anope::CurrentUplink].ipv6), ConnectionSocket(), BufferedSocket()
{
UplinkSock = this;
@@ -142,50 +141,48 @@ void UplinkSocket::OnError(const Anope::string &error)
Log(LOG_TERMINAL) << "Unable to connect to uplink #" << (Anope::CurrentUplink + 1) << " (" << Config->Uplinks[Anope::CurrentUplink].host << ":" << Config->Uplinks[Anope::CurrentUplink].port << ")" << (!error.empty() ? (": " + error) : "");
}
-UplinkSocket::Message::Message() : server(NULL), user(NULL)
-{
-}
-
-UplinkSocket::Message::Message(const Server *s) : server(s), user(NULL)
+UplinkSocket::Message::Message() : source(Me)
{
}
-UplinkSocket::Message::Message(const User *u) : server(NULL), user(u)
+UplinkSocket::Message::Message(const MessageSource &src) : source(src)
{
- if (!u)
- server = Me;
}
UplinkSocket::Message::~Message()
{
- Anope::string message_source = "";
+ Anope::string message_source;
- if (this->server != NULL)
+ if (this->source.GetServer() != NULL)
{
- if (this->server != Me && !this->server->IsJuped())
+ const Server *s = this->source.GetServer();
+
+ if (s != Me && !s->IsJuped())
{
- Log(LOG_DEBUG) << "Attempted to send \"" << this->buffer.str() << "\" from " << this->server->GetName() << " who is not from me?";
+ Log(LOG_DEBUG) << "Attempted to send \"" << this->buffer.str() << "\" from " << s->GetName() << " who is not from me?";
return;
}
- message_source = this->server->GetSID();
+ message_source = s->GetSID();
}
- else if (this->user != NULL)
+ else if (this->source.GetUser() != NULL)
{
- if (this->user->server != Me && !this->user->server->IsJuped())
+ const User *u = this->source.GetUser();
+
+ if (u->server != Me && !u->server->IsJuped())
{
- Log(LOG_DEBUG) << "Attempted to send \"" << this->buffer.str() << "\" from " << this->user->nick << " who is not from me?";
+ Log(LOG_DEBUG) << "Attempted to send \"" << this->buffer.str() << "\" from " << u->nick << " who is not from me?";
return;
}
- const BotInfo *bi = BotInfo::Find(this->user->nick);
+ const BotInfo *bi = this->source.GetBot();
if (bi != NULL && bi->introduced == false)
{
Log(LOG_DEBUG) << "Attempted to send \"" << this->buffer.str() << "\" from " << bi->nick << " when not introduced";
return;
}
- message_source = this->user->GetUID();
+ message_source = u->GetUID();
}
if (!UplinkSock)