void CSkypeProto::OnGetChatInfo(const NETLIBHTTPREQUEST *response, void *p) { TCHAR *topic = (TCHAR*)p; if (response == NULL || response->pData == NULL) return; JSONNode root = JSONNode::parse(response->pData); if (!root) return; const JSONNode &members = root["members"]; const JSONNode &properties = root["properties"]; if (!properties["capabilities"] || properties["capabilities"].empty()) return; CMStringA chatId(ChatUrlToName(root["messages"].as_string().c_str())); StartChatRoom(_A2T(chatId), topic); for (size_t i = 0; i < members.size(); i++) { const JSONNode &member = members.at(i); CMStringA username(ContactUrlToName(member["userLink"].as_string().c_str())); std::string role = member["role"].as_string(); if (!IsChatContact(_A2T(chatId), username)) AddChatContact(_A2T(chatId), username, username, _A2T(role.c_str()), true); } PushRequest(new GetHistoryRequest(m_szRegToken, chatId, 15, true, 0, m_szServer), &CSkypeProto::OnGetServerHistory); mir_free(topic); }
void TabsManager::load() { if (!isValidStorage()) return; StorableObject::load(); QDomElement itemsNode = storage()->point(); if (itemsNode.isNull()) return; QVector<QDomElement> itemElements = storage()->storage()->getNodes(itemsNode, "Tab"); foreach (const QDomElement &element, itemElements) { QUuid chatId(element.attribute("chat")); if (chatId.isNull()) continue; Chat chat = m_chatManager->byUuid(chatId); if (!chat) continue; if (element.attribute("type") == "detachedChat") chat.addProperty("tabs:detached", true, CustomProperties::Storable); else if (element.attribute("type") == "tab") chat.addProperty("tabs:attached", true, CustomProperties::Storable); m_chatWidgetManager->openChat(chat, OpenChatActivation::DoNotActivate); }
StreamBase& operator << (StreamBase& left, ChatHandler::Lobby& l) { ChatId chatId(l.id); if (l.is_broadcast) chatId = ChatId::makeBroadcastId(); left << makeKeyValueReference("id", l.id) << makeKeyValue("chat_id", chatId.toStdString()) << makeKeyValueReference("name",l.name) << makeKeyValueReference("topic", l.topic) << makeKeyValueReference("subscribed", l.subscribed) << makeKeyValueReference("auto_subscribe", l.auto_subscribe) << makeKeyValueReference("is_private", l.is_private) << makeKeyValueReference("is_broadcast", l.is_broadcast) << makeKeyValueReference("gxs_id", l.gxs_id); return left; }
void ChatWidgetManager::load() { if (!isValidStorage()) return; StorableStringList::load(); foreach (const QString &uuid, content()) { QUuid chatId(uuid); if (chatId.isNull()) continue; Chat chat = ChatManager::instance()->byUuid(chatId); if (!chat) continue; openPendingMessages(chat, true); }