1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2009 InspIRCd Development Team
6 * See: http://wiki.inspircd.org/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
16 /* $ModDesc: Makes remote /whoises to SSL servers work on a non-ssl server */
18 class ModuleSSLDummy : public Module
24 ModuleSSLDummy(InspIRCd* Me) : Module(Me)
27 Implementation eventlist[] = { I_OnSyncUserMetaData, I_OnDecodeMetaData, I_OnWhois };
28 ServerInstance->Modules->Attach(eventlist, this, 3);
31 virtual ~ModuleSSLDummy()
35 virtual Version GetVersion()
37 return Version("$Id$", VF_VENDOR, API_VERSION);
41 // :kenny.chatspike.net 320 Om Epy|AFK :is a Secure Connection
42 virtual void OnWhois(User* source, User* dest)
44 if(dest->GetExt("ssl", dummy))
46 ServerInstance->SendWhoisLine(source, dest, 320, "%s %s :is using a secure connection", source->nick.c_str(), dest->nick.c_str());
50 virtual void OnSyncUserMetaData(User* user, Module* proto, void* opaque, const std::string &extname, bool displayable)
52 // check if the linking module wants to know about OUR metadata
55 // check if this user has an ssl field to send
56 if(user->GetExt(extname, dummy))
58 // call this function in the linking module, let it format the data how it
59 // sees fit, and send it on its way. We dont need or want to know how.
60 proto->ProtoSendMetaData(opaque, TYPE_USER, user, extname, displayable ? "Enabled" : "ON");
65 virtual void OnDecodeMetaData(int target_type, void* target, const std::string &extname, const std::string &extdata)
67 // check if its our metadata key, and its associated with a user
68 if ((target_type == TYPE_USER) && (extname == "ssl"))
70 User* dest = (User*)target;
71 // if they dont already have an ssl flag, accept the remote server's
72 if (!dest->GetExt(extname, dummy))
74 dest->Extend(extname, "ON");
80 MODULE_INIT(ModuleSSLDummy)