void CJabberProto::UpdateSubscriptionInfo(MCONTACT hContact, JABBER_LIST_ITEM *item) { switch (item->subscription) { case SUB_TO: setTString(hContact, "SubscriptionText", TranslateT("To")); setString(hContact, "Subscription", "to"); setByte(hContact, "Auth", 0); setByte(hContact, "Grant", 1); break; case SUB_FROM: setTString(hContact, "SubscriptionText", TranslateT("From")); setString(hContact, "Subscription", "from"); setByte(hContact, "Auth", 1); setByte(hContact, "Grant", 0); break; case SUB_BOTH: setTString(hContact, "SubscriptionText", TranslateT("Both")); setString(hContact, "Subscription", "both"); setByte(hContact, "Auth", 0); setByte(hContact, "Grant", 0); break; case SUB_NONE: setTString(hContact, "SubscriptionText", TranslateT("None")); setString(hContact, "Subscription", "none"); setByte(hContact, "Auth", 1); setByte(hContact, "Grant", 1); break; } }
MCONTACT CIrcProto::CList_AddContact(CONTACT *user, bool InList, bool SetOnline) { if (user->name == NULL) return 0; MCONTACT hContact = CList_FindContact(user); if (hContact) { if (InList) db_unset(hContact, "CList", "NotOnList"); setTString(hContact, "Nick", user->name); db_unset(hContact, "CList", "Hidden"); if (SetOnline && getWord(hContact, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE) setWord(hContact, "Status", ID_STATUS_ONLINE); return hContact; } // here we create a new one since no one is to be found hContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0); if (hContact) { CallService(MS_PROTO_ADDTOCONTACT, hContact, (LPARAM)m_szModuleName); if (InList) db_unset(hContact, "CList", "NotOnList"); else db_set_b(hContact, "CList", "NotOnList", 1); db_unset(hContact, "CList", "Hidden"); setTString(hContact, "Nick", user->name); setTString(hContact, "Default", user->name); setWord(hContact, "Status", SetOnline ? ID_STATUS_ONLINE : ID_STATUS_OFFLINE); if (!InList && getByte("MirVerAutoRequestTemp", 0)) PostIrcMessage(_T("/PRIVMSG %s \001VERSION\001"), user->name); return hContact; } return false; }
void CVkProto::AddFeedSpecialUser() { bool bSpecialContact = m_bNewsEnabled || m_bNotificationsEnabled || m_bSpecialContactAlwaysEnabled; MCONTACT hContact = FindUser(VK_FEED_USER); if (!bSpecialContact) { if (hContact) CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact); return; } if (!hContact) { hContact = FindUser(VK_FEED_USER, true); setTString(hContact, "Nick", TranslateT("VKontakte")); CMString tszUrl = _T("https://vk.com/press/Simple.png"); SetAvatarUrl(hContact, tszUrl); ReloadAvatarInfo(hContact); setTString(hContact, "domain", _T("feed")); setTString(hContact, "Homepage", _T("https://vk.com/feed")); } if (getWord(hContact, "Status") != ID_STATUS_ONLINE) setWord(hContact, "Status", ID_STATUS_ONLINE); SetMirVer(hContact, 7); }
void CJabberProto::ConvertPasswords() { ptrT passw(JSetStringCrypt(m_szModuleName, NULL, "LoginPassword")); if (passw == NULL) return; setTString("Password", passw); delSetting("LoginPassword"); for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { if ((passw = JSetStringCrypt(m_szModuleName, hContact, "LoginPassword")) == NULL) continue; setTString(hContact, "Password", passw); delSetting(hContact, "LoginPassword"); } for (int i = 0;; i++) { char varName[100]; mir_snprintf(varName, sizeof(varName), "rcMuc_%d_server", i); ptrA str(getStringA(NULL, varName)); if (str == NULL) break; mir_snprintf(varName, sizeof(varName), "rcMuc_%d", i); if ((passw = JSetStringCrypt(m_szModuleName, NULL, varName)) != NULL) { delSetting(varName); mir_snprintf(varName, sizeof(varName), "password_rcMuc_%d", i); setTString(varName, passw); } } }
void CVkProto::OnReceiveUserInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) { debugLogA("CVkProto::OnReceiveUserInfo %d", reply->resultCode); if (reply->resultCode != 200) return; JSONROOT pRoot; JSONNODE *pResponse = CheckJsonResponse(pReq, reply, pRoot); if (pResponse == NULL) return; for (size_t i=0; ; i++) { JSONNODE *pRecord = json_at(pResponse, i); if (pRecord == NULL) break; LONG userid = json_as_int( json_get(pRecord, "uid")); if (userid == 0) return; MCONTACT hContact; if (userid == m_myUserId) hContact = NULL; else if ((hContact = FindUser(userid, false)) == NULL) return; CMString tszNick; ptrT szValue( json_as_string( json_get(pRecord, "first_name"))); if (szValue) { setTString(hContact, "FirstName", szValue); tszNick.Append(szValue); tszNick.AppendChar(' '); } if (szValue = json_as_string( json_get(pRecord, "last_name"))) { setTString(hContact, "LastName", szValue); tszNick.Append(szValue); } if (!tszNick.IsEmpty()) setTString(hContact, "Nick", tszNick); setByte(hContact, "Gender", json_as_int( json_get(pRecord, "sex")) == 2 ? 'M' : 'F'); if (szValue = json_as_string( json_get(pRecord, "bdate"))) { int d, m, y; if ( _stscanf(szValue, _T("%d.%d.%d"), &d, &m, &y) == 3) { setByte(hContact, "BirthDay", d); setByte(hContact, "BirthMonth", m); setWord(hContact, "BirthYear", y); } } szValue = json_as_string( json_get(pRecord, "photo_medium")); SetAvatarUrl(hContact, szValue); } }
bool CIrcProto::CList_SetAllOffline(BYTE ChatsToo) { DBVARIANT dbv; DisconnectAllDCCSessions(false); for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { if (isChatRoom(hContact)) continue; if (getByte(hContact, "DCC", 0) != 0) { if (ChatsToo) setWord(hContact, "Status", ID_STATUS_OFFLINE); } else if (!getTString(hContact, "Default", &dbv)) { setTString(hContact, "Nick", dbv.ptszVal); setWord(hContact, "Status", ID_STATUS_OFFLINE); db_free(&dbv); } db_unset(hContact, m_szModuleName, "IP"); setString(hContact, "User", ""); setString(hContact, "Host", ""); } return true; }
void CJabberProto::SearchDeleteFromRecent(const TCHAR *szAddr, BOOL deleteLastFromDB) { //search in recent for (int i=0; i<10; i++) { char key[30]; mir_snprintf(key, SIZEOF(key), "RecentlySearched_%d", i); ptrT szValue( getTStringA(key)); if (szValue == NULL || _tcsicmp(szAddr, szValue)) continue; for (int j=i; j < 10; j++) { mir_snprintf(key, SIZEOF(key), "RecentlySearched_%d", j + 1); szValue = getTStringA(key); if (szValue != NULL) { mir_snprintf(key, SIZEOF(key), "RecentlySearched_%d", j); setTString(NULL, key, szValue); } else { if (deleteLastFromDB) { mir_snprintf(key, SIZEOF(key), "RecentlySearched_%d", j); delSetting(NULL,key); } break; } } break; } }
void CIrcProto::AddToJTemp(TCHAR op, CMString& sCommand) { CMString res; int pos = 0; for ( ;; ) { CMString tmp = sCommand.Tokenize( _T(","), pos ); if ( pos == -1 ) break; tmp = op + tmp; if ( res.IsEmpty() ) res = tmp; else res += _T(" ") + tmp; } DBVARIANT dbv; if ( !getTString( "JTemp", &dbv )) { res = CMString(dbv.ptszVal) + _T(" ") + res; DBFreeVariant( &dbv ); } setTString("JTemp", res.c_str()); }
MCONTACT CToxProto::AddChatRoom(int groupNumber) { MCONTACT hContact = GetChatRoom(groupNumber); if (!hContact) { hContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0); Proto_AddToContact(hContact, m_szModuleName); setWord(hContact, TOX_SETTINGS_CHAT_ID, groupNumber); TCHAR title[MAX_PATH]; mir_sntprintf(title, _T("%s #%d"), TranslateT("Group chat"), groupNumber); setTString(hContact, "Nick", title); DBVARIANT dbv; if (!db_get_s(NULL, "Chat", "AddToGroup", &dbv, DBVT_TCHAR)) { db_set_ts(hContact, "CList", "Group", dbv.ptszVal); db_free(&dbv); } setByte(hContact, "ChatRoom", 1); } return hContact; }
void WhatsAppProto::onGroupNewSubject(const std::string &gjid, const std::string &author, const std::string &newSubject, int ts) { WAChatInfo *pInfo = SafeGetChat(gjid); if (pInfo == NULL) return; ptrT tszText(str2t(newSubject)); ptrT tszTextDb(getTStringA(pInfo->hContact, WHATSAPP_KEY_NICK)); if (!mir_tstrcmp(tszText, tszTextDb)) // notify about subject change only if differs from the stored one return; ptrT tszUID(str2t(author)); ptrT tszNick(GetChatUserNick(author)); GCDEST gcd = { m_szModuleName, pInfo->tszJid, GC_EVENT_TOPIC }; GCEVENT gce = { sizeof(gce), &gcd }; gce.dwFlags = GCEF_ADDTOLOG + ((ts == 0) ? GCEF_NOTNOTIFY : 0); gce.ptszUID = tszUID; gce.ptszNick = tszNick; gce.time = ts; gce.ptszText = tszText; CallServiceSync(MS_GC_EVENT, NULL, (LPARAM)&gce); setTString(pInfo->hContact, WHATSAPP_KEY_NICK, tszText); }
void CVkProto::OnReceiveStatusMsg(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) { debugLogA("CVkProto::OnReceiveStatusMsg %d", reply->resultCode); if (reply->resultCode != 200) return; OnReceiveStatus(reply, pReq); ptrT ptszOldStatusMsg(db_get_tsa(NULL, m_szModuleName, "OldStatusMsg")); CMString tszOldStatusMsg(ptszOldStatusMsg); ENTER_STRING pForm = { sizeof(pForm) }; pForm.type = ESF_MULTILINE; pForm.caption = TranslateT("Enter new status message"); pForm.ptszInitVal = ptszOldStatusMsg; pForm.szModuleName = m_szModuleName; pForm.szDataPrefix = "statusmsgform_"; if (!EnterString(&pForm)) return; CMString tszNewStatusMsg(ptrT(pForm.ptszResult)); if (tszOldStatusMsg == tszNewStatusMsg) return; RetrieveStatusMsg(tszNewStatusMsg); setTString("OldStatusMsg", ptszOldStatusMsg); }
void CSkypeProto::UpdateProfileLanguage(const JSONNode &root, MCONTACT hContact) { CMString isocode = root["language"].as_mstring(); if (!isocode.IsEmpty() && isocode != "null") setTString(hContact, "Language0", languages[isocode.GetBuffer()].c_str()); else delSetting(hContact, "Language0"); }
void CSkypeProto::UpdateProfileLastName(const JSONNode &root, MCONTACT hContact) { CMString lastname = root["lastname"].as_mstring(); if (!lastname.IsEmpty() && lastname != "null") setTString(hContact, "LastName", lastname); else delSetting(hContact, "LastName"); }
void CSkypeProto::UpdateProfileXStatusMessage(const JSONNode &root, MCONTACT hContact) { CMString province = root["richMood"].as_mstring(); if (!province.IsEmpty() && province != "null") setTString(hContact, "XStatusMsg", province); else delSetting(hContact, "XStatusMsg"); }
void CSkypeProto::UpdateProfilePhoneOffice(const JSONNode &root, MCONTACT hContact) { CMString province = root["phoneOffice"].as_mstring(); if (!province.IsEmpty() && province != "null") setTString(hContact, "CompanyPhone", province); else delSetting(hContact, "CompanyPhone"); }
void CSkypeProto::UpdateProfileAbout(const JSONNode &root, MCONTACT hContact) { CMString about = root["about"].as_mstring(); if (!about.IsEmpty() && about != "null") setTString(hContact, "About", about); else delSetting(hContact, "About"); }
void CSkypeProto::UpdateProfileHomepage(const JSONNode &root, MCONTACT hContact) { CMString homepage = root["homepage"].as_mstring(); if (!homepage.IsEmpty() && homepage != "null") setTString(hContact, "Homepage", homepage); else delSetting(hContact, "Homepage"); }
void CSkypeProto::UpdateProfileCity(const JSONNode &root, MCONTACT hContact) { CMString city = root["city"].as_mstring(); if (!city.IsEmpty() && city != "null") setTString(hContact, "City", city); else delSetting(hContact, "City"); }
INT_PTR __cdecl CJabberProto::JabberSetNickname(WPARAM wParam, LPARAM lParam) { TCHAR *nickname = (wParam & SMNN_UNICODE) ? mir_u2t((WCHAR*)lParam) : mir_a2t((char*)lParam); setTString("Nick", nickname); SetServerVcard(FALSE, _T("")); return 0; }
void CJabberProto::SearchAddToRecent(const TCHAR *szAddr, HWND hwndDialog) { char key[30]; SearchDeleteFromRecent(szAddr); for (int j=9; j > 0; j--) { mir_snprintf(key, SIZEOF(key), "RecentlySearched_%d", j - 1); ptrT szValue( getTStringA(key)); if (szValue != NULL) { mir_snprintf(key, SIZEOF(key), "RecentlySearched_%d", j); setTString(NULL, key, szValue); } } mir_snprintf(key, SIZEOF(key), "RecentlySearched_%d", 0); setTString(key, szAddr); if (hwndDialog) JabberSearchAddUrlToRecentCombo(hwndDialog, szAddr); }
int WhatsAppProto::onGroupChatEvent(WPARAM wParam, LPARAM lParam) { GCHOOK *gch = (GCHOOK*)lParam; if (mir_strcmp(gch->pDest->pszModule, m_szModuleName)) return 0; std::string chat_id(T2Utf(gch->pDest->ptszID)); WAChatInfo *pInfo = SafeGetChat(chat_id); if (pInfo == NULL) return 0; switch (gch->pDest->iType) { case GC_USER_LOGMENU: ChatLogMenuHook(pInfo, gch); break; case GC_USER_NICKLISTMENU: NickListMenuHook(pInfo, gch); break; case GC_USER_MESSAGE: if (isOnline()) { std::string msg(T2Utf(gch->ptszText)); try { int msgId = GetSerial(); time_t now = time(NULL); std::string id = Utilities::intToStr(now) + "-" + Utilities::intToStr(msgId); FMessage fmsg(chat_id, true, id); fmsg.timestamp = now; fmsg.data = msg; m_pConnection->sendMessage(&fmsg); pInfo->m_unsentMsgs[id] = gch->ptszText; } CODE_BLOCK_CATCH_ALL } break; case GC_USER_PRIVMESS: string jid = string(_T2A(gch->ptszUID)) + "@s.whatsapp.net"; MCONTACT hContact = ContactIDToHContact(jid); if (hContact == 0) { hContact = AddToContactList(jid, (char*)_T2A(gch->ptszUID)); setWord(hContact, "Status", ID_STATUS_ONLINE); db_set_b(hContact, "CList", "Hidden", 1); setTString(hContact, "Nick", gch->ptszUID); db_set_dw(hContact, "Ignore", "Mask1", 0); } CallService(MS_MSG_SENDMESSAGE, hContact, 0); break; } return 0; }
void CJabberProto::UpdateMirVer(MCONTACT hContact, pResourceStatus &resource) { CMString tszMirVer; FormatMirVer(resource, tszMirVer); if (!tszMirVer.IsEmpty()) setTString(hContact, "MirVer", tszMirVer); ptrT jid( getTStringA(hContact, "jid")); if (jid == NULL) return; TCHAR szFullJid[JABBER_MAX_JID_LEN]; if (resource->m_tszResourceName && !_tcschr(jid, '/')) mir_sntprintf(szFullJid, SIZEOF(szFullJid), _T("%s/%s"), jid, resource->m_tszResourceName); else lstrcpyn(szFullJid, jid, SIZEOF(szFullJid)); setTString(hContact, DBSETTING_DISPLAY_UID, szFullJid); }
INT_PTR CMsnProto::SetCurrentMedia(WPARAM, LPARAM lParam) { // Clear old info mir_free(msnCurrentMedia.ptszArtist); mir_free(msnCurrentMedia.ptszAlbum); mir_free(msnCurrentMedia.ptszTitle); mir_free(msnCurrentMedia.ptszTrack); mir_free(msnCurrentMedia.ptszYear); mir_free(msnCurrentMedia.ptszGenre); mir_free(msnCurrentMedia.ptszLength); mir_free(msnCurrentMedia.ptszPlayer); mir_free(msnCurrentMedia.ptszType); memset(&msnCurrentMedia, 0, sizeof(msnCurrentMedia)); // Copy new info LISTENINGTOINFO *cm = (LISTENINGTOINFO *)lParam; if (cm != NULL && cm->cbSize == sizeof(LISTENINGTOINFO) && (cm->ptszArtist != NULL || cm->ptszTitle != NULL)) { bool unicode = (cm->dwFlags & LTI_UNICODE) != 0; msnCurrentMedia.cbSize = sizeof(msnCurrentMedia); // Marks that there is info set msnCurrentMedia.dwFlags = LTI_TCHAR; overrideStr(msnCurrentMedia.ptszType, cm->ptszType, unicode, _T("Music")); overrideStr(msnCurrentMedia.ptszArtist, cm->ptszArtist, unicode); overrideStr(msnCurrentMedia.ptszAlbum, cm->ptszAlbum, unicode); overrideStr(msnCurrentMedia.ptszTitle, cm->ptszTitle, unicode, _T("No Title")); overrideStr(msnCurrentMedia.ptszTrack, cm->ptszTrack, unicode); overrideStr(msnCurrentMedia.ptszYear, cm->ptszYear, unicode); overrideStr(msnCurrentMedia.ptszGenre, cm->ptszGenre, unicode); overrideStr(msnCurrentMedia.ptszLength, cm->ptszLength, unicode); overrideStr(msnCurrentMedia.ptszPlayer, cm->ptszPlayer, unicode); } // Set user text if (msnCurrentMedia.cbSize == 0) delSetting("ListeningTo"); else { TCHAR *text; if (ServiceExists(MS_LISTENINGTO_GETPARSEDTEXT)) text = (TCHAR *)CallService(MS_LISTENINGTO_GETPARSEDTEXT, (WPARAM)_T("%title% - %artist%"), (LPARAM)&msnCurrentMedia); else { text = (TCHAR *)mir_alloc(128 * sizeof(TCHAR)); mir_sntprintf(text, 128, _T("%s - %s"), (msnCurrentMedia.ptszTitle ? msnCurrentMedia.ptszTitle : _T("")), (msnCurrentMedia.ptszArtist ? msnCurrentMedia.ptszArtist : _T(""))); } setTString("ListeningTo", text); mir_free(text); } // Send it char** msgptr = GetStatusMsgLoc(m_iDesiredStatus); MSN_SendStatusMessage(msgptr ? *msgptr : NULL); return 0; }
MCONTACT CJabberProto::DBCreateContact(const TCHAR *jid, const TCHAR *nick, BOOL temporary, BOOL stripResource) { if (jid == NULL || jid[0]=='\0') return NULL; TCHAR *s = NEWTSTR_ALLOCA(jid); TCHAR *q = NULL, *p; // strip resource if present if ((p = _tcschr(s, '@')) != NULL) if ((q = _tcschr(p, '/')) != NULL) *q = '\0'; if (!stripResource && q != NULL) // so that resource is not stripped *q = '/'; // We can't use JabberHContactFromJID() here because of the stripResource option size_t len = _tcslen(s); for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { ptrT jid( getTStringA(hContact, "jid")); if (jid == NULL) continue; TCHAR *p = jid; if (p && _tcslen(p) >= len && (p[len]=='\0'||p[len]=='/') && !_tcsnicmp(p, s, len)) return hContact; } MCONTACT hNewContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0); CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)hNewContact, (LPARAM)m_szModuleName); setTString(hNewContact, "jid", s); if (nick != NULL && *nick != '\0') setTString(hNewContact, "Nick", nick); if (temporary) db_set_b(hNewContact, "CList", "NotOnList", 1); else SendGetVcard(s); debugLog(_T("Create Jabber contact jid=%s, nick=%s"), s, nick); DBCheckIsTransportedContact(s,hNewContact); return hNewContact; }
INT_PTR __cdecl CJabberProto::OnMenuConvertChatContact(WPARAM hContact, LPARAM) { BYTE bIsChatRoom = isChatRoom(hContact); const char *szSetting = (bIsChatRoom) ? "ChatRoomID" : "jid"; ptrT jid(getTStringA(hContact, szSetting)); if (jid != NULL) { delSetting(hContact, szSetting); setTString(hContact, szSetting, jid); setByte(hContact, "ChatRoom", !bIsChatRoom); } return 0; }
void CSkypeProto::UpdateProfileDisplayName(const JSONNode &root, MCONTACT hContact) { ptrT firstname(getTStringA(hContact, "FirstName")); ptrT lastname(getTStringA(hContact, "LastName")); if (firstname) { CMString nick = firstname; if (lastname) nick.AppendFormat(_T(" %s"), lastname); setTString(hContact, "Nick", nick); } else if (lastname) setTString(hContact, "Nick", lastname); else { const JSONNode &node = root["displayname"]; CMString displayname((!node) ? root["username"].as_mstring() : node.as_mstring()); if (!displayname.IsEmpty() && displayname != "null") setTString(hContact, "Nick", displayname); else delSetting(hContact, "Nick"); } }
CVkChatInfo* CVkProto::AppendChat(int id, JSONNODE *pDlg) { if (id == 0) return NULL; CVkChatInfo *c = m_chats.find((CVkChatInfo*)&id); if (c != NULL) return c; ptrT tszTitle; c = new CVkChatInfo(id); if (pDlg != NULL) { tszTitle = json_as_string(json_get(pDlg, "title")); c->m_tszTopic = mir_tstrdup((tszTitle != NULL) ? tszTitle : _T("")); } CMString sid; sid.Format(_T("%S_%d"), m_szModuleName, id); c->m_tszId = mir_tstrdup(sid); GCSESSION gcw = { sizeof(gcw) }; gcw.iType = GCW_CHATROOM; gcw.pszModule = m_szModuleName; gcw.ptszName = tszTitle; gcw.ptszID = sid; CallServiceSync(MS_GC_NEWSESSION, NULL, (LPARAM)&gcw); GC_INFO gci = { 0 }; gci.pszModule = m_szModuleName; gci.pszID = sid; gci.Flags = BYID | HCONTACT; CallServiceSync(MS_GC_GETINFO, 0, (LPARAM)&gci); c->m_hContact = gci.hContact; setTString(gci.hContact, "Nick", tszTitle); m_chats.insert(c); GCDEST gcd = { m_szModuleName, sid, GC_EVENT_ADDGROUP }; GCEVENT gce = { sizeof(gce), &gcd }; for (int i = SIZEOF(sttStatuses)-1; i >= 0; i--) { gce.ptszStatus = TranslateTS(sttStatuses[i]); CallServiceSync(MS_GC_EVENT, NULL, (LPARAM)&gce); } gcd.iType = GC_EVENT_CONTROL; gce.ptszStatus = 0; CallServiceSync(MS_GC_EVENT, (m_bHideChats) ? WINDOW_HIDDEN : SESSION_INITDONE, (LPARAM)&gce); CallServiceSync(MS_GC_EVENT, SESSION_ONLINE, (LPARAM)&gce); RetrieveChatInfo(c); return c; }
INT_PTR CToxProto::SetMyNickname(WPARAM wParam, LPARAM lParam) { ptrT nickname((wParam & SMNN_UNICODE) ? mir_u2t((TCHAR*)lParam) : mir_a2t((char*)lParam)); setTString("Nick", nickname); if (IsOnline()) { T2Utf szNick8(nickname); TOX_ERR_SET_INFO error; if (!tox_self_set_name(toxThread->tox, szNick8, mir_strlen(szNick8), &error)) logger->Log(__FUNCTION__": failed to set nick name"); } return 0; }
HANDLE CIrcProto::CList_SetOffline(struct CONTACT * user) { DBVARIANT dbv; HANDLE hContact = CList_FindContact(user); if ( hContact ) { if ( !getTString( hContact, "Default", &dbv )) { setString(hContact, "User", ""); setString(hContact, "Host", ""); setTString(hContact, "Nick", dbv.ptszVal); setWord(hContact, "Status", ID_STATUS_OFFLINE); db_free(&dbv); return hContact; } } return 0; }
void CVkProto::OnReceiveStatus(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) { debugLogA("CVkProto::OnReceiveStatus %d", reply->resultCode); if (reply->resultCode != 200) return; JSONNode jnRoot; const JSONNode &jnResponse = CheckJsonResponse(pReq, reply, jnRoot); if (!jnResponse) return; const JSONNode &jnAudio = jnResponse["audio"]; if (!jnAudio) { CMString tszStatusText(jnResponse["text"].as_mstring()); if (tszStatusText[0] != TCHAR(9835)) setTString("OldStatusMsg", tszStatusText); } }