void Cache_GetFirstLineText(ClcData *dat, ClcContact *contact) { if (GetCurrentThreadId() != g_dwMainThreadID) return; ClcCacheEntry *pdnce = contact->pce; wchar_t *name = Clist_GetContactDisplayName(contact->hContact); if (dat->first_line_append_nick && !dat->bForceInDialog) { DBVARIANT dbv = { 0 }; if (!db_get_ws(pdnce->hContact, pdnce->szProto, "Nick", &dbv)) { wchar_t nick[_countof(contact->szText)]; mir_wstrncpy(nick, dbv.ptszVal, _countof(contact->szText)); db_free(&dbv); // They are the same -> use the name to keep the case if (mir_wstrcmpi(name, nick) == 0) mir_wstrncpy(contact->szText, name, _countof(contact->szText)); else // Append then mir_snwprintf(contact->szText, L"%s - %s", name, nick); } else mir_wstrncpy(contact->szText, name, _countof(contact->szText)); } else mir_wstrncpy(contact->szText, name, _countof(contact->szText)); if (!dat->bForceInDialog) contact->ssText.ReplaceSmileys(dat, pdnce, contact->szText, dat->first_line_draw_smileys); }
int fnCListTrayNotify(MIRANDASYSTRAYNOTIFY* msn) { if (msn == NULL) return 1; if (msn->cbSize != sizeof(MIRANDASYSTRAYNOTIFY) || msn->szInfo == NULL || msn->szInfoTitle == NULL) return 1; if (cli.trayIcon == NULL) return 2; UINT iconId = 0; if (msn->szProto) { for (int j = 0; j < cli.trayIconCount; j++) { if (cli.trayIcon[j].szProto != NULL) { if (!strcmp(msn->szProto, cli.trayIcon[j].szProto)) { iconId = cli.trayIcon[j].id; break; } } else if (cli.trayIcon[j].isBase) { iconId = cli.trayIcon[j].id; break; } } } else iconId = cli.trayIcon[0].id; if (msn->dwInfoFlags & NIIF_INTERN_UNICODE) { NOTIFYICONDATAW nid = { 0 }; nid.cbSize = (cli.shellVersion >= 5) ? NOTIFYICONDATAW_V2_SIZE : NOTIFYICONDATAW_V1_SIZE; nid.hWnd = cli.hwndContactList; nid.uID = iconId; nid.uFlags = NIF_INFO; mir_wstrncpy(nid.szInfo, msn->tszInfo, SIZEOF(nid.szInfo)); mir_wstrncpy(nid.szInfoTitle, msn->tszInfoTitle, SIZEOF(nid.szInfoTitle)); nid.szInfo[SIZEOF(nid.szInfo) - 1] = 0; nid.szInfoTitle[SIZEOF(nid.szInfoTitle) - 1] = 0; nid.uTimeout = msn->uTimeout; nid.dwInfoFlags = (msn->dwInfoFlags & ~NIIF_INTERN_UNICODE); return Shell_NotifyIconW(NIM_MODIFY, &nid) == 0; } else { NOTIFYICONDATAA nid = { 0 }; nid.cbSize = (cli.shellVersion >= 5) ? NOTIFYICONDATAA_V2_SIZE : NOTIFYICONDATAA_V1_SIZE; nid.hWnd = cli.hwndContactList; nid.uID = iconId; nid.uFlags = NIF_INFO; strncpy_s(nid.szInfo, msn->szInfo, _TRUNCATE); strncpy_s(nid.szInfoTitle, msn->szInfoTitle, _TRUNCATE); nid.uTimeout = msn->uTimeout; nid.dwInfoFlags = msn->dwInfoFlags; return Shell_NotifyIconA(NIM_MODIFY, &nid) == 0; } }
void CSAMWindow::checkItemValidity() { COMBOBOXEXITEM cbi = { 0 }; cbi.mask = CBEIF_IMAGE; cbi.iItem = SendDlgItemMessage(m_handle, IDC_COMBO, CB_GETCURSEL, 0, 0); SendDlgItemMessage(m_handle, IDC_COMBO, CBEM_GETITEM, 0, (LPARAM)&cbi); if (m_item->m_iIcon != cbi.iImage) m_item->m_iIcon = cbi.iImage, m_bChanged = TRUE; wchar_t tszInputMessage[EXTRASTATUS_MESSAGE_LIMIT]; GetDlgItemText(m_handle, IDC_MESSAGE, tszInputMessage, _countof(tszInputMessage)); PROTOACCOUNT *pdescr = Proto_GetAccount(m_parent->m_protoName); if (pdescr == nullptr) return; WPARAM i = SendMessage(m_hCombo, CB_GETCURSEL, 0, 0) + 1; wchar_t tszTitle[100]; CUSTOM_STATUS cs = { sizeof(cs) }; cs.flags = CSSF_MASK_NAME | CSSF_DEFAULT_NAME | CSSF_UNICODE; cs.ptszName = tszTitle; cs.wParam = &i; if (CallProtoService(pdescr->szModuleName, PS_GETCUSTOMSTATUSEX, 0, (LPARAM)&cs) == 0) mir_wstrncpy(m_item->m_tszTitle, TranslateW(tszTitle), _countof(m_item->m_tszTitle)); if (mir_wstrcmp(m_item->m_tszMessage, tszInputMessage)) mir_wstrcpy(m_item->m_tszMessage, tszInputMessage), m_bChanged = true; }
int GetValueW(MCONTACT hContact, const char *module, const char *setting, WCHAR *value, int length) { DBVARIANT dbv = { 0 }; if (!module || !setting || !value) return 0; if (length >= 10 && !db_get_s(hContact, module, setting, &dbv, 0)) { switch (dbv.type) { case DBVT_ASCIIZ: mir_wstrncpy(value, ptrW(mir_a2u(dbv.pszVal)), length); break; case DBVT_DWORD: case DBVT_WORD: case DBVT_BYTE: _ultow(getNumericValue(&dbv), value, 10); break; case DBVT_WCHAR: mir_wstrncpy(value, dbv.pwszVal, length); break; case DBVT_UTF8: mir_wstrncpy(value, ptrW(mir_utf8decodeW(dbv.pszVal)), length); break; case DBVT_DELETED: value[0] = 0; return 0; } int type = dbv.type; db_free(&dbv); return type; } value[0] = 0; return 0; }
void CToxOptionsMultimedia::EnumDevices(CCtrlCombo &combo, IMMDeviceEnumerator *pEnumerator, EDataFlow dataFlow, const char* setting) { LPWSTR pwszDefID = NULL; ptrW wszDefID(m_proto->getWStringA(setting)); if (wszDefID != NULL) { size_t len = mir_wstrlen(wszDefID) + 1; pwszDefID = (LPWSTR)CoTaskMemAlloc(len*2); mir_wstrncpy(pwszDefID, wszDefID, len); } else { CComPtr<IMMDevice> pDevice = NULL; if (FAILED(pEnumerator->GetDefaultAudioEndpoint(dataFlow, eConsole, &pDevice))) return; if (FAILED(pDevice->GetId(&pwszDefID))) return; } CComPtr<IMMDeviceCollection> pDevices = NULL; EXIT_ON_ERROR(pEnumerator->EnumAudioEndpoints(dataFlow, DEVICE_STATE_ACTIVE, &pDevices)); UINT count; EXIT_ON_ERROR(pDevices->GetCount(&count)); for (UINT i = 0; i < count; i++) { CComPtr<IMMDevice> pDevice = NULL; EXIT_ON_ERROR(pDevices->Item(i, &pDevice)); CComPtr<IPropertyStore> pProperties = NULL; EXIT_ON_ERROR(pDevice->OpenPropertyStore(STGM_READ, &pProperties)); PROPVARIANT varName; PropVariantInit(&varName); EXIT_ON_ERROR(pProperties->GetValue(PKEY_Device_FriendlyName, &varName)); LPWSTR pwszID = NULL; EXIT_ON_ERROR(pDevice->GetId(&pwszID)); combo.InsertString(varName.pwszVal, i, (LPARAM)mir_wstrdup(pwszID)); if (mir_wstrcmpi(pwszID, pwszDefID) == 0) combo.SetCurSel(i); CoTaskMemFree(pwszID); PropVariantClear(&varName); } Exit: CoTaskMemFree(pwszDefID); }
///////////////////////////////////////////////////////////////////////////////////////// // Getting Status name // returns -1 for XStatus, 1 for Status // int GetStatusName(wchar_t *text, int text_size, ClcCacheEntry *pdnce, BOOL xstatus_has_priority) { BOOL noAwayMsg = FALSE; BOOL noXstatus = FALSE; // Hide status text if Offline /// no offline WORD nStatus = pdnce->getStatus(); if ((nStatus == ID_STATUS_OFFLINE || nStatus == 0) && g_CluiData.bRemoveAwayMessageForOffline) noAwayMsg = TRUE; if (nStatus == ID_STATUS_OFFLINE || nStatus == 0) noXstatus = TRUE; text[0] = '\0'; // Get XStatusName if (!noAwayMsg && !noXstatus && xstatus_has_priority && pdnce->hContact && pdnce->szProto) { DBVARIANT dbv = { 0 }; if (!db_get_ws(pdnce->hContact, pdnce->szProto, "XStatusName", &dbv)) { //mir_wstrncpy(text, dbv.pszVal, text_size); CopySkipUnprintableChars(text, dbv.ptszVal, text_size - 1); db_free(&dbv); if (text[0] != '\0') return -1; } } // Get Status name wchar_t *tmp = Clist_GetStatusModeDescription(nStatus, 0); if (tmp && *tmp) { mir_wstrncpy(text, tmp, text_size); return 1; } // Get XStatusName if (!noAwayMsg && !noXstatus && !xstatus_has_priority && pdnce->hContact && pdnce->szProto) { DBVARIANT dbv = { 0 }; if (!db_get_ws(pdnce->hContact, pdnce->szProto, "XStatusName", &dbv)) { CopySkipUnprintableChars(text, dbv.ptszVal, text_size - 1); db_free(&dbv); if (text[0] != '\0') return -1; } } return 1; }
MIR_CORE_DLL(int) CreateDirectoryTreeW(const WCHAR *szDir) { if (szDir == NULL) return 1; WCHAR szTestDir[MAX_PATH]; mir_wstrncpy(szTestDir, szDir, _countof(szTestDir)); DWORD dwAttributes = GetFileAttributesW(szTestDir); if (dwAttributes != INVALID_FILE_ATTRIBUTES && (dwAttributes & FILE_ATTRIBUTE_DIRECTORY)) return 0; WCHAR *pszLastBackslash = wcsrchr(szTestDir, '\\'); if (pszLastBackslash == NULL) return 0; *pszLastBackslash = '\0'; CreateDirectoryTreeW(szTestDir); *pszLastBackslash = '\\'; return (CreateDirectoryW(szTestDir, NULL) == 0) ? GetLastError() : 0; }
void InitStatusList() { int index = 0; //Online index = Index(ID_STATUS_ONLINE); mir_wstrncpy(StatusList[index].lpzMStatusText, TranslateT("(M) is back online!"), MAX_STATUSTEXT); mir_wstrncpy(StatusList[index].lpzFStatusText, TranslateT("(F) is back online!"), MAX_STATUSTEXT); mir_wstrncpy(StatusList[index].lpzUStatusText, TranslateT("(U) is back online!"), MAX_STATUSTEXT); mir_wstrncpy(StatusList[index].lpzStandardText, TranslateT("Online"), MAX_STANDARDTEXT); mir_strncpy(StatusList[index].lpzSkinSoundName, "UserOnline", MAX_SKINSOUNDNAME); mir_wstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENW("User: Online"), MAX_SKINSOUNDDESC); mir_wstrncpy(StatusList[index].lpzSkinSoundFile, L"global.wav", MAX_PATH); StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40072bg", COLOR_BG_AVAILDEFAULT); StatusList[index].colorText = db_get_dw(NULL, MODULE, "40072tx", COLOR_TX_DEFAULT); //Offline index = Index(ID_STATUS_OFFLINE); mir_wstrncpy(StatusList[index].lpzMStatusText, TranslateT("(M) went offline! :("), MAX_STATUSTEXT); mir_wstrncpy(StatusList[index].lpzFStatusText, TranslateT("(F) went offline! :("), MAX_STATUSTEXT); mir_wstrncpy(StatusList[index].lpzUStatusText, TranslateT("(U) went offline! :("), MAX_STATUSTEXT); mir_wstrncpy(StatusList[index].lpzStandardText, TranslateT("Offline"), MAX_STANDARDTEXT); mir_strncpy(StatusList[index].lpzSkinSoundName, "UserOffline", MAX_SKINSOUNDNAME); mir_wstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENW("User: Offline"), MAX_SKINSOUNDDESC); mir_wstrncpy(StatusList[index].lpzSkinSoundFile, L"offline.wav", MAX_PATH); StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40071bg", COLOR_BG_NAVAILDEFAULT); StatusList[index].colorText = db_get_dw(NULL, MODULE, "40071tx", COLOR_TX_DEFAULT); //Invisible index = Index(ID_STATUS_INVISIBLE); mir_wstrncpy(StatusList[index].lpzMStatusText, TranslateT("(M) hides in shadows..."), MAX_STATUSTEXT); mir_wstrncpy(StatusList[index].lpzFStatusText, TranslateT("(F) hides in shadows..."), MAX_STATUSTEXT); mir_wstrncpy(StatusList[index].lpzUStatusText, TranslateT("(U) hides in shadows..."), MAX_STATUSTEXT); mir_wstrncpy(StatusList[index].lpzStandardText, TranslateT("Invisible"), MAX_STANDARDTEXT); mir_strncpy(StatusList[index].lpzSkinSoundName, "UserInvisible", MAX_SKINSOUNDNAME); mir_wstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENW("User: Invisible"), MAX_SKINSOUNDDESC); mir_wstrncpy(StatusList[index].lpzSkinSoundFile, L"invisible.wav", MAX_PATH); StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40078bg", COLOR_BG_AVAILDEFAULT); StatusList[index].colorText = db_get_dw(NULL, MODULE, "40078tx", COLOR_TX_DEFAULT); //Free for chat index = Index(ID_STATUS_FREECHAT); mir_wstrncpy(StatusList[index].lpzMStatusText, TranslateT("(M) feels talkative!"), MAX_STATUSTEXT); mir_wstrncpy(StatusList[index].lpzFStatusText, TranslateT("(F) feels talkative!"), MAX_STATUSTEXT); mir_wstrncpy(StatusList[index].lpzUStatusText, TranslateT("(U) feels talkative!"), MAX_STATUSTEXT); mir_wstrncpy(StatusList[index].lpzStandardText, TranslateT("Free for chat"), MAX_STANDARDTEXT); mir_strncpy(StatusList[index].lpzSkinSoundName, "UserFreeForChat", MAX_SKINSOUNDNAME); mir_wstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENW("User: Free for chat"), MAX_SKINSOUNDDESC); mir_wstrncpy(StatusList[index].lpzSkinSoundFile, L"free4chat.wav", MAX_PATH); StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40077bg", COLOR_BG_AVAILDEFAULT); StatusList[index].colorText = db_get_dw(NULL, MODULE, "40077tx", COLOR_TX_DEFAULT); //Away index = Index(ID_STATUS_AWAY); mir_wstrncpy(StatusList[index].lpzMStatusText, TranslateT("(M) went away"), MAX_STATUSTEXT); mir_wstrncpy(StatusList[index].lpzFStatusText, TranslateT("(F) went away"), MAX_STATUSTEXT); mir_wstrncpy(StatusList[index].lpzUStatusText, TranslateT("(U) went away"), MAX_STATUSTEXT); mir_wstrncpy(StatusList[index].lpzStandardText, TranslateT("Away"), MAX_STANDARDTEXT); mir_strncpy(StatusList[index].lpzSkinSoundName, "UserAway", MAX_SKINSOUNDNAME); mir_wstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENW("User: Away"), MAX_SKINSOUNDDESC); mir_wstrncpy(StatusList[index].lpzSkinSoundFile, L"away.wav", MAX_PATH); StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40073bg", COLOR_BG_NAVAILDEFAULT); StatusList[index].colorText = db_get_dw(NULL, MODULE, "40073tx", COLOR_TX_DEFAULT); //NA index = Index(ID_STATUS_NA); mir_wstrncpy(StatusList[index].lpzMStatusText, TranslateT("(M) isn't there anymore!"), MAX_STATUSTEXT); mir_wstrncpy(StatusList[index].lpzFStatusText, TranslateT("(F) isn't there anymore!"), MAX_STATUSTEXT); mir_wstrncpy(StatusList[index].lpzUStatusText, TranslateT("(U) isn't there anymore!"), MAX_STATUSTEXT); mir_wstrncpy(StatusList[index].lpzStandardText, TranslateT("Not available"), MAX_STANDARDTEXT); mir_strncpy(StatusList[index].lpzSkinSoundName, "UserNA", MAX_SKINSOUNDNAME); mir_wstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENW("User: Not available"), MAX_SKINSOUNDDESC); mir_wstrncpy(StatusList[index].lpzSkinSoundFile, L"na.wav", MAX_PATH); StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40075bg", COLOR_BG_NAVAILDEFAULT); StatusList[index].colorText = db_get_dw(NULL, MODULE, "40075tx", COLOR_TX_DEFAULT); //Occupied index = Index(ID_STATUS_OCCUPIED); mir_wstrncpy(StatusList[index].lpzMStatusText, TranslateT("(M) has something else to do"), MAX_STATUSTEXT); mir_wstrncpy(StatusList[index].lpzFStatusText, TranslateT("(F) has something else to do"), MAX_STATUSTEXT); mir_wstrncpy(StatusList[index].lpzUStatusText, TranslateT("(U) has something else to do"), MAX_STATUSTEXT); mir_wstrncpy(StatusList[index].lpzStandardText, TranslateT("Occupied"), MAX_STANDARDTEXT); mir_strncpy(StatusList[index].lpzSkinSoundName, "UserOccupied", MAX_SKINSOUNDNAME); mir_wstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENW("User: Occupied"), MAX_SKINSOUNDDESC); mir_wstrncpy(StatusList[index].lpzSkinSoundFile, L"occupied.wav", MAX_PATH); StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40076bg", COLOR_BG_NAVAILDEFAULT); StatusList[index].colorText = db_get_dw(NULL, MODULE, "40076tx", COLOR_TX_DEFAULT); //Do not disturb index = Index(ID_STATUS_DND); mir_wstrncpy(StatusList[index].lpzMStatusText, TranslateT("(M) doesn't want to be disturbed!"), MAX_STATUSTEXT); mir_wstrncpy(StatusList[index].lpzFStatusText, TranslateT("(F) doesn't want to be disturbed!"), MAX_STATUSTEXT); mir_wstrncpy(StatusList[index].lpzUStatusText, TranslateT("(U) doesn't want to be disturbed!"), MAX_STATUSTEXT); mir_wstrncpy(StatusList[index].lpzStandardText, TranslateT("Do not disturb"), MAX_STANDARDTEXT); mir_strncpy(StatusList[index].lpzSkinSoundName, "UserDND", MAX_SKINSOUNDNAME); mir_wstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENW("User: Do not disturb"), MAX_SKINSOUNDDESC); mir_wstrncpy(StatusList[index].lpzSkinSoundFile, L"dnd.wav", MAX_PATH); StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40074bg", COLOR_BG_NAVAILDEFAULT); StatusList[index].colorText = db_get_dw(NULL, MODULE, "40074tx", COLOR_TX_DEFAULT); //Out to lunch index = Index(ID_STATUS_OUTTOLUNCH); mir_wstrncpy(StatusList[index].lpzMStatusText, TranslateT("(M) is eating something"), MAX_STATUSTEXT); mir_wstrncpy(StatusList[index].lpzFStatusText, TranslateT("(F) is eating something"), MAX_STATUSTEXT); mir_wstrncpy(StatusList[index].lpzUStatusText, TranslateT("(U) is eating something"), MAX_STATUSTEXT); mir_wstrncpy(StatusList[index].lpzStandardText, TranslateT("Out to lunch"), MAX_STANDARDTEXT); mir_strncpy(StatusList[index].lpzSkinSoundName, "UserOutToLunch", MAX_SKINSOUNDNAME); mir_wstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENW("User: Out to lunch"), MAX_SKINSOUNDDESC); mir_wstrncpy(StatusList[index].lpzSkinSoundFile, L"lunch.wav", MAX_PATH); StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40080bg", COLOR_BG_NAVAILDEFAULT); StatusList[index].colorText = db_get_dw(NULL, MODULE, "40080tx", COLOR_TX_DEFAULT); //On the phone index = Index(ID_STATUS_ONTHEPHONE); mir_wstrncpy(StatusList[index].lpzMStatusText, TranslateT("(M) had to answer the phone"), MAX_STATUSTEXT); mir_wstrncpy(StatusList[index].lpzFStatusText, TranslateT("(F) had to answer the phone"), MAX_STATUSTEXT); mir_wstrncpy(StatusList[index].lpzUStatusText, TranslateT("(U) had to answer the phone"), MAX_STATUSTEXT); mir_wstrncpy(StatusList[index].lpzStandardText, TranslateT("On the phone"), MAX_STANDARDTEXT); mir_strncpy(StatusList[index].lpzSkinSoundName, "UserOnThePhone", MAX_SKINSOUNDNAME); mir_wstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENW("User: On the phone"), MAX_SKINSOUNDDESC); mir_wstrncpy(StatusList[index].lpzSkinSoundFile, L"phone.wav", MAX_PATH); StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40079bg", COLOR_BG_NAVAILDEFAULT); StatusList[index].colorText = db_get_dw(NULL, MODULE, "40079tx", COLOR_TX_DEFAULT); //Extra status index = Index(ID_STATUS_EXTRASTATUS); StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40081bg", COLOR_BG_AVAILDEFAULT); StatusList[index].colorText = db_get_dw(NULL, MODULE, "40081tx", COLOR_TX_DEFAULT); //Status message index = Index(ID_STATUS_STATUSMSG); StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40082bg", COLOR_BG_AVAILDEFAULT); StatusList[index].colorText = db_get_dw(NULL, MODULE, "40082tx", COLOR_TX_DEFAULT); //From offline index = ID_STATUS_FROMOFFLINE; mir_strncpy(StatusListEx[index].lpzSkinSoundName, "UserFromOffline", MAX_SKINSOUNDNAME); mir_wstrncpy(StatusListEx[index].lpzSkinSoundDesc, LPGENW("User: from offline (has priority!)"), MAX_SKINSOUNDDESC); //Status message removed index = ID_STATUS_SMSGREMOVED; mir_strncpy(StatusListEx[index].lpzSkinSoundName, "StatusMsgRemoved", MAX_SKINSOUNDNAME); mir_wstrncpy(StatusListEx[index].lpzSkinSoundDesc, LPGENW("Status message removed"), MAX_SKINSOUNDDESC); //Status message changed index = ID_STATUS_SMSGCHANGED; mir_strncpy(StatusListEx[index].lpzSkinSoundName, "StatusMsgChanged", MAX_SKINSOUNDNAME); mir_wstrncpy(StatusListEx[index].lpzSkinSoundDesc, LPGENW("Status message changed"), MAX_SKINSOUNDDESC); //Extra status removed index = ID_STATUS_XREMOVED; mir_strncpy(StatusListEx[index].lpzSkinSoundName, XSTATUS_SOUND_REMOVED, MAX_SKINSOUNDNAME); mir_wstrncpy(StatusListEx[index].lpzSkinSoundDesc, LPGENW("Extra status removed"), MAX_SKINSOUNDDESC); //Extra status message changed index = ID_STATUS_XMSGCHANGED; mir_strncpy(StatusListEx[index].lpzSkinSoundName, XSTATUS_SOUND_MSGCHANGED, MAX_SKINSOUNDNAME); mir_wstrncpy(StatusListEx[index].lpzSkinSoundDesc, LPGENW("Extra status message changed"), MAX_SKINSOUNDDESC); //Extra status changed index = ID_STATUS_XCHANGED; mir_strncpy(StatusListEx[index].lpzSkinSoundName, XSTATUS_SOUND_CHANGED, MAX_SKINSOUNDNAME); mir_wstrncpy(StatusListEx[index].lpzSkinSoundDesc, LPGENW("Extra status changed"), MAX_SKINSOUNDDESC); //Extra status message removed index = ID_STATUS_XMSGREMOVED; mir_strncpy(StatusListEx[index].lpzSkinSoundName, XSTATUS_SOUND_MSGREMOVED, MAX_SKINSOUNDNAME); mir_wstrncpy(StatusListEx[index].lpzSkinSoundDesc, LPGENW("Extra status message removed"), MAX_SKINSOUNDDESC); }
int Cache_GetLineText(ClcCacheEntry *pdnce, int type, LPTSTR text, int text_size, ClcLineInfo &line) { if (text == nullptr) return TEXT_EMPTY; text[0] = '\0'; switch (type) { case TEXT_STATUS: LBL_Status: if (GetStatusName(text, text_size, pdnce, line.xstatus_has_priority) == -1 && line.use_name_and_message_for_xstatus) { // Try to get XStatusMsg ptrW tszXStatusMsg(db_get_wsa(pdnce->hContact, pdnce->szProto, "XStatusMsg")); if (tszXStatusMsg != nullptr && tszXStatusMsg[0] != 0) { wchar_t *tmp = NEWWSTR_ALLOCA(text); mir_snwprintf(text, text_size, L"%s: %s", tmp, tszXStatusMsg); CopySkipUnprintableChars(text, text, text_size - 1); } } return TEXT_STATUS; case TEXT_NICKNAME: if (pdnce->hContact && pdnce->szProto) { ptrW tszNick(db_get_wsa(pdnce->hContact, pdnce->szProto, "Nick")); if (tszNick != nullptr) { mir_wstrncpy(text, tszNick, text_size); CopySkipUnprintableChars(text, text, text_size - 1); } } return TEXT_NICKNAME; case TEXT_STATUS_MESSAGE: if (GetStatusMessage(text, text_size, pdnce, line.xstatus_has_priority) == -1 && line.use_name_and_message_for_xstatus) { // Try to get XStatusName ptrW tszXStatusName(db_get_wsa(pdnce->hContact, pdnce->szProto, "XStatusName")); if (tszXStatusName != nullptr && tszXStatusName[0] != 0) { wchar_t *tmp = NEWWSTR_ALLOCA(text); mir_snwprintf(text, text_size, L"%s: %s", tszXStatusName, tmp); CopySkipUnprintableChars(text, text, text_size - 1); } } else if (line.use_name_and_message_for_xstatus && line.xstatus_has_priority) { // Try to get XStatusName ptrW tszXStatusName(db_get_wsa(pdnce->hContact, pdnce->szProto, "XStatusName")); if (tszXStatusName != nullptr && tszXStatusName[0] != 0) { mir_wstrncpy(text, tszXStatusName, text_size); CopySkipUnprintableChars(text, text, text_size - 1); } } if (text[0] == '\0') { if (line.show_listening_if_no_away) { GetListeningTo(text, text_size, pdnce); if (text[0] != '\0') return TEXT_LISTENING_TO; } if (line.show_status_if_no_away) // re-request status if no away goto LBL_Status; } return TEXT_STATUS_MESSAGE; case TEXT_LISTENING_TO: GetListeningTo(text, text_size, pdnce); return TEXT_LISTENING_TO; case TEXT_TEXT: { ptrW tmp(variables_parsedup(line.text, pdnce->tszName, pdnce->hContact)); mir_wstrncpy(text, tmp, text_size); CopySkipUnprintableChars(text, text, text_size - 1); } return TEXT_TEXT; case TEXT_CONTACT_TIME: if (pdnce->hTimeZone) { // Get pdnce time text[0] = 0; TimeZone_PrintDateTime(pdnce->hTimeZone, L"t", text, text_size, 0); } return TEXT_CONTACT_TIME; } return TEXT_EMPTY; }