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 * ---------------------------------------------------
20 #include "helperfuncs.h"
22 /* $ModDesc: Makes remote /whoises to SSL servers work on a non-ssl server */
24 class ModuleSSLDummy : public Module
29 ModuleSSLDummy(Server* Me) : Module::Module(Me)
34 virtual ~ModuleSSLDummy()
38 virtual Version GetVersion()
40 return Version(1, 0, 0, 0, VF_VENDOR);
43 void Implements(char* List)
45 List[I_OnSyncUserMetaData] = List[I_OnDecodeMetaData] = List[I_OnWhois] = 1;
48 // :kenny.chatspike.net 320 Om Epy|AFK :is a Secure Connection
49 virtual void OnWhois(userrec* source, userrec* dest)
51 if(dest->GetExt("ssl"))
53 WriteServ(source->fd, "320 %s %s :is using a secure connection", source->nick, dest->nick);
57 virtual void OnSyncUserMetaData(userrec* user, Module* proto, void* opaque, std::string extname)
59 // check if the linking module wants to know about OUR metadata
62 // check if this user has an ssl field to send
63 if(user->GetExt(extname))
65 // call this function in the linking module, let it format the data how it
66 // sees fit, and send it on its way. We dont need or want to know how.
67 proto->ProtoSendMetaData(opaque, TYPE_USER, user, extname, "ON");
72 virtual void OnDecodeMetaData(int target_type, void* target, std::string extname, std::string extdata)
74 // check if its our metadata key, and its associated with a user
75 if ((target_type == TYPE_USER) && (extname == "ssl"))
77 userrec* dest = (userrec*)target;
78 // if they dont already have an ssl flag, accept the remote server's
79 if (!dest->GetExt(extname))
81 dest->Extend(extname, "ON");
87 class ModuleSSLDummyFactory : public ModuleFactory
90 ModuleSSLDummyFactory()
94 ~ModuleSSLDummyFactory()
98 virtual Module * CreateModule(Server* Me)
100 return new ModuleSSLDummy(Me);
105 extern "C" void * init_module( void )
107 return new ModuleSSLDummyFactory;