/* * Copyright (c) 2013 Remko Tronçon * Licensed under the GNU General Public License. * See the COPYING file for more information. */ #include #include #include #include #include using namespace Swift; VCardUpdateConvertor::VCardUpdateConvertor() : GenericLuaElementConvertor("vcard_update") { } VCardUpdateConvertor::~VCardUpdateConvertor() { } boost::shared_ptr VCardUpdateConvertor::doConvertFromLua(lua_State* L) { boost::shared_ptr result = boost::make_shared(); if (boost::optional value = Lua::getStringField(L, -1, "photo_hash")) { result->setPhotoHash(*value); } return result; } void VCardUpdateConvertor::doConvertToLua(lua_State* L, boost::shared_ptr payload) { lua_newtable(L); if (!payload->getPhotoHash().empty()) { lua_pushstring(L, payload->getPhotoHash().c_str()); lua_setfield(L, -2, "photo_hash"); } }