summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/modules/extra/m_ssl_openssl.cpp20
-rw-r--r--src/modules/m_cban.cpp21
2 files changed, 32 insertions, 9 deletions
diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp
index 28123eb56..9b0e52a7b 100644
--- a/src/modules/extra/m_ssl_openssl.cpp
+++ b/src/modules/extra/m_ssl_openssl.cpp
@@ -254,7 +254,7 @@ class ModuleSSLOpenSSL : public Module
void Implements(char* List)
{
List[I_OnRawSocketAccept] = List[I_OnRawSocketClose] = List[I_OnRawSocketRead] = List[I_OnRawSocketWrite] = List[I_OnCleanup] = 1;
- List[I_OnSyncUserMetaData] = List[I_OnDecodeMetaData] = List[I_OnUnloadModule] = List[I_OnRehash] = List[I_OnWhois] = 1;
+ List[I_OnSyncUserMetaData] = List[I_OnDecodeMetaData] = List[I_OnUnloadModule] = List[I_OnRehash] = List[I_OnWhois] = List[I_OnGlobalConnect] = 1;
}
virtual void OnRawSocketAccept(int fd, std::string ip, int localport)
@@ -608,6 +608,24 @@ class ModuleSSLOpenSSL : public Module
}
}
+ virtual void OnGlobalConnect(userrec* user)
+ {
+ // This occurs AFTER OnUserConnect so we can be sure the
+ // protocol module has propogated the NICK message.
+ if ((user->GetExt("ssl")) && (IS_LOCAL(user)))
+ {
+ // Tell whatever protocol module we're using that we need to inform other servers of this metadata NOW.
+ std::deque<std::string>* metadata = new std::deque<std::string>;
+ metadata->push_back(user->nick);
+ metadata->push_back("ssl"); // The metadata id
+ metadata->push_back("ON"); // The value to send
+ Event* event = new Event((char*)metadata,(Module*)this,"send_metadata");
+ event->Send(); // Trigger the event. We don't care what module picks it up.
+ delete event;
+ delete metadata;
+ }
+ }
+
void MakePollWrite(issl_session* session)
{
OnRawSocketWrite(session->fd, NULL, 0);
diff --git a/src/modules/m_cban.cpp b/src/modules/m_cban.cpp
index ae0961f29..8ddfcc159 100644
--- a/src/modules/m_cban.cpp
+++ b/src/modules/m_cban.cpp
@@ -98,19 +98,21 @@ class cmd_cban : public command_t
// parameters[1] = 1h3m2s
// parameters[2] = Tortoise abuser
long length = Srv->CalcDuration(parameters[1]);
+ std::string reason = (pcnt > 2) ? parameters[2] : "No reason supplied";
- cbans.push_back(CBan(parameters[0], user->nick, TIME, length, parameters[2]));
+ cbans.push_back(CBan(parameters[0], user->nick, TIME, length, reason));
+
std::sort(cbans.begin(), cbans.end(), CBanComp);
if(length > 0)
{
- WriteServ(user->fd, "385 %s %s :Added %lu second channel ban (%s)", user->nick, parameters[0], length, parameters[2]);
- WriteOpers("*** %s added %lu second channel ban on %s (%s)", user->nick, length, parameters[0], parameters[2]);
+ WriteServ(user->fd, "385 %s %s :Added %lu second channel ban (%s)", user->nick, parameters[0], length, reason.c_str());
+ WriteOpers("*** %s added %lu second channel ban on %s (%s)", user->nick, length, parameters[0], reason.c_str());
}
else
{
- WriteServ(user->fd, "385 %s %s :Added permenant channel ban (%s)", user->nick, parameters[0], parameters[2]);
- WriteOpers("*** %s added permenant channel ban on %s (%s)", user->nick, parameters[0], parameters[2]);
+ WriteServ(user->fd, "385 %s %s :Added permenant channel ban (%s)", user->nick, parameters[0], reason.c_str());
+ WriteOpers("*** %s added permenant channel ban on %s (%s)", user->nick, parameters[0], reason.c_str());
}
}
else
@@ -143,10 +145,13 @@ class ModuleCBan : public Module
{
ExpireBans();
- for(cbanlist::iterator iter = cbans.begin(); iter != cbans.end(); iter++)
+ if(symbol == 'C')
{
- unsigned long remaining = (iter->set_on + iter->length) - TIME;
- WriteServ(user->fd, "210 %s %s %s %lu %lu %lu :%s", user->nick, iter->chname.c_str(), iter->set_by.c_str(), iter->set_on, iter->length, remaining, iter->reason.c_str());
+ for(cbanlist::iterator iter = cbans.begin(); iter != cbans.end(); iter++)
+ {
+ unsigned long remaining = (iter->set_on + iter->length) - TIME;
+ WriteServ(user->fd, "210 %s %s %s %lu %lu %lu :%s", user->nick, iter->chname.c_str(), iter->set_by.c_str(), iter->set_on, iter->length, remaining, iter->reason.c_str());
+ }
}
return 0;