1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2007 InspIRCd Development Team
6 * See: http://www.inspircd.org/wiki/index.php/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
19 /* $ModDesc: Makes remote /whoises to SSL servers work on a non-ssl server */
21 class ModuleSSLDummy : public Module
27 ModuleSSLDummy(InspIRCd* Me) : Module::Module(Me)
32 virtual ~ModuleSSLDummy()
36 virtual Version GetVersion()
38 return Version(1, 0, 0, 0, VF_VENDOR, API_VERSION);
41 void Implements(char* List)
43 List[I_OnSyncUserMetaData] = List[I_OnDecodeMetaData] = List[I_OnWhois] = 1;
46 // :kenny.chatspike.net 320 Om Epy|AFK :is a Secure Connection
47 virtual void OnWhois(userrec* source, userrec* dest)
49 if(dest->GetExt("ssl", dummy))
51 ServerInstance->SendWhoisLine(source, dest, 320, "%s %s :is using a secure connection", source->nick, dest->nick);
55 virtual void OnSyncUserMetaData(userrec* user, Module* proto, void* opaque, const std::string &extname)
57 // check if the linking module wants to know about OUR metadata
60 // check if this user has an ssl field to send
61 if(user->GetExt(extname, dummy))
63 // call this function in the linking module, let it format the data how it
64 // sees fit, and send it on its way. We dont need or want to know how.
65 proto->ProtoSendMetaData(opaque, TYPE_USER, user, extname, "ON");
70 virtual void OnDecodeMetaData(int target_type, void* target, const std::string &extname, const std::string &extdata)
72 // check if its our metadata key, and its associated with a user
73 if ((target_type == TYPE_USER) && (extname == "ssl"))
75 userrec* dest = (userrec*)target;
76 // if they dont already have an ssl flag, accept the remote server's
77 if (!dest->GetExt(extname, dummy))
79 dest->Extend(extname, "ON");
85 class ModuleSSLDummyFactory : public ModuleFactory
88 ModuleSSLDummyFactory()
92 ~ModuleSSLDummyFactory()
96 virtual Module * CreateModule(InspIRCd* Me)
98 return new ModuleSSLDummy(Me);
103 extern "C" void * init_module( void )
105 return new ModuleSSLDummyFactory;