- std::string* ctitle;
- if (dest->GetExt("ctitle", ctitle))
- {
- ServerInstance->SendWhoisLine(user, dest, 320, "%s %s :%s",user->nick.c_str(), dest->nick.c_str(), ctitle->c_str());
- }
- }
- /* Dont block anything */
- return 0;
- }
-
- // 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 OnSyncUser(User* user, Module* proto, void* opaque)
- {
- // check if this user has an ctitle field to send
- std::string* ctitle;
- if (user->GetExt("ctitle", ctitle))
- proto->ProtoSendMetaData(opaque,user,"ctitle",*ctitle);
- }
-
- // when a user quits, tidy up their metadata
- virtual void OnUserQuit(User* user, const std::string &message, const std::string &oper_message)
- {
- std::string* ctitle;
- if (user->GetExt("ctitle", ctitle))
- {
- user->Shrink("ctitle");
- delete ctitle;
- }
- }
-
- // 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* ctitle;
- if (user->GetExt("ctitle", ctitle))
- {
- user->Shrink("ctitle");
- delete ctitle;
- }
- }
- }
-
- // Whenever the linking module receives metadata from another server and doesnt know what
- // to do with it (of course, hence the 'meta') it calls this method, and it is up to each
- // module in turn to figure out if this metadata key belongs to them, and what they want
- // to do with it.
- // In our case we're only sending a single string around, so we just construct a std::string.
- // Some modules will probably get much more complex and format more detailed structs and classes
- // in a textual way for sending over the link.
- virtual void OnDecodeMetaData(Extensible* target, const std::string &extname, const std::string &extdata)
- {
- User* dest = dynamic_cast<User*>(target);
- // check if its our metadata key, and its associated with a user
- if (dest && (extname == "ctitle"))
- {
- std::string* text;
- if (dest->GetExt("ctitle", text))