From 0ed3ef9dee2cb8f4b0c37da218a2fd1eee8c31f6 Mon Sep 17 00:00:00 2001 From: danieldg Date: Sun, 13 Sep 2009 20:32:03 +0000 Subject: Add SerializeFormat for easier metadata formatting git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11704 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_callerid.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/modules/m_callerid.cpp') diff --git a/src/modules/m_callerid.cpp b/src/modules/m_callerid.cpp index b84ee2c9c..dab0d3d43 100644 --- a/src/modules/m_callerid.cpp +++ b/src/modules/m_callerid.cpp @@ -56,14 +56,15 @@ class callerid_data : public classbase } } - std::string ToString(Module* proto) const + std::string ToString(SerializeFormat format) const { std::ostringstream oss; oss << lastnotify; for (std::set::const_iterator i = accepting.begin(); i != accepting.end(); ++i) { + User* u = *i; // Encode UIDs. - oss << "," << proto->ProtoTranslate(*i); + oss << "," << (format == FORMAT_USER ? u->nick : u->uuid); } oss << std::ends; return oss.str(); @@ -77,13 +78,13 @@ struct CallerIDExtInfo : public ExtensionItem { } - std::string serialize(Module* requestor, const Extensible* container, void* item) + std::string serialize(SerializeFormat format, const Extensible* container, void* item) { callerid_data* dat = static_cast(item); - return dat->ToString(requestor); + return dat->ToString(format); } - void unserialize(Module* requestor, Extensible* container, const std::string& value) + void unserialize(SerializeFormat format, Extensible* container, const std::string& value) { callerid_data* dat = new callerid_data(value); set_raw(container, dat); -- cgit v1.2.3