1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
7 * <brain@chatspike.net>
8 * <Craig@chatspike.net>
11 * Written by Craig Edwards, Craig McLure, and others.
12 * This program is free but copyrighted software; see
13 *the file COPYING for details.
15 * ---------------------------------------------------
23 /* $ModDesc: Makes remote /whoises to SSL servers work on a non-ssl server */
25 class ModuleSSLDummy : public Module
31 ModuleSSLDummy(InspIRCd* Me) : Module::Module(Me)
36 virtual ~ModuleSSLDummy()
40 virtual Version GetVersion()
42 return Version(1, 0, 0, 0, VF_VENDOR, API_VERSION);
45 void Implements(char* List)
47 List[I_OnSyncUserMetaData] = List[I_OnDecodeMetaData] = List[I_OnWhois] = 1;
50 // :kenny.chatspike.net 320 Om Epy|AFK :is a Secure Connection
51 virtual void OnWhois(userrec* source, userrec* dest)
53 if(dest->GetExt("ssl", dummy))
55 ServerInstance->SendWhoisLine(source, dest, 320, "%s %s :is using a secure connection", source->nick, dest->nick);
59 virtual void OnSyncUserMetaData(userrec* user, Module* proto, void* opaque, const std::string &extname)
61 // check if the linking module wants to know about OUR metadata
64 // check if this user has an ssl field to send
65 if(user->GetExt(extname, dummy))
67 // call this function in the linking module, let it format the data how it
68 // sees fit, and send it on its way. We dont need or want to know how.
69 proto->ProtoSendMetaData(opaque, TYPE_USER, user, extname, "ON");
74 virtual void OnDecodeMetaData(int target_type, void* target, const std::string &extname, const std::string &extdata)
76 // check if its our metadata key, and its associated with a user
77 if ((target_type == TYPE_USER) && (extname == "ssl"))
79 userrec* dest = (userrec*)target;
80 // if they dont already have an ssl flag, accept the remote server's
81 if (!dest->GetExt(extname, dummy))
83 dest->Extend(extname, "ON");
89 class ModuleSSLDummyFactory : public ModuleFactory
92 ModuleSSLDummyFactory()
96 ~ModuleSSLDummyFactory()
100 virtual Module * CreateModule(InspIRCd* Me)
102 return new ModuleSSLDummy(Me);
107 extern "C" void * init_module( void )
109 return new ModuleSSLDummyFactory;