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
30 ModuleSSLDummy(Server* Me) : Module::Module(Me)
35 virtual ~ModuleSSLDummy()
39 virtual Version GetVersion()
41 return Version(1, 0, 0, 0, VF_VENDOR);
44 void Implements(char* List)
46 List[I_OnSyncUserMetaData] = List[I_OnDecodeMetaData] = List[I_OnWhois] = 1;
49 // :kenny.chatspike.net 320 Om Epy|AFK :is a Secure Connection
50 virtual void OnWhois(userrec* source, userrec* dest)
52 if(dest->GetExt("ssl", dummy))
54 WriteServ(source->fd, "320 %s %s :is using a secure connection", source->nick, dest->nick);
58 virtual void OnSyncUserMetaData(userrec* user, Module* proto, void* opaque, const std::string &extname)
60 // check if the linking module wants to know about OUR metadata
63 // check if this user has an ssl field to send
64 if(user->GetExt(extname, dummy))
66 // call this function in the linking module, let it format the data how it
67 // sees fit, and send it on its way. We dont need or want to know how.
68 proto->ProtoSendMetaData(opaque, TYPE_USER, user, extname, "ON");
73 virtual void OnDecodeMetaData(int target_type, void* target, const std::string &extname, const std::string &extdata)
75 // check if its our metadata key, and its associated with a user
76 if ((target_type == TYPE_USER) && (extname == "ssl"))
78 userrec* dest = (userrec*)target;
79 // if they dont already have an ssl flag, accept the remote server's
80 if (!dest->GetExt(extname, dummy))
82 dest->Extend(extname, "ON");
88 class ModuleSSLDummyFactory : public ModuleFactory
91 ModuleSSLDummyFactory()
95 ~ModuleSSLDummyFactory()
99 virtual Module * CreateModule(Server* Me)
101 return new ModuleSSLDummy(Me);
106 extern "C" void * init_module( void )
108 return new ModuleSSLDummyFactory;