- // 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;
- user->GetExt("ctitle", ctitle);
- if (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(int target_type, void* target, const std::string &extname, const std::string &extdata)
- {
- // check if its our metadata key, and its associated with a user
- if ((target_type == TYPE_USER) && (extname == "ctitle"))
- {
- User* dest = (User*)target;
- // if they dont already have an ctitle field, accept the remote server's
- std::string* text;
- if (!dest->GetExt("ctitle", text))
- {
- std::string* text = new std::string(extdata);
- dest->Extend("ctitle",text);
- }
- }
- }
-
- virtual ~ModuleCustomTitle()
- {
- }
-
- virtual Version GetVersion()