diff options
author | attilamolnar <attilamolnar@hush.com> | 2013-09-02 13:41:16 +0200 |
---|---|---|
committer | attilamolnar <attilamolnar@hush.com> | 2013-09-13 12:15:44 +0200 |
commit | cc74fb0be4ce4a5f55719dcf4b1045fe156ded1b (patch) | |
tree | 23ecbd574b8be2c3f5591aad433d0ca8616ca06c /include | |
parent | 02220d48eec4dd3507b582031de639c9d7835ec8 (diff) |
Pass an interface to the OnSync hooks
Remove Module::ProtoSendMetaData()
Diffstat (limited to 'include')
-rw-r--r-- | include/modules.h | 58 | ||||
-rw-r--r-- | include/protocol.h | 12 | ||||
-rw-r--r-- | include/typedefs.h | 1 |
3 files changed, 29 insertions, 42 deletions
diff --git a/include/modules.h b/include/modules.h index e04ee01ff..931d85032 100644 --- a/include/modules.h +++ b/include/modules.h @@ -623,43 +623,32 @@ class CoreExport Module : public classbase, public usecountbase /** Allows modules to synchronize data which relates to users during a netburst. * When this function is called, it will be called from the module which implements - * the linking protocol. This currently is m_spanningtree.so. A pointer to this module - * is given in Module* proto, so that you may call its methods such as ProtoSendMode - * (see below). This function will be called for every user visible on your side - * of the burst, allowing you to for example set modes, etc. Do not use this call to - * synchronize data which you have stored using class Extensible -- There is a specialist - * function OnSyncUserMetaData and OnSyncChannelMetaData for this! + * the linking protocol. This currently is m_spanningtree.so. + * This function will be called for every user visible on your side + * of the burst, allowing you to for example set modes, etc. * @param user The user being syncronized - * @param proto A pointer to the module handling network protocol - * @param opaque An opaque pointer set by the protocol module, should not be modified! + * @param server The target of the burst */ - virtual void OnSyncUser(User* user, Module* proto, void* opaque); + virtual void OnSyncUser(User* user, ProtocolServer& server); /** Allows modules to synchronize data which relates to channels during a netburst. * When this function is called, it will be called from the module which implements - * the linking protocol. This currently is m_spanningtree.so. A pointer to this module - * is given in Module* proto, so that you may call its methods such as ProtoSendMode - * (see below). This function will be called for every user visible on your side - * of the burst, allowing you to for example set modes, etc. + * the linking protocol. This currently is m_spanningtree.so. + * This function will be called for every channel visible on your side of the burst, + * allowing you to for example set modes, etc. * * @param chan The channel being syncronized - * @param proto A pointer to the module handling network protocol - * @param opaque An opaque pointer set by the protocol module, should not be modified! + * @param server The target of the burst */ - virtual void OnSyncChannel(Channel* chan, Module* proto, void* opaque); + virtual void OnSyncChannel(Channel* chan, ProtocolServer& server); - /* Allows modules to syncronize metadata not related to users or channels, over the network during a netburst. - * Whenever the linking module wants to send out data, but doesnt know what the data - * represents (e.g. it is Extensible metadata, added to a User or Channel by a module) then - * this method is called. You should use the ProtoSendMetaData function after you've - * correctly decided how the data should be represented, to send the metadata on its way if - * if it belongs to your module. - * @param proto A pointer to the module handling network protocol - * @param opaque An opaque pointer set by the protocol module, should not be modified! - * @param displayable If this value is true, the data is going to be displayed to a user, - * and not sent across the network. Use this to determine wether or not to show sensitive data. + /** Allows modules to syncronize metadata not related to users or channels, over the network during a netburst. + * When the linking module has finished sending all data it wanted to send during a netburst, then + * this method is called. You should use the SendMetaData() function after you've + * correctly decided how the data should be represented, to send the data. + * @param server The target of the burst */ - virtual void OnSyncNetwork(Module* proto, void* opaque); + virtual void OnSyncNetwork(ProtocolServer& server); /** Allows module data, sent via ProtoSendMetaData, to be decoded again by a receiving module. * Please see src/modules/m_swhois.cpp for a working example of how to use this method call. @@ -669,21 +658,6 @@ class CoreExport Module : public classbase, public usecountbase */ virtual void OnDecodeMetaData(Extensible* target, const std::string &extname, const std::string &extdata); - /** Implemented by modules which provide the ability to link servers. - * These modules will implement this method, which allows metadata (extra data added to - * user and channel records using class Extensible, Extensible::Extend, etc) to be sent - * to other servers on a netburst and decoded at the other end by the same module on a - * different server. - * - * More documentation to follow soon. Please see src/modules/m_swhois.cpp for example of - * how to use this function. - * @param opaque An opaque pointer set by the protocol module, should not be modified! - * @param target The Channel* or User* that metadata should be sent for - * @param extname The extension name to send metadata for - * @param extdata Encoded data for this extension name, which will be encoded at the oppsite end by an identical module using OnDecodeMetaData - */ - virtual void ProtoSendMetaData(void* opaque, Extensible* target, const std::string &extname, const std::string &extdata); - /** Called whenever a user's hostname is changed. * This event triggers after the host has been set. * @param user The user whos host is being changed diff --git a/include/protocol.h b/include/protocol.h index bffc4a5e9..b077a4f47 100644 --- a/include/protocol.h +++ b/include/protocol.h @@ -26,9 +26,21 @@ class User; typedef std::vector<std::string> parameterlist; +class ProtocolServer +{ + public: + /** Send metadata related to this server to the target server + * @param key The 'key' of the data + * @param data The string representation of the data + */ + virtual void SendMetaData(const std::string& key, const std::string& data) = 0; +}; + class CoreExport ProtocolInterface { public: + typedef ProtocolServer Server; + class ServerInfo { public: diff --git a/include/typedefs.h b/include/typedefs.h index 98ea4a0b9..37e6daaf0 100644 --- a/include/typedefs.h +++ b/include/typedefs.h @@ -36,6 +36,7 @@ class LocalUser; class Membership; class Module; class OperInfo; +class ProtocolServer; class RemoteUser; class ServerConfig; class ServerLimits; |