- // Whenever the linking module wants to send out data, but doesnt know what the data
- // represents (e.g. it is metadata, added to a User or Channel by a module) then
- // this method is called. We should use the ProtoSendMetaData function after we've
- // corrected decided how the data should look, to send the metadata on its way if
- // it is ours.
- virtual void OnSyncUserMetaData(User* user, Module* proto, void* opaque, const std::string &extname, bool displayable)
- {
- // check if the linking module wants to know about OUR metadata
- if (extname == "swhois")
- {
- // check if this user has an swhois field to send
- std::string* swhois;
- user->GetExt("swhois", swhois);
- if (swhois)
- {
- // call this function in the linking module, let it format the data how it
- // sees fit, and send it on its way. We dont need or want to know how.
- proto->ProtoSendMetaData(opaque,TYPE_USER,user,extname,*swhois);
- }
- }
- }
-
- // when a user quits, tidy up their metadata
- virtual void OnUserQuit(User* user, const std::string &message, const std::string &oper_message)
- {
- std::string* swhois;
- user->GetExt("swhois", swhois);
- if (swhois)
- {
- user->Shrink("swhois");
- delete swhois;
- }
- }
-
- // if the module is unloaded, tidy up all our dangling metadata
- virtual void OnCleanup(int target_type, void* item)
- {
- if (target_type == TYPE_USER)
- {
- User* user = (User*)item;
- std::string* swhois;
- user->GetExt("swhois", swhois);
- if (swhois)
- {
- user->Shrink("swhois");
- delete swhois;
- }
- }