void CDropbox::CommandDelete(void *arg) { CommandParam *param = (CommandParam*)arg; char *path = (char*)param->data; if (path == NULL) { CMStringA error(FORMAT, T2Utf(TranslateT("\"%s\" command has invalid parameter.\nUse \"/help\" for more info.")), "/delete"); ProtoBroadcastAck(MODULE, param->hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, param->hProcess, 0); CallContactService(param->instance->GetDefaultContact(), PSR_MESSAGE, 0, (LPARAM)error.GetBuffer()); return; } ptrA token(db_get_sa(NULL, MODULE, "TokenSecret")); ptrA encodedPath(mir_utf8encode(path)); DeleteRequest request(token, encodedPath); NLHR_PTR response(request.Send(param->instance->hNetlibConnection)); if (response == NULL || response->resultCode != HTTP_STATUS_OK) { ProtoBroadcastAck(MODULE, param->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, param->hProcess, 0); return; } JSONNode root = JSONNode::parse(response->pData); if (root.empty()) { ProtoBroadcastAck(MODULE, param->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, param->hProcess, 0); return; } bool isDeleted = root.at("is_deleted").as_bool(); CMStringA message(FORMAT, "%s %s", path, !isDeleted ? T2Utf(TranslateT("is not deleted")) : T2Utf(TranslateT("is deleted"))); ProtoBroadcastAck(MODULE, param->hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, param->hProcess, 0); CallContactService(param->instance->GetDefaultContact(), PSR_MESSAGE, 0, (LPARAM)message.GetBuffer()); }
int CAimProto::OnGroupChange(WPARAM hContact, LPARAM lParam) { if (m_state != 1 || !getByte(AIM_KEY_MG, 1)) return 0; CLISTGROUPCHANGE *grpchg = (CLISTGROUPCHANGE*)lParam; if (hContact == NULL) { if (grpchg->pszNewName == NULL && grpchg->pszOldName != NULL) { T2Utf szOldName(grpchg->pszOldName); unsigned short group_id = m_group_list.find_id(szOldName); if (group_id) { aim_delete_contact(m_hServerConn, m_seqno, szOldName, 0, group_id, 1, false); m_group_list.remove_by_id(group_id); update_server_group("", 0); } } else if (grpchg->pszNewName != NULL && grpchg->pszOldName != NULL) { unsigned short group_id = m_group_list.find_id(T2Utf(grpchg->pszOldName)); if (group_id) update_server_group(T2Utf(grpchg->pszNewName), group_id); } } else { if (is_my_contact(hContact) && getBuddyId(hContact, 1) && !db_get_b(hContact, MOD_KEY_CL, AIM_KEY_NL, 0)) { if (grpchg->pszNewName) add_contact_to_group(hContact, T2Utf(grpchg->pszNewName)); else add_contact_to_group(hContact, AIM_DEFAULT_GROUP); } } return 0; }
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 CDropbox::CommandHelp(void *arg) { CommandParam *param = (CommandParam*)arg; CMStringA help = (char*)T2Utf(TranslateT("Dropbox supports the following commands:")); help += "\n"; help += "\"/content [dir]\" \t- "; help += T2Utf(TranslateT("shows all files in folder \"dir\" (\"dir\" can be omitted for root folder)")); help += "\n"; help += "\"/share <path>\" \t- "; help += T2Utf(TranslateT("returns download link for file or folder with specified path (\"path\" is relative from root folder)")); help += "\n"; help += "\"/delete <path>\" \t- "; help += T2Utf(TranslateT("deletes file or folder with specified path (\"path\" is relative from root folder)")); ProtoBroadcastAck(MODULE, param->hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, param->hProcess, 0); CallContactService(param->instance->GetDefaultContact(), PSR_MESSAGE, 0, (LPARAM)help.GetBuffer()); }
int _DebugTraceW(const wchar_t *fmt, ...) { wchar_t debug[2048]; int ibsize = 2047; SYSTEMTIME st; va_list va; char tszTime[50]; va_start(va, fmt); GetLocalTime(&st); mir_snprintf(tszTime, "%02d.%02d.%04d - %02d:%02d:%02d.%04d: ", st.wDay, st.wMonth, st.wYear, st.wHour, st.wMinute, st.wSecond, st.wMilliseconds); mir_vsntprintf(debug, ibsize - 10, fmt, va); //#ifdef _DEBUG OutputDebugStringW(debug); //#else { char szLogFileName[MAX_PATH], szDataPath[MAX_PATH]; FILE *f; CallService(MS_DB_GETPROFILEPATH, MAX_PATH, (LPARAM)szDataPath); mir_snprintf(szLogFileName, "%s\\%s", szDataPath, "tabsrmm_debug.log"); f = fopen(szLogFileName, "a+"); if (f) { fputs(tszTime, f); fputs(T2Utf(debug), f); fputs("\n", f); fclose(f); } } //#endif return 0; }
void CDropbox::CommandShare(void *arg) { CommandParam *param = (CommandParam*)arg; char *path = (char*)param->data; if (path == NULL) { CMStringA error(FORMAT, T2Utf(TranslateT("\"%s\" command has invalid parameter.\nUse \"/help\" for more info.")), "/share"); ProtoBroadcastAck(MODULE, param->hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, param->hProcess, 0); CallContactService(param->instance->GetDefaultContact(), PSR_MESSAGE, 0, (LPARAM)error.GetBuffer()); return; } ptrA token(db_get_sa(NULL, MODULE, "TokenSecret")); ptrA encodedPath(mir_utf8encode(path)); bool useShortUrl = db_get_b(NULL, MODULE, "UseSortLinks", 1) > 0; ShareRequest request(token, encodedPath, useShortUrl); NLHR_PTR response(request.Send(param->instance->hNetlibConnection)); if (response == NULL || response->resultCode != HTTP_STATUS_OK) { ProtoBroadcastAck(MODULE, param->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, param->hProcess, 0); return; } JSONNode root = JSONNode::parse(response->pData); if (root.empty()) { ProtoBroadcastAck(MODULE, param->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, param->hProcess, 0); return; } CMStringA link = root.at("url").as_string().c_str(); ProtoBroadcastAck(MODULE, param->hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, param->hProcess, 0); CallContactService(param->instance->GetDefaultContact(), PSR_MESSAGE, 0, (LPARAM)link.GetBuffer()); }
HANDLE GGPROTO::SearchBasic(const TCHAR *id) { if (!isonline()) return 0; gg_pubdir50_t req = gg_pubdir50_new(GG_PUBDIR50_SEARCH); if (!req) { #ifdef DEBUGMODE debugLogA("SearchBasic(): ForkThread 10 GGPROTO::searchthread"); #endif ForkThread(&GGPROTO::searchthread, NULL); return (HANDLE)1; } // Add uin and search it gg_pubdir50_add(req, GG_PUBDIR50_UIN, T2Utf(id)); gg_pubdir50_seq_set(req, GG_SEQ_SEARCH); gg_EnterCriticalSection(&sess_mutex, "SearchBasic", 50, "sess_mutex", 1); if (!gg_pubdir50(sess, req)) { gg_LeaveCriticalSection(&sess_mutex, "SearchBasic", 50, 1, "sess_mutex", 1); #ifdef DEBUGMODE debugLogA("SearchBasic(): ForkThread 11 GGPROTO::searchthread"); #endif ForkThread(&GGPROTO::searchthread, NULL); return (HANDLE)1; } gg_LeaveCriticalSection(&sess_mutex, "SearchBasic", 50, 2, "sess_mutex", 1); debugLogA("SearchBasic(): Seq %d.", req->seq); gg_pubdir50_free(req); return (HANDLE)1; }
static int lua_FindIterator(lua_State *L) { HANDLE hFind = lua_touserdata(L, lua_upvalueindex(1)); TCHAR* path = (TCHAR*)lua_touserdata(L, lua_upvalueindex(2)); WIN32_FIND_DATA ffd = { 0 }; if (hFind == NULL) { hFind = FindFirstFile(path, &ffd); if (hFind == INVALID_HANDLE_VALUE) { mir_free(path); lua_pushnil(L); return 1; } } else { if (FindNextFile(hFind, &ffd) == 0) { FindClose(hFind); mir_free(path); lua_pushnil(L); return 1; } } if (!mir_tstrcmpi(ffd.cFileName, _T(".")) || !mir_tstrcmpi(ffd.cFileName, _T("..")) || (ffd.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)) { lua_pushlightuserdata(L, hFind); lua_replace(L, lua_upvalueindex(1)); return lua_FindIterator(L); } LARGE_INTEGER size; size.HighPart = ffd.nFileSizeHigh; size.LowPart = ffd.nFileSizeLow; lua_newtable(L); lua_pushliteral(L, "Name"); lua_pushstring(L, T2Utf(ffd.cFileName)); lua_settable(L, -3); lua_pushliteral(L, "Size"); lua_pushinteger(L, size.QuadPart); lua_settable(L, -3); lua_pushliteral(L, "IsFile"); lua_pushboolean(L, !(ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)); lua_settable(L, -3); lua_pushliteral(L, "IsDirectory"); lua_pushboolean(L, ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY); lua_settable(L, -3); lua_pushlightuserdata(L, hFind); lua_replace(L, lua_upvalueindex(1)); return 1; }
INT_PTR CALLBACK ChatRequestDialog(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { InviteChatReqParam* param = (InviteChatReqParam*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); switch (uMsg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam); param = (InviteChatReqParam*)lParam; Window_SetIcon_IcoLib(hwndDlg, GetIconHandle(IDI_YAHOO)); SetDlgItemTextA(hwndDlg, IDC_SCREENNAME, param->who); SetDlgItemText(hwndDlg, IDC_MSG, param->msg); SetDlgItemText(hwndDlg, IDC_MSG2, TranslateT("No, thank you...")); break; case WM_CLOSE: DestroyWindow(hwndDlg); break; case WM_NCDESTROY: Window_FreeIcon_IcoLib(hwndDlg); delete param; break; case WM_COMMAND: { CYahooProto::ChatRoom *cm = param->ppro->m_chatrooms.find((CYahooProto::ChatRoom*)¶m->room); switch (LOWORD(wParam)) { case IDOK: if (cm) { param->ppro->ChatStart(param->room); for (YList *l = cm->members; l; l = l->next) param->ppro->ChatEvent(param->room, (char*)l->data, GC_EVENT_JOIN); yahoo_conference_logon(param->ppro->m_id, NULL, cm->members, param->room); } DestroyWindow(hwndDlg); break; case IDCANCEL: if (cm) { TCHAR msg[1024]; GetDlgItemText(hwndDlg, IDC_MSG2, msg, _countof(msg)); yahoo_conference_decline(param->ppro->m_id, NULL, cm->members, param->room, T2Utf(msg)); param->ppro->m_chatrooms.remove((CYahooProto::ChatRoom*)¶m->room); } DestroyWindow(hwndDlg); break; } } break; } return FALSE; }
void CDropbox::CommandContent(void *arg) { CommandParam *param = (CommandParam*)arg; char *path = (char*)param->data; if (path == NULL) path = ""; ptrA token(db_get_sa(NULL, MODULE, "TokenSecret")); ptrA encodedPath(mir_utf8encode(path)); GetMetadataRequest request(token, encodedPath); NLHR_PTR response(request.Send(param->instance->hNetlibConnection)); if (response == NULL || response->resultCode != HTTP_STATUS_OK) { ProtoBroadcastAck(MODULE, param->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, param->hProcess, 0); return; } JSONNode root = JSONNode::parse(response->pData); if (root.empty()) { ProtoBroadcastAck(MODULE, param->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, param->hProcess, 0); return; } CMStringA message; bool isDir = root.at("is_dir").as_bool(); if (!isDir) message.AppendFormat("\"%s\" %s", encodedPath, T2Utf(TranslateT("is file"))); else { JSONNode content = root.at("contents").as_array(); for (size_t i = 0; i < content.size(); i++) { JSONNode item = content[i]; if (item.empty()) { if (i == 0) message.AppendFormat("\"%s\" %s", encodedPath, T2Utf(TranslateT("is empty"))); break; } CMStringA subName(item.at("path").as_string().c_str()); message.AppendFormat("%s\n", (subName[0] == '/') ? subName.Mid(1) : subName); } } ProtoBroadcastAck(MODULE, param->hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, param->hProcess, 0); CallContactService(param->instance->GetDefaultContact(), PSR_MESSAGE, 0, (LPARAM)message.GetBuffer()); }
static int core_Translate(lua_State *L) { char *what = (char*)luaL_checkstring(L, 1); ptrT value(mir_utf8decodeT(what)); lua_pushstring(L, T2Utf(TranslateW_LP(value, hLangpack))); return 1; }
static int core_ReplaceVariables(lua_State *L) { char *what = (char*)luaL_checkstring(L, 1); ptrT value(mir_utf8decodeT(what)); lua_pushstring(L, T2Utf(VARST(value))); return 1; }
int CSkypeProto::AuthRequest(MCONTACT hContact, const TCHAR *szMessage) { if (hContact == INVALID_CONTACT_ID) return 1; ptrA token(getStringA("TokenSecret")); ptrA skypename(getStringA(hContact, SKYPE_SETTINGS_ID)); PushRequest(new AddContactRequest(li, skypename, T2Utf(szMessage))); return 0; }
static bool CheckOldPassword(HWND hwndDlg, CDb3Mmap *db) { if (db->usesPassword()) { TCHAR buf[100]; GetDlgItemText(hwndDlg, IDC_OLDPASS, buf, _countof(buf)); if (!db->m_crypto->checkPassword(T2Utf(buf))) { SetDlgItemText(hwndDlg, IDC_HEADERBAR, TranslateT("Wrong old password entered!")); return false; } } return true; }
void CDb3Mmap::SetPassword(LPCTSTR ptszPassword) { if (ptszPassword == NULL || *ptszPassword == 0) { m_bUsesPassword = false; m_crypto->setPassword(NULL); } else { m_bUsesPassword = true; m_crypto->setPassword(T2Utf(ptszPassword)); } UpdateMenuItem(); }
MCONTACT WhatsAppProto::AddToList(int flags, PROTOSEARCHRESULT *psr) { if (psr->id.t == NULL) return NULL; std::string phone(T2Utf(psr->id.t)); std::string jid(phone + "@s.whatsapp.net"); MCONTACT hContact = AddToContactList(jid, phone.c_str()); if (!(flags & PALF_TEMPORARY)) db_unset(hContact, "CList", "NotOnList"); m_pConnection->sendPresenceSubscriptionRequest(jid.c_str()); return hContact; }
static int lua_Parse(lua_State *L) { if (!ServiceExists(MS_VARS_FORMATSTRING)) { lua_pushvalue(L, 1); return 1; } ptrT format(mir_utf8decodeT(luaL_checkstring(L, 1))); MCONTACT hContact = lua_tointeger(L, 2); TCHAR *res = variables_parse_ex(format, NULL, hContact, NULL, 0); lua_pushstring(L, T2Utf(res)); return 1; }
INT_PTR __cdecl WhatsAppProto::OnCreateGroup(WPARAM wParam, LPARAM lParam) { ENTER_STRING es = { 0 }; es.cbSize = sizeof(es); es.type = ESF_MULTILINE; es.caption = _T("Enter a subject for new group"); es.szModuleName = m_szModuleName; if (EnterString(&es)) { if (isOnline()) { std::string groupName(T2Utf(es.ptszResult)); m_pConnection->sendCreateGroupChat(groupName); } mir_free(es.ptszResult); } return FALSE; }
bool CDb3Mmap::EnterPassword(const BYTE *pKey, const size_t keyLen) { DlgChangePassParam param = { this }; while (true) { // Esc pressed if (IDOK != DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_LOGIN), 0, sttEnterPassword, (LPARAM)¶m)) return false; m_crypto->setPassword(T2Utf(param.newPass)); if (m_crypto->setKey(pKey, keyLen)) { m_bUsesPassword = true; SecureZeroMemory(¶m, sizeof(param)); return true; } param.wrongPass++; } }
// PSS_AUTHREQUEST int __cdecl CMsnProto::AuthRequest(MCONTACT hContact, const TCHAR* szMessage) { if (msnLoggedIn) { char email[MSN_MAX_EMAIL_LEN]; if (db_get_static(hContact, m_szModuleName, "wlid", email, sizeof(email)) && db_get_static(hContact, m_szModuleName, "e-mail", email, sizeof(email))) return 1; int netId = strncmp(email, "tel:", 4) == 0 ? NETID_MOB : (strncmp(email, "live:", 5) == 0 ? NETID_SKYPE : NETID_MSN); if (MSN_AddUser(hContact, email, netId, LIST_FL, T2Utf(szMessage))) { MSN_AddUser(hContact, email, netId, LIST_PL + LIST_REMOVE); MSN_AddUser(hContact, email, netId, LIST_BL + LIST_REMOVE); MSN_AddUser(hContact, email, netId, LIST_AL); } MSN_SetContactDb(hContact, email); if (MSN_IsMeByContact(hContact)) displayEmailCount(hContact); return 0; } return 1; }
INT_PTR StoreVersionInfoToFile(WPARAM, LPARAM lParam) { CreateDirectoryTree(VersionInfoFolder); TCHAR path[MAX_PATH]; mir_sntprintf(path, TEXT("%s\\VersionInfo.txt"), VersionInfoFolder); HANDLE hDumpFile = CreateFile(path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if (hDumpFile != INVALID_HANDLE_VALUE) { CMString buffer; PrintVersionInfo(buffer, (unsigned int)lParam | VI_FLAG_PRNVAR); WriteUtfFile(hDumpFile, T2Utf(buffer.c_str())); CloseHandle(hDumpFile); ShowMessage(3, TranslateT("Version Info stored into file %s"), path); } else ShowMessage(2, TranslateT("Version Info file %s is inaccessible"), path); return 0; }
HWND CToxProto::OnSearchAdvanced(HWND owner) { if (!IsOnline()) { // we cannot add someone to friend list while tox is offline return NULL; } std::smatch match; std::regex regex("^\\s*([A-Fa-f0-9]{76})\\s*$"); TCHAR text[MAX_PATH]; GetDlgItemText(owner, IDC_SEARCH, text, _countof(text)); const std::string query = T2Utf(text).str(); if (std::regex_search(query, match, regex)) { std::string address = match[1]; PROTOSEARCHRESULT psr = { sizeof(psr) }; psr.id.a = mir_strdup(query.c_str()); ADDCONTACTSTRUCT acs = { HANDLE_SEARCHRESULT }; acs.szProto = m_szModuleName; acs.psr = &psr; CallService(MS_ADDCONTACT_SHOW, (WPARAM)owner, (LPARAM)&acs); ForkThread(&CToxProto::SearchFailedAsync, NULL); } else { regex = "^\\s*(([^ @/:;()\"']+)(@[A-Za-z]+.[A-Za-z]{2,6})?)\\s*$"; if (std::regex_search(query, match, regex)) ForkThread(&CToxProto::SearchByNameAsync, mir_strdup(query.c_str())); else ForkThread(&CToxProto::SearchFailedAsync, NULL); } return (HWND)1; }
bool CMLuaScript::Load() { if (luaL_loadfile(L, T2Utf(filePath))) { CallService(MS_NETLIB_LOG, (WPARAM)hNetlib, (LPARAM)lua_tostring(L, -1)); return false; } if (lua_pcall(L, 0, 1, 0)) { CallService(MS_NETLIB_LOG, (WPARAM)hNetlib, (LPARAM)lua_tostring(L, -1)); return false; } isLoaded = true; if (!lua_istable(L, -1)) return true; lua_pushliteral(L, "Load"); lua_gettable(L, -2); if (lua_isfunction(L, -1)) { if (lua_pcall(L, 0, 0, 0)) CallService(MS_NETLIB_LOG, (WPARAM)hNetlib, (LPARAM)lua_tostring(L, -1)); } else lua_pop(L, 1); lua_pushliteral(L, "Unload"); lua_gettable(L, -2); if (lua_isfunction(L, -1)) { lua_pushvalue(L, -1); unloadRef = luaL_ref(L, LUA_REGISTRYINDEX); } lua_pop(L, 1); return true; }
int CMsnProto::OnGroupChange(WPARAM hContact, LPARAM lParam) { if (!msnLoggedIn || !MyOptions.ManageServer) return 0; const CLISTGROUPCHANGE* grpchg = (CLISTGROUPCHANGE*)lParam; if (hContact == NULL) { if (grpchg->pszNewName == NULL && grpchg->pszOldName != NULL) { LPCSTR szId = MSN_GetGroupByName(UTF8(grpchg->pszOldName)); if (szId != NULL) MSN_DeleteServerGroup(szId); } else if (grpchg->pszNewName != NULL && grpchg->pszOldName != NULL) { LPCSTR szId = MSN_GetGroupByName(UTF8(grpchg->pszOldName)); if (szId != NULL) MSN_RenameServerGroup(szId, UTF8(grpchg->pszNewName)); } } else { if (MSN_IsMyContact(hContact)) MSN_MoveContactToGroup(hContact, T2Utf(grpchg->pszNewName)); } return 0; }
bool CMLuaScript::Load() { status = Failed; if (luaL_loadfile(L, T2Utf(filePath))) { Log(lua_tostring(L, -1)); return false; } lua_createtable(L, 0, 2); lua_pushvalue(L, -1); lua_setfield(L, -2, "_G"); lua_pushlightuserdata(L, this); lua_setfield(L, -2, "Script"); lua_createtable(L, 0, 2); lua_getglobal(L, "_G"); lua_setfield(L, -2, "__index"); lua_setmetatable(L, -2); lua_setupvalue(L, -2, 1); if (luaM_pcall(L, 0, 1)) return false; status = Loaded; if (lua_isnoneornil(L, -1)) return true; luaL_getsubtable(L, LUA_REGISTRYINDEX, "_LOADED"); lua_getfield(L, -1, moduleName); if (!lua_toboolean(L, -1)) { lua_pop(L, 1); lua_pushvalue(L, -2); lua_setfield(L, -2, moduleName); lua_pop(L, 1); } else lua_remove(L, -2); if (!lua_istable(L, -1)) return true; lua_getfield(L, -1, "Load"); if (lua_isfunction(L, -1)) luaM_pcall(L); else lua_pop(L, 1); lua_getfield(L, -1, "Unload"); if (lua_isfunction(L, -1)) { lua_pushvalue(L, -1); unloadRef = luaL_ref(L, LUA_REGISTRYINDEX); } lua_pop(L, 1); lua_pop(L, 1); return true; }
INT_PTR CALLBACK FBMindProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) { post_status_data *data; switch (message) { case WM_INITDIALOG: { TranslateDialogDefault(hwnd); SendMessage(hwnd, WM_SETICON, ICON_SMALL, (LPARAM)IcoLib_GetIconByHandle(GetIconHandle("mind"))); data = reinterpret_cast<post_status_data*>(lparam); SetWindowLongPtr(hwnd, GWLP_USERDATA, lparam); SendDlgItemMessage(hwnd, IDC_MINDMSG, EM_LIMITTEXT, FACEBOOK_MIND_LIMIT, 0); SendDlgItemMessage(hwnd, IDC_URL, EM_LIMITTEXT, 1024, 0); ptrT place(data->proto->getTStringA(FACEBOOK_KEY_PLACE)); SetDlgItemText(hwnd, IDC_PLACE, place != NULL ? place : _T("Miranda NG")); bShowContacts = data->proto->getByte("PostStatusExpand", 0) > 0; ResizeHorizontal(hwnd, bShowContacts); HWND hwndClist = GetDlgItem(hwnd, IDC_CCLIST); SetWindowLongPtr(hwndClist, GWL_STYLE, GetWindowLongPtr(hwndClist, GWL_STYLE) & ~CLS_HIDEOFFLINE); for (std::vector<wall_data*>::size_type i = 0; i < data->walls.size(); i++) SendDlgItemMessage(hwnd, IDC_WALL, CB_INSERTSTRING, i, reinterpret_cast<LPARAM>(data->walls[i]->title)); SendDlgItemMessage(hwnd, IDC_WALL, CB_SETCURSEL, 0, 0); SendDlgItemMessage(hwnd, IDC_WALL, CB_SETCURSEL, data->proto->getByte(FACEBOOK_KEY_LAST_WALL, 0), 0); RefreshPrivacy(hwnd, data); ptrA firstname(data->proto->getStringA(FACEBOOK_KEY_FIRST_NAME)); if (firstname != NULL) { char title[100]; mir_snprintf(title, Translate("What's on your mind, %s?"), firstname); SetWindowTextA(hwnd, title); } } EnableWindow(GetDlgItem(hwnd, IDOK), FALSE); return TRUE; case WM_NOTIFY: { NMCLISTCONTROL *nmc = (NMCLISTCONTROL *)lparam; if (nmc->hdr.idFrom == IDC_CCLIST) { switch (nmc->hdr.code) { case CLN_LISTREBUILT: data = reinterpret_cast<post_status_data*>(GetWindowLongPtr(hwnd, GWLP_USERDATA)); ClistPrepare(data->proto, NULL, nmc->hdr.hwndFrom); break; } } } break; case WM_COMMAND: switch (LOWORD(wparam)) { case IDC_WALL: if (HIWORD(wparam) == CBN_SELCHANGE) { data = reinterpret_cast<post_status_data*>(GetWindowLongPtr(hwnd, GWLP_USERDATA)); RefreshPrivacy(hwnd, data); } break; case IDC_MINDMSG: case IDC_URL: if (HIWORD(wparam) == EN_CHANGE) { bool ok = SendDlgItemMessage(hwnd, IDC_MINDMSG, WM_GETTEXTLENGTH, 0, 0) > 0; if (!ok && SendDlgItemMessage(hwnd, IDC_URL, WM_GETTEXTLENGTH, 0, 0) > 0) ok = true; EnableWindow(GetDlgItem(hwnd, IDOK), ok); return TRUE; } break; case IDC_EXPAND: bShowContacts = !bShowContacts; ResizeHorizontal(hwnd, bShowContacts); break; case IDOK: { data = reinterpret_cast<post_status_data*>(GetWindowLongPtr(hwnd, GWLP_USERDATA)); TCHAR mindMessageT[FACEBOOK_MIND_LIMIT + 1]; TCHAR urlT[1024]; TCHAR placeT[100]; GetDlgItemText(hwnd, IDC_MINDMSG, mindMessageT, _countof(mindMessageT)); GetDlgItemText(hwnd, IDC_PLACE, placeT, _countof(placeT)); GetDlgItemText(hwnd, IDC_URL, urlT, _countof(urlT)); ShowWindow(hwnd, SW_HIDE); int wall_id = SendDlgItemMessage(hwnd, IDC_WALL, CB_GETCURSEL, 0, 0); int privacy_id = SendDlgItemMessage(hwnd, IDC_PRIVACY, CB_GETCURSEL, 0, 0); data->proto->setTString(FACEBOOK_KEY_PLACE, placeT); data->proto->setByte("PostStatusExpand", bShowContacts); // remember last wall, only when there are more options if (SendDlgItemMessage(hwnd, IDC_WALL, CB_GETCOUNT, 0, 0) > 1) data->proto->setByte(FACEBOOK_KEY_LAST_WALL, wall_id); // remember last privacy, only when there are more options if (SendDlgItemMessage(hwnd, IDC_PRIVACY, CB_GETCOUNT, 0, 0) > 1) data->proto->setByte(FACEBOOK_KEY_PRIVACY_TYPE, privacy_id); status_data *status = new status_data(); status->user_id = data->walls[wall_id]->user_id; status->isPage = data->walls[wall_id]->isPage; status->privacy = privacy_types[privacy_id].id; status->place = T2Utf(placeT); status->url = _T2A(urlT); HWND hwndList = GetDlgItem(hwnd, IDC_CCLIST); GetSelectedContacts(data->proto, NULL, hwndList, &status->users); T2Utf narrow(mindMessageT); status->text = narrow; if (status->user_id == data->proto->facy.self_.user_id && data->proto->last_status_msg_ != (char*)narrow) data->proto->last_status_msg_ = narrow; data->proto->ForkThread(&FacebookProto::SetAwayMsgWorker, status); EndDialog(hwnd, wparam); return TRUE; } case IDCANCEL: EndDialog(hwnd, wparam); return TRUE; } break; case WM_DESTROY: data = reinterpret_cast<post_status_data*>(GetWindowLongPtr(hwnd, GWLP_USERDATA)); for (std::vector<wall_data*>::size_type i = 0; i < data->walls.size(); i++) { mir_free(data->walls[i]->title); delete data->walls[i]; } delete data; } return FALSE; }
HANDLE CSametimeProto::SendFilesToUser(MCONTACT hContact, TCHAR** files, const TCHAR* ptszDesc) { debugLog(_T("CSametimeProto::SendFilesToUser() start")); mwAwareIdBlock id_block; if (GetAwareIdFromContact(hContact, &id_block)) { mwIdBlock idb; idb.user = id_block.user; idb.community = id_block.community; FileTransferClientData *ftcd, *prev_ftcd = 0, *first_ftcd = 0; mwFileTransfer *ft, *first_ft = 0; for (int i = 0; files[i]; i++) { HANDLE hFile = CreateFile(files[i], GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0); if (hFile != INVALID_HANDLE_VALUE) { DWORD filesize = GetFileSize(hFile, 0); TCHAR *fn = _tcsrchr(files[i], '\\'); if (fn) fn++; else fn = files[i]; ft = mwFileTransfer_new(service_files, &idb, T2Utf(ptszDesc), T2Utf(fn), filesize); ftcd = new FileTransferClientData; memset(ftcd, 0, sizeof(FileTransferClientData)); ftcd->ft = ft; ftcd->hContact = hContact; ftcd->next = 0; if (prev_ftcd) { prev_ftcd->next = ftcd; // link into list // each node contains a pointer to the first - it will contain infor linke the count etc ftcd->first = prev_ftcd->first; } else ftcd->first = ftcd; if (!first_ft) first_ft = ft; ftcd->sending = true; ftcd->hFile = hFile; ftcd->hFt = (HANDLE)first_ft; ftcd->save_path = 0; ftcd->buffer = new char[FILE_BUFF_SIZE]; ftcd->ft_number = ftcd->first->ft_count; ftcd->first->ft_count++; ftcd->sizeToHere = ftcd->first->totalSize; ftcd->first->totalSize += filesize; mwFileTransfer_setClientData(ft, (gpointer)ftcd, 0); prev_ftcd = ftcd; } } free(id_block.user); if (first_ft) { mwFileTransfer_offer(first_ft); return (HANDLE)first_ft; } } return 0; }
void __cdecl CJabberProto::FileServerThread(filetransfer *ft) { debugLogA("Thread started: type=file_send"); ThreadData info(this, NULL); ft->type = FT_OOB; NETLIBBIND nlb = { 0 }; nlb.cbSize = sizeof(NETLIBBIND); nlb.pfnNewConnectionV2 = JabberFileServerConnection; nlb.pExtra = this; nlb.wPort = 0; // Use user-specified incoming port ranges, if available info.s = (HANDLE)CallService(MS_NETLIB_BINDPORT, (WPARAM)m_hNetlibUser, (LPARAM)&nlb); if (info.s == NULL) { debugLogA("Cannot allocate port to bind for file server thread, thread ended."); ProtoBroadcastAck(ft->std.hContact, ACKTYPE_FILE, ACKRESULT_FAILED, ft, 0); delete ft; return; } ft->s = info.s; debugLogA("ft->s = %d", info.s); HANDLE hEvent = CreateEvent(NULL, FALSE, FALSE, NULL); ft->hFileEvent = hEvent; TCHAR szPort[20]; mir_sntprintf(szPort, _countof(szPort), _T("%d"), nlb.wPort); JABBER_LIST_ITEM *item = ListAdd(LIST_FILE, szPort); item->ft = ft; TCHAR *ptszResource = ListGetBestClientResourceNamePtr(ft->jid); if (ptszResource != NULL) { ft->state = FT_CONNECTING; for (int i = 0; i < ft->std.totalFiles && ft->state != FT_ERROR && ft->state != FT_DENIED; i++) { ft->std.currentFileNumber = i; ft->state = FT_CONNECTING; if (ft->httpPath) mir_free(ft->httpPath); ft->httpPath = NULL; TCHAR *p; if ((p = _tcschr(ft->std.ptszFiles[i], '\\')) != NULL) p++; else p = ft->std.ptszFiles[i]; ptrA pFileName(mir_urlEncode(T2Utf(p))); if (pFileName != NULL) { ft->szId = JabberId2string(SerialNext()); ptrA myAddr; if (m_options.BsDirect && m_options.BsDirectManual) myAddr = getStringA("BsDirectAddr"); if (myAddr == NULL) myAddr = (char*)CallService(MS_NETLIB_ADDRESSTOSTRING, 1, nlb.dwExternalIP); char szAddr[256]; mir_snprintf(szAddr, _countof(szAddr), "http://%s:%d/%s", myAddr, nlb.wPort, pFileName); size_t len = mir_tstrlen(ptszResource) + mir_tstrlen(ft->jid) + 2; TCHAR *fulljid = (TCHAR *)alloca(sizeof(TCHAR) * len); mir_sntprintf(fulljid, len, _T("%s/%s"), ft->jid, ptszResource); XmlNodeIq iq(_T("set"), ft->szId, fulljid); HXML query = iq << XQUERY(JABBER_FEAT_OOB); query << XCHILD(_T("url"), _A2T(szAddr)); query << XCHILD(_T("desc"), ft->szDescription); m_ThreadInfo->send(iq); debugLogA("Waiting for the file to be sent..."); WaitForSingleObject(hEvent, INFINITE); } debugLogA("File sent, advancing to the next file..."); ProtoBroadcastAck(ft->std.hContact, ACKTYPE_FILE, ACKRESULT_NEXTFILE, ft, 0); } CloseHandle(hEvent); ft->hFileEvent = NULL; debugLogA("Finish all files"); } ft->s = NULL; debugLogA("ft->s is NULL"); ListRemove(LIST_FILE, szPort); switch (ft->state) { case FT_DONE: debugLogA("Finish successfully"); ProtoBroadcastAck(ft->std.hContact, ACKTYPE_FILE, ACKRESULT_SUCCESS, ft, 0); break; case FT_DENIED: ProtoBroadcastAck(ft->std.hContact, ACKTYPE_FILE, ACKRESULT_DENIED, ft, 0); break; default: // FT_ERROR: debugLogA("Finish with errors"); ProtoBroadcastAck(ft->std.hContact, ACKTYPE_FILE, ACKRESULT_FAILED, ft, 0); break; } debugLogA("Thread ended: type=file_send"); delete ft; }
static INT_PTR CALLBACK DlgProcOptNet(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { CSametimeProto* proto = (CSametimeProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); switch (msg) { case WM_INITDIALOG: { TranslateDialogDefault(hwndDlg); SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam); proto = (CSametimeProto*)lParam; WORD client_ver = proto->GetClientVersion(); if (client_ver) { TCHAR verbuf[100]; mir_sntprintf(verbuf, _countof(verbuf), TranslateT("Client protocol version: %03d.%03d"), (client_ver & 0xFF00) >> 8, client_ver & 0xFF); SetDlgItemText(hwndDlg, IDC_ST_CLIENTVER, verbuf); } WORD server_ver = proto->GetServerVersion(); if (server_ver) { TCHAR verbuf[100]; mir_sntprintf(verbuf, _countof(verbuf), TranslateT("Server protocol version: %03d.%03d"), (server_ver & 0xFF00) >> 8, server_ver & 0xFF); SetDlgItemText(hwndDlg, IDC_ST_SERVERVER, verbuf); } TCHAR *s = mir_utf8decodeT(proto->options.server_name); SetDlgItemText(hwndDlg, IDC_ED_SNAME, s); mir_free(s); s = mir_utf8decodeT(proto->options.id); SetDlgItemText(hwndDlg, IDC_ED_NAME, s); mir_free(s); s = mir_utf8decodeT(proto->options.pword); SetDlgItemText(hwndDlg, IDC_ED_PWORD, s); mir_free(s); SetDlgItemInt(hwndDlg, IDC_ED_PORT, proto->options.port, FALSE); CheckDlgButton(hwndDlg, IDC_CHK_GETSERVERCONTACTS, proto->options.get_server_contacts ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_CHK_ADDCONTACTS, proto->options.add_contacts ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_CHK_IDLEAWAY, proto->options.idle_as_away ? BST_CHECKED : BST_UNCHECKED); SendDlgItemMessage(hwndDlg, IDC_CMB_CLIENT, CB_RESETCONTENT, 0, 0); int pos = 0; bool found = false; for (int i = 0; i < NUM_IDS; i++) { pos = SendDlgItemMessage(hwndDlg, IDC_CMB_CLIENT, CB_ADDSTRING, -1, (LPARAM)client_names[i]); SendDlgItemMessage(hwndDlg, IDC_CMB_CLIENT, CB_SETITEMDATA, pos, client_ids[i]); if (client_ids[i] == proto->options.client_id) { found = true; SendDlgItemMessage(hwndDlg, IDC_CMB_CLIENT, CB_SETCURSEL, pos, 0); SetDlgItemInt(hwndDlg, IDC_ED_CLIENTID, client_ids[i], FALSE); if (i != sizeof(client_ids) / sizeof(int)-1) { HWND hw = GetDlgItem(hwndDlg, IDC_ED_CLIENTID); EnableWindow(hw, false); } } } if (!found) { SendDlgItemMessage(hwndDlg, IDC_CMB_CLIENT, CB_SETCURSEL, pos, 0); // pos is last item, i.e. custom SetDlgItemInt(hwndDlg, IDC_ED_CLIENTID, proto->options.client_id, FALSE); } SendDlgItemMessage(hwndDlg, IDC_CMB_CLIENTVN, CB_RESETCONTENT, 0, 0); pos = 0; for (int i = 0; i < NUM_CVS; i++) { pos = SendDlgItemMessage(hwndDlg, IDC_CMB_CLIENTVN, CB_ADDSTRING, -1, (LPARAM)CV_names[i]); SendDlgItemMessage(hwndDlg, IDC_CMB_CLIENTVN, CB_SETITEMDATA, pos, i); if (CV_major[i] == proto->options.client_versionMajor && CV_minor[i] == proto->options.client_versionMinor) { found = true; SendDlgItemMessage(hwndDlg, IDC_CMB_CLIENTVN, CB_SETCURSEL, pos, 0); } } if (!ServiceExists(MS_POPUP_ADDPOPUPT)) { HWND hw = GetDlgItem(hwndDlg, IDC_RAD_ERRPOP); EnableWindow(hw, FALSE); } if (!ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)) { HWND hw = GetDlgItem(hwndDlg, IDC_RAD_ERRBAL); EnableWindow(hw, FALSE); } switch (proto->options.err_method) { case ED_POP: CheckDlgButton(hwndDlg, IDC_RAD_ERRPOP, BST_CHECKED); break; case ED_MB: CheckDlgButton(hwndDlg, IDC_RAD_ERRMB, BST_CHECKED); break; case ED_BAL: CheckDlgButton(hwndDlg, IDC_RAD_ERRBAL, BST_CHECKED); break; } if (proto->options.encrypt_session) CheckDlgButton(hwndDlg, IDC_RAD_ENC, BST_CHECKED); else CheckDlgButton(hwndDlg, IDC_RAD_NOENC, BST_CHECKED); return FALSE; } case WM_COMMAND: if (HIWORD(wParam) == EN_CHANGE && (HWND)lParam == GetFocus()) SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); if (HIWORD(wParam) == CBN_SELCHANGE) { switch (LOWORD(wParam)) { case IDC_CMB_CLIENT: { int sel = SendDlgItemMessage(hwndDlg, IDC_CMB_CLIENT, CB_GETCURSEL, 0, 0); int id = SendDlgItemMessage(hwndDlg, IDC_CMB_CLIENT, CB_GETITEMDATA, sel, 0); bool custom = (id == client_ids[sizeof(client_ids) / sizeof(int)-1]); if (!custom) SetDlgItemInt(hwndDlg, IDC_ED_CLIENTID, id, FALSE); else SetDlgItemInt(hwndDlg, IDC_ED_CLIENTID, DEFAULT_ID, FALSE); HWND hw = GetDlgItem(hwndDlg, IDC_ED_CLIENTID); EnableWindow(hw, custom); SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); return TRUE; } case IDC_CMB_CLIENTVN: { SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); return TRUE; } } } if (HIWORD(wParam) == BN_CLICKED) { switch (LOWORD(wParam)) { case IDC_BTN_UPLOADCONTACTS: { EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_UPLOADCONTACTS), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_IMPORTCONTACTS), FALSE); proto->ExportContactsToServer(); SendMessage(hwndDlg, WMU_STORECOMPLETE, 0, 0); } return TRUE; case IDC_BTN_IMPORTCONTACTS: { TCHAR import_filename[MAX_PATH]; import_filename[0] = 0; OPENFILENAME ofn = { 0 }; ofn.lStructSize = sizeof(ofn); ofn.lpstrFile = import_filename; ofn.hwndOwner = hwndDlg; ofn.Flags = CC_FULLOPEN; ofn.nMaxFile = MAX_PATH; ofn.lpstrFilter = _T("All\0*.*\0"); ofn.nFilterIndex = 1; ofn.lpstrFileTitle = NULL; ofn.nMaxFileTitle = 0; ofn.lpstrInitialDir = NULL; ofn.Flags = OFN_PATHMUSTEXIST; if (GetOpenFileName(&ofn) == TRUE) { HWND hBut = GetDlgItem(hwndDlg, IDC_BTN_UPLOADCONTACTS); EnableWindow(hBut, FALSE); hBut = GetDlgItem(hwndDlg, IDC_BTN_IMPORTCONTACTS); EnableWindow(hBut, FALSE); proto->ImportContactsFromFile(ofn.lpstrFile); SendMessage(hwndDlg, WMU_STORECOMPLETE, 0, 0); } } return TRUE; case IDC_CHK_GETSERVERCONTACTS: case IDC_CHK_ENCMESSAGES: case IDC_RAD_ERRMB: case IDC_RAD_ERRBAL: case IDC_RAD_ERRPOP: case IDC_CHK_USERCP: case IDC_CHK_ADDCONTACTS: case IDC_CHK_IDLEAWAY: case IDC_RAD_ENC: case IDC_RAD_NOENC: SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); return TRUE; case IDC_RAD_ANSI: case IDC_RAD_UTF8: case IDC_RAD_OEM: case IDC_RAD_UTF7: case IDC_RAD_USERCP: HWND hw = GetDlgItem(hwndDlg, IDC_CHK_USERCP); EnableWindow(hw, BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_RAD_USERCP)); SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); return TRUE; } } break; case WMU_STORECOMPLETE: EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_UPLOADCONTACTS), TRUE); EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_IMPORTCONTACTS), TRUE); return TRUE; case WM_NOTIFY: if (((LPNMHDR)lParam)->code == PSN_APPLY) { TCHAR ws[2048]; GetDlgItemText(hwndDlg, IDC_ED_SNAME, ws, LSTRINGLEN); mir_strcpy(proto->options.server_name, T2Utf(ws)); GetDlgItemText(hwndDlg, IDC_ED_NAME, ws, LSTRINGLEN); mir_strcpy(proto->options.id, T2Utf(ws)); GetDlgItemText(hwndDlg, IDC_ED_PWORD, ws, LSTRINGLEN); mir_strcpy(proto->options.pword, T2Utf(ws)); BOOL translated; int port = GetDlgItemInt(hwndDlg, IDC_ED_PORT, &translated, FALSE); if (translated) proto->options.port = port; proto->options.get_server_contacts = (IsDlgButtonChecked(hwndDlg, IDC_CHK_GETSERVERCONTACTS) != FALSE); int sel = SendDlgItemMessage(hwndDlg, IDC_CMB_CLIENT, CB_GETCURSEL, 0, 0); int id = SendDlgItemMessage(hwndDlg, IDC_CMB_CLIENT, CB_GETITEMDATA, sel, 0); if (id == client_ids[sizeof(client_ids) / sizeof(int)-1]) { BOOL trans; id = GetDlgItemInt(hwndDlg, IDC_ED_CLIENTID, &trans, FALSE); if (trans) proto->options.client_id = id; } else proto->options.client_id = id; sel = SendDlgItemMessage(hwndDlg, IDC_CMB_CLIENTVN, CB_GETCURSEL, 0, 0); int CVpos = SendDlgItemMessage(hwndDlg, IDC_CMB_CLIENTVN, CB_GETITEMDATA, sel, 0); proto->options.client_versionMajor = CV_major[CVpos]; proto->options.client_versionMinor = CV_minor[CVpos]; if (IsDlgButtonChecked(hwndDlg, IDC_RAD_ERRMB)) proto->options.err_method = ED_MB; else if (IsDlgButtonChecked(hwndDlg, IDC_RAD_ERRBAL)) proto->options.err_method = ED_BAL; else if (IsDlgButtonChecked(hwndDlg, IDC_RAD_ERRPOP)) proto->options.err_method = ED_POP; proto->options.add_contacts = (IsDlgButtonChecked(hwndDlg, IDC_CHK_ADDCONTACTS) != FALSE); proto->options.encrypt_session = (IsDlgButtonChecked(hwndDlg, IDC_RAD_ENC) != FALSE); proto->options.idle_as_away = (IsDlgButtonChecked(hwndDlg, IDC_CHK_IDLEAWAY) != FALSE); proto->SaveOptions(); return TRUE; } break; case WM_DESTROY: break; } return FALSE; }
void SendPounce(TCHAR *text, MCONTACT hContact) { if (HANDLE hSendId = (HANDLE)CallContactService(hContact, PSS_MESSAGE, 0, T2Utf(text))) WindowList_Add(hWindowList, (HWND)hSendId, hContact); }