summaryrefslogtreecommitdiff
path: root/src/uplink.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2014-06-23 09:45:15 -0400
committerAdam <Adam@anope.org>2014-06-23 09:45:15 -0400
commitfd9bb0ea7e3c8a39f1632c2ebbdc25d0fac192a0 (patch)
tree1d68e86065e0b012aee41533d4f9b289ee0707ac /src/uplink.cpp
parent148b26f687ce85dc01e852a2358b03d493757ada (diff)
parent9a947fa4359c667be58ebae4634d9ac0e53d5db4 (diff)
Merge branch '2.0' into 2.1
Conflicts: cmake/Anope.cmake cmake/FindGettext.cmake include/access.h include/messages.h include/modes.h include/modules.h include/users.h modules/CMakeLists.txt modules/commands/bs_bot.cpp modules/commands/cs_access.cpp modules/commands/cs_ban.cpp modules/commands/cs_clone.cpp modules/commands/cs_flags.cpp modules/commands/cs_info.cpp modules/commands/cs_list.cpp modules/commands/cs_log.cpp modules/commands/cs_mode.cpp modules/commands/cs_status.cpp modules/commands/cs_suspend.cpp modules/commands/cs_updown.cpp modules/commands/cs_xop.cpp modules/commands/ms_check.cpp modules/commands/ns_access.cpp modules/commands/ns_cert.cpp modules/commands/ns_group.cpp modules/commands/ns_register.cpp modules/commands/ns_set.cpp modules/commands/ns_suspend.cpp modules/commands/os_session.cpp modules/commands/os_svs.cpp modules/extra/m_ldap_authentication.cpp modules/extra/m_regex_pcre.cpp modules/extra/m_sql_authentication.cpp modules/extra/stats/m_chanstats.cpp modules/protocol/bahamut.cpp modules/protocol/hybrid.cpp modules/protocol/inspircd12.cpp modules/protocol/inspircd20.cpp modules/protocol/unreal.cpp modules/pseudoclients/chanserv.cpp modules/pseudoclients/chanserv/channel.cpp modules/pseudoclients/nickserv/nickserv.cpp modules/webcpanel/pages/chanserv/access.cpp src/access.cpp src/bots.cpp src/channels.cpp src/language.cpp src/modes.cpp src/modulemanager.cpp src/process.cpp src/users.cpp src/version.sh
Diffstat (limited to 'src/uplink.cpp')
-rw-r--r--src/uplink.cpp31
1 files changed, 18 insertions, 13 deletions
diff --git a/src/uplink.cpp b/src/uplink.cpp
index 2f7a03ebd..9337692bb 100644
--- a/src/uplink.cpp
+++ b/src/uplink.cpp
@@ -62,11 +62,22 @@ void Uplink::Connect()
UplinkSocket::UplinkSocket() : Socket(-1, Config->Uplinks[Anope::CurrentUplink].ipv6), ConnectionSocket(), BufferedSocket()
{
+ error = false;
UplinkSock = this;
}
UplinkSocket::~UplinkSocket()
{
+ if (!error)
+ {
+ this->OnError("");
+ Module *protocol = ModuleManager::FindFirstOf(PROTOCOL);
+ if (protocol && !protocol->name.find("inspircd"))
+ Log(LOG_TERMINAL) << "Check that you have loaded m_spanningtree.so on InspIRCd, and are not connecting Anope to an SSL enabled port without configuring SSL in Anope (or vice versa)";
+ else
+ Log(LOG_TERMINAL) << "Check that you are not connecting Anope to an SSL enabled port without configuring SSL in Anope (or vice versa)";
+ }
+
if (IRCD && Servers::GetUplink() && Servers::GetUplink()->IsSynced())
{
Event::OnServerDisconnect(&Event::ServerDisconnect::OnServerDisconnect);
@@ -79,7 +90,7 @@ UplinkSocket::~UplinkSocket()
{
/* Don't use quitmsg here, it may contain information you don't want people to see */
IRCD->SendQuit(u, "Shutting down");
- BotInfo* bi = BotInfo::Find(u->nick);
+ BotInfo* bi = BotInfo::Find(u->GetUID());
if (bi != NULL)
bi->introduced = false;
}
@@ -138,10 +149,11 @@ void UplinkSocket::OnConnect()
Event::OnServerConnect(&Event::ServerConnect::OnServerConnect);
}
-void UplinkSocket::OnError(const Anope::string &error)
+void UplinkSocket::OnError(const Anope::string &err)
{
Anope::string what = !this->flags[SF_CONNECTED] ? "Unable to connect to" : "Lost connection from";
- Log(LOG_TERMINAL) << what << " uplink #" << (Anope::CurrentUplink + 1) << " (" << Config->Uplinks[Anope::CurrentUplink].host << ":" << Config->Uplinks[Anope::CurrentUplink].port << ")" << (!error.empty() ? (": " + error) : "");
+ Log(LOG_TERMINAL) << what << " uplink #" << (Anope::CurrentUplink + 1) << " (" << Config->Uplinks[Anope::CurrentUplink].host << ":" << Config->Uplinks[Anope::CurrentUplink].port << ")" << (!err.empty() ? (": " + err) : "");
+ error |= !err.empty();
}
UplinkSocket::Message::Message() : source(Me)
@@ -197,14 +209,7 @@ UplinkSocket::Message::~Message()
return;
}
- if (!message_source.empty())
- {
- UplinkSock->Write(":" + message_source + " " + this->buffer.str());
- Log(LOG_RAWIO) << "Sent: :" << message_source << " " << this->buffer.str();
- }
- else
- {
- UplinkSock->Write(this->buffer.str());
- Log(LOG_RAWIO) << "Sent: " << this->buffer.str();
- }
+ Anope::string sent = IRCD->Format(message_source, this->buffer.str());
+ UplinkSock->Write(sent);
+ Log(LOG_RAWIO) << "Sent: " << sent;
}