diff options
-rw-r--r-- | src/modules/m_operjoin.cpp | 58 | ||||
-rw-r--r-- | src/modules/m_opermd5.cpp | 13 |
2 files changed, 34 insertions, 37 deletions
diff --git a/src/modules/m_operjoin.cpp b/src/modules/m_operjoin.cpp index 3609350a2..d1d9ef3b0 100644 --- a/src/modules/m_operjoin.cpp +++ b/src/modules/m_operjoin.cpp @@ -11,43 +11,36 @@ using namespace std; Server *Srv; -class ModuleOperjoin : public Module { - +class ModuleOperjoin : public Module +{ private: - std::string operChan; ConfigReader* conf; public: - - ModuleOperjoin() { - + ModuleOperjoin() + { Srv = new Server; conf = new ConfigReader; - operChan = conf->ReadValue("operjoin", "channel", 0); - } - virtual ~ModuleOperjoin() { - + virtual ~ModuleOperjoin() + { delete Srv; delete conf; - } - virtual Version GetVersion() { - + virtual Version GetVersion() + { return Version(1,0,0,1,VF_VENDOR); - } - virtual void OnOper(userrec* user, std::string opertype) { - - if(operChan != "") { - + virtual void OnOper(userrec* user, std::string opertype) + { + if(operChan != "") + { Srv->JoinUserToChannel(user,operChan,""); - } } @@ -56,20 +49,19 @@ class ModuleOperjoin : public Module { class ModuleOperjoinFactory : public ModuleFactory { - public: - ModuleOperjoinFactory() - { - } - - ~ModuleOperjoinFactory() - { - } - - virtual Module * CreateModule() - { - return new ModuleOperjoin; - } - + public: + ModuleOperjoinFactory() + { + } + + ~ModuleOperjoinFactory() + { + } + + virtual Module * CreateModule() + { + return new ModuleOperjoin; + } }; extern "C" void * init_module( void ) diff --git a/src/modules/m_opermd5.cpp b/src/modules/m_opermd5.cpp index c2b923929..4a4fff756 100644 --- a/src/modules/m_opermd5.cpp +++ b/src/modules/m_opermd5.cpp @@ -57,13 +57,15 @@ void byteSwap(word32 *buf, unsigned words) { byte *p = (byte *)buf; - do { + do + { *buf++ = (word32)((unsigned)p[3] << 8 | p[2]) << 16 | ((unsigned)p[1] << 8 | p[0]); p += 4; } while (--words); } +/* XXX - maybe if we had an md5/encryption moduletype? *shrug* */ void MD5Init(struct MD5Context *ctx) { ctx->buf[0] = 0x67452301; @@ -86,7 +88,8 @@ void MD5Update(struct MD5Context *ctx, byte const *buf, int len) ctx->bytes[1]++; /* Carry from low to high */ t = 64 - (t & 0x3f); /* Space available in ctx->in (at least 1) */ - if ((unsigned)t > (unsigned)len) { + if ((unsigned)t > (unsigned)len) + { memcpy((byte *)ctx->in + 64 - (unsigned)t, buf, len); return; } @@ -98,7 +101,8 @@ void MD5Update(struct MD5Context *ctx, byte const *buf, int len) len -= (unsigned)t; /* Process data in 64-byte chunks */ - while (len >= 64) { + while (len >= 64) + { memcpy(ctx->in, buf, 64); byteSwap(ctx->in, 16); MD5Transform(ctx->buf, ctx->in); @@ -121,7 +125,8 @@ void MD5Final(byte digest[16], struct MD5Context *ctx) /* Bytes of padding needed to make 56 bytes (-8..55) */ count = 56 - 1 - count; - if (count < 0) { /* Padding forces an extra block */ + if (count < 0) + { /* Padding forces an extra block */ memset(p, 0, count+8); byteSwap(ctx->in, 16); MD5Transform(ctx->buf, ctx->in); |