summaryrefslogtreecommitdiff
path: root/src/uplink.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2016-09-23 15:46:03 -0400
committerAdam <Adam@anope.org>2016-09-23 15:46:03 -0400
commit2916943316c0d3c53d347fb43abe98a374c75e36 (patch)
tree45611b5583dca607e9a513b6b2f7d88975c56231 /src/uplink.cpp
parenta6b14a9fb6afc5e16874ed7e4c0a135a4f5bfa53 (diff)
Remove rfc1459 message framing everywhere
Diffstat (limited to 'src/uplink.cpp')
-rw-r--r--src/uplink.cpp43
1 files changed, 14 insertions, 29 deletions
diff --git a/src/uplink.cpp b/src/uplink.cpp
index ac262543f..c2b7579c5 100644
--- a/src/uplink.cpp
+++ b/src/uplink.cpp
@@ -166,60 +166,45 @@ void UplinkSocket::OnError(const Anope::string &err)
error |= !err.empty();
}
-UplinkSocket::Message::Message() : source(Me)
+void Uplink::SendMessage(IRCMessage &message)
{
-}
+ const MessageSource &source = message.GetSource();
+ Anope::string buffer = IRCD->Format(message);
-UplinkSocket::Message::Message(const MessageSource &src) : source(src)
-{
-}
-
-UplinkSocket::Message::~Message()
-{
- Anope::string message_source;
-
- if (this->source.GetServer() != NULL)
+ if (source.GetServer() != NULL)
{
- const Server *s = this->source.GetServer();
+ const Server *s = source.GetServer();
if (s != Me && !s->IsJuped())
{
- Log(LOG_DEBUG) << "Attempted to send \"" << this->buffer.str() << "\" from " << s->GetName() << " who is not from me?";
+ Log(LOG_DEBUG) << "Attempted to send \"" << buffer << "\" from " << s->GetName() << " who is not from me?";
return;
}
-
- message_source = s->GetSID();
}
- else if (this->source.GetUser() != NULL)
+ else if (source.GetUser() != NULL)
{
- const User *u = this->source.GetUser();
+ const User *u = source.GetUser();
if (u->server != Me && !u->server->IsJuped())
{
- Log(LOG_DEBUG) << "Attempted to send \"" << this->buffer.str() << "\" from " << u->nick << " who is not from me?";
+ Log(LOG_DEBUG) << "Attempted to send \"" << buffer << "\" from " << u->nick << " who is not from me?";
return;
}
- const ServiceBot *bi = this->source.GetBot();
+ const ServiceBot *bi = source.GetBot();
if (bi != NULL && bi->introduced == false)
{
- Log(LOG_DEBUG) << "Attempted to send \"" << this->buffer.str() << "\" from " << bi->nick << " when not introduced";
+ Log(LOG_DEBUG) << "Attempted to send \"" << buffer << "\" from " << bi->nick << " when not introduced";
return;
}
-
- message_source = u->GetUID();
}
if (!UplinkSock)
{
- if (!message_source.empty())
- Log(LOG_DEBUG) << "Attempted to send \"" << message_source << " " << this->buffer.str() << "\" with UplinkSock NULL";
- else
- Log(LOG_DEBUG) << "Attempted to send \"" << this->buffer.str() << "\" with UplinkSock NULL";
+ Log(LOG_DEBUG) << "Attempted to send \"" << buffer << "\" with UplinkSock NULL";
return;
}
- Anope::string sent = IRCD->Format(message_source, this->buffer.str());
- UplinkSock->Write(sent);
- Log(LOG_RAWIO) << "Sent: " << sent;
+ UplinkSock->Write(buffer);
+ Log(LOG_RAWIO) << "Sent: " << buffer;
}