void write_ping_address(PINGADDRESS *i) { bool is_contact = (bool)(CallService(MS_DB_CONTACT_IS, (WPARAM)i->hContact, 0) != 0); if(!is_contact) { //MessageBox(0, "Creating contact", "Ping", MB_OK); i->hContact = (HANDLE)CallService(MS_DB_CONTACT_ADD, 0, 0); CallService( MS_PROTO_ADDTOCONTACT, ( WPARAM )i->hContact, ( LPARAM )PROTO ); CallService(MS_IGNORE_IGNORE, (WPARAM)i->hContact, (WPARAM)IGNOREEVENT_USERONLINE); } DBWriteContactSettingString(i->hContact, PROTO, "Address", i->pszName); set_changing_clist_handle(TRUE); DBWriteContactSettingString(i->hContact, "CList", "MyHandle", i->pszLabel); set_changing_clist_handle(FALSE); DBWriteContactSettingString(i->hContact, PROTO, "Nick", i->pszLabel); DBWriteContactSettingWord(i->hContact, PROTO, "Status", i->status); DBWriteContactSettingDword(i->hContact, PROTO, "Port", i->port); DBWriteContactSettingString(i->hContact, PROTO, "Proto", i->pszProto); if(strlen(i->pszCommand)) DBWriteContactSettingString(i->hContact, PROTO, "Command", i->pszCommand); else DBDeleteContactSetting(i->hContact, PROTO, "Command"); if(strlen(i->pszParams)) DBWriteContactSettingString(i->hContact, PROTO, "CommandParams", i->pszParams); else DBDeleteContactSetting(i->hContact, PROTO, "CommandParams"); DBWriteContactSettingWord(i->hContact, PROTO, "SetStatus", i->set_status); DBWriteContactSettingWord(i->hContact, PROTO, "GetStatus", i->get_status); DBWriteContactSettingWord(i->hContact, PROTO, "Index", i->index); if(strlen(i->pszCListGroup)) DBWriteContactSettingString(i->hContact, "CList", "Group", i->pszCListGroup); else DBDeleteContactSetting(i->hContact, "CList", "Group"); }
BOOL CList_SetOffline(HANDLE hContact, BOOL bHide) { if (hContact) { char* szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0); DBWriteContactSettingWord(hContact, szProto, "ApparentMode", 0); DBWriteContactSettingWord(hContact, szProto, "Status", ID_STATUS_OFFLINE); return TRUE; } return FALSE; }
bool WriteLastCheckTime(void) { SYSTEMTIME now; GetSystemTime(&now); DBWriteContactSettingWord(0, MODULE, "LastUpdateDay", now.wDay); DBWriteContactSettingWord(0, MODULE, "LastUpdateMonth", now.wMonth); DBWriteContactSettingWord(0, MODULE, "LastUpdateYear", now.wYear); return true; }
BOOL CList_SetOffline(HANDLE hContact, BOOL bHide) { if ( hContact ) { char * szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0); int i = DBGetContactSettingByte(hContact, szProto, "ChatRoom", 0); DBWriteContactSettingWord(hContact, szProto,"ApparentMode",(LPARAM) 0); DBWriteContactSettingWord(hContact, szProto, "Status", ID_STATUS_OFFLINE); if (bHide && i != GCW_SERVER) DBWriteContactSettingByte(hContact, "CList", "Hidden", 1); return TRUE; } return FALSE; }
int SelectEncoder() { WORD uid; int i; if(ModulesCount == 0){ if (gl_bUnicodeAwareCore) MessageBox(0, TranslateT("Crypto modules not found"), TranslateT("Error"), MB_OK); else MessageBoxA(0, Translate("Crypto modules not found"), Translate("Error"), MB_OK); return 1; } uid = DBGetContactSettingWord(NULL, "SecureMMAP", "CryptoModule", 0); if(uid == 0){ if (gl_bUnicodeAwareCore) MessageBox(0, TranslateT("Crypto module hasn't been chosen, using first one found"), TranslateT("Notice"), MB_OK); else MessageBoxA(0, Translate("Crypto module hasn't been chosen, using first one found"), Translate("Notice"), MB_OK); DBWriteContactSettingWord(NULL, "SecureMMAP", "CryptoModule", Modules[0]->cryptor->uid); CryptoEngine = Modules[0]->cryptor; } else{ int Found = 0; for(i = 0; i < ModulesCount; i++){ if(Modules[i]->cryptor->uid == uid){ CryptoEngine = Modules[i]->cryptor; Found = 1; break; } } if(!Found){ if (gl_bUnicodeAwareCore) MessageBox(0, TranslateT("Crypto module hasn't been chosen, using first one found"), TranslateT("Notice"), MB_OK); else MessageBoxA(0, Translate("Crypto module hasn't been chosen, using first one found"), Translate("Notice"), MB_OK); DBWriteContactSettingWord(NULL, "SecureMMAP", "CryptoModule", Modules[0]->cryptor->uid); CryptoEngine = Modules[0]->cryptor; } } return 0; }
void CDatabase::WriteContactSettingInt(HANDLE hContact, const char* param, int value) const { MTLASSERT(hContact); MTLASSERT(param && lstrlenA(param) > 0); int res = DBWriteContactSettingWord(hContact, g_env.ProtocolName(), param, value); MTLASSERT(S_OK == res); }
int TlenOnModulesLoaded(void *ptr, WPARAM wParam, LPARAM lParam) { char str[128]; TlenProtocol *proto = (TlenProtocol *)ptr; /* Set all contacts to offline */ HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); while (hContact != NULL) { char *szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0); if(szProto!=NULL && !strcmp(szProto, proto->iface.m_szModuleName)) { if (DBGetContactSettingWord(hContact, proto->iface.m_szModuleName, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) { DBWriteContactSettingWord(hContact, proto->iface.m_szModuleName, "Status", ID_STATUS_OFFLINE); } } hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0); } TlenMUCInit(proto); sprintf(str, "%s", Translate("Incoming mail")); SkinAddNewSoundEx("TlenMailNotify", proto->iface.m_szProtoName, str); sprintf(str, "%s", Translate("Alert")); SkinAddNewSoundEx("TlenAlertNotify", proto->iface.m_szProtoName, str); sprintf(str, "%s", Translate("Voice chat")); SkinAddNewSoundEx("TlenVoiceNotify", proto->iface.m_szProtoName, str); HookEventObj_Ex(ME_USERINFO_INITIALISE, proto, TlenUserInfoInit); return 0; }
//Function to put all enabled contact to the Online status void RefreshContact(void) { HACCOUNT Finder; for(Finder=POP3Plugin->FirstAccount;Finder!=NULL;Finder=Finder->Next) { if(Finder->hContact != NULL) { if((Finder->Flags & YAMN_ACC_ENA) && (Finder->NewMailN.Flags & YAMN_ACC_CONT)) { DBDeleteContactSetting(Finder->hContact, "CList", "Hidden"); } else { DBWriteContactSettingByte(Finder->hContact, "CList", "Hidden", 1); } } else { if((Finder->Flags & YAMN_ACC_ENA) && (Finder->NewMailN.Flags & YAMN_ACC_CONT)) { Finder->hContact =(HANDLE) CallService(MS_DB_CONTACT_ADD, 0, 0); CallService(MS_PROTO_ADDTOCONTACT,(WPARAM)Finder->hContact,(LPARAM)ProtoName); DBWriteContactSettingString(Finder->hContact,ProtoName,"Id",Finder->Name); DBWriteContactSettingString(Finder->hContact,ProtoName,"Nick",Finder->Name); DBWriteContactSettingString(Finder->hContact,"Protocol","p",ProtoName); DBWriteContactSettingWord(Finder->hContact, ProtoName, "Status", ID_STATUS_ONLINE); DBWriteContactSettingString(Finder->hContact, "CList", "StatusMsg", Translate("No new mail message")); } } } }
BOOL SM_SetStatus(const TCHAR* pszID, const char* pszModule, int wStatus) { SESSION_INFO* pTemp = m_WndList, *pLast = NULL; if (!pszModule) return FALSE; while (pTemp != NULL) { if ((!pszID || !lstrcmpi(pTemp->ptszID, pszID)) && !lstrcmpiA(pTemp->pszModule, pszModule)) { pTemp->wStatus = wStatus; if (pTemp->hContact) { if (pTemp->iType != GCW_SERVER && wStatus != ID_STATUS_OFFLINE) DBDeleteContactSetting(pTemp->hContact, "CList", "Hidden"); DBWriteContactSettingWord(pTemp->hContact, pTemp->pszModule, "Status", (WORD)wStatus); } if (pszID) return TRUE; } pLast = pTemp; pTemp = pTemp->next; } return TRUE; }
void DecryptDB() { char oldKey[255]; strcpy(oldKey, encryptKey); if(!CheckPassword(dbHeader.checkWord, Translate("current database"))){strcpy(encryptKey, oldKey); encryptKeyLength = strlen(oldKey); return;} WritePlainHeader(); EnterCriticalSection(&csDbAccess); DecodeAll(); LeaveCriticalSection(&csDbAccess); bEncoding = 0; zero_fill(encryptKey, sizeof encryptKey); if (gl_bUnicodeAwareCore) xModifyMenu(hSetPwdMenu, 0, LPGENT("Set Password"), 0); else xModifyMenu(hSetPwdMenu, 0, (TCHAR*) LPGEN("Set Password"), 0); //ugly hack DBWriteContactSettingWord(NULL, "SecureMMAP", "CryptoModule", 0); CryptoEngine->FreeKey(key); CryptoEngine = NULL; }
void logoff_contacts(BOOL bCleanup) { HANDLE hContact; char *szProto; DBVARIANT dbv={0}; LOG(("logoff_contacts: Logging off contacts.")); for (hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);hContact != NULL;hContact=(HANDLE)CallService( MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0)) { szProto = (char*)CallService( MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0 ); if (szProto!=NULL && !strcmp(szProto, SKYPE_PROTONAME)) { if (DBGetContactSettingWord(hContact, SKYPE_PROTONAME, "Status", ID_STATUS_OFFLINE)!=ID_STATUS_OFFLINE) DBWriteContactSettingWord(hContact, SKYPE_PROTONAME, "Status", ID_STATUS_OFFLINE); DBDeleteContactSetting(hContact, SKYPE_PROTONAME, "CallId"); if (DBGetContactSettingByte(hContact, SKYPE_PROTONAME, "ChatRoom", 0)==1) { if (DBGetContactSettingTString(hContact, SKYPE_PROTONAME, "ChatRoomID", &dbv)) continue; RemChat (dbv.ptszVal); DBFreeVariant(&dbv); } if (DBGetContactSettingString(hContact, SKYPE_PROTONAME, "Typing_Stream", &dbv) == 0) { if (bCleanup) SkypeSend ("ALTER APPLICATION libpurple_typing DISCONNECT %s", dbv.pszVal); DBFreeVariant(&dbv); DBDeleteContactSetting(hContact, SKYPE_PROTONAME, "Typing_Stream"); } } } if (bCleanup && (protocol>=5 || bIsImoproxy)) SkypeSend ("DELETE APPLICATION libpurple_typing"); }
static BOOL Convert(HANDLE hContact, char* module, char* setting, int value, int toType) // 0 = byte, 1 = word, 2 = dword, 3 = string { int Result = 1; char temp[64]; switch (toType) { case 0: if (value > 0xFF) Result = 0; else DBWriteContactSettingByte(hContact, module, setting, (BYTE)value); break; case 1: if (value > 0xFFFF) Result = 0; else DBWriteContactSettingWord(hContact, module, setting, (WORD)value); break; case 2: DBWriteContactSettingDword(hContact, module, setting, (DWORD)value); break; case 3: DBDeleteContactSetting(hContact, module, setting); DBWriteContactSettingString(hContact, module, setting, itoa(value,temp,10)); break; } return Result; }
BOOL SM_SetStatus(const TCHAR* pszID, const char* pszModule, int wStatus) { SESSION_INFO *pTemp = m_WndList, *pLast = NULL; if (!pszModule) return FALSE; while ( pTemp != NULL ) { if (( !pszID || !lstrcmpi( pTemp->ptszID, pszID )) && !lstrcmpiA( pTemp->pszModule, pszModule )) { pTemp->wStatus = wStatus; if (pTemp->hWnd && g_Settings.TabsEnable) g_TabSession.wStatus = wStatus; if ( pTemp->hContact ) { if ( pTemp->iType != GCW_SERVER && wStatus != ID_STATUS_OFFLINE ) DBDeleteContactSetting(pTemp->hContact, "CList", "Hidden"); DBWriteContactSettingWord(pTemp->hContact, pTemp->pszModule, "Status", (WORD)wStatus); } if ( g_Settings.TabsEnable && g_TabSession.hWnd ) PostMessage( g_TabSession.hWnd, GC_FIXTABICONS, 0, (LPARAM) pTemp ); if (pszID) return TRUE; } pLast = pTemp; pTemp = pTemp->next; } return TRUE; }
void save_listbox_items() { bool is_contact; for(int i = 0; i < listbox_items.getCount(); ++i) { is_contact = (int)CallService(MS_DB_CONTACT_IS, (WPARAM)listbox_items[i].hContact, 0) == 1; if(!is_contact) { listbox_items[i].hContact = (HANDLE)CallService(MS_DB_CONTACT_ADD, 0, 0); CallService( MS_PROTO_ADDTOCONTACT, ( WPARAM )listbox_items[i].hContact, ( LPARAM )PROTO ); CallService(MS_IGNORE_IGNORE, (WPARAM)listbox_items[i].hContact, (WPARAM)IGNOREEVENT_USERONLINE); } DBWriteContactSettingTString(listbox_items[i].hContact, PROTO, "Nick", listbox_items[i].pszText); DBWriteContactSettingDword(listbox_items[i].hContact, PROTO, "TimezoneListIndex", listbox_items[i].timezone_list_index); DBWriteContactSettingWord(listbox_items[i].hContact, PROTO, "Status", ID_STATUS_ONLINE); DBWriteContactSettingTString(listbox_items[i].hContact, PROTO, "TZName", timezone_list[listbox_items[i].timezone_list_index].tcName); } DBWriteContactSettingWord(0, PROTO, "DataVersion", 1); // remove contacts in DB that have been removed from the list HANDLE hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 ); char *proto; bool found; while ( hContact != NULL ) { proto = ( char* )CallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM )hContact,0 ); if ( proto && !strcmp( PROTO, proto)) { found = false; for(int i = 0; i < listbox_items.getCount(); i++) { if(listbox_items[i].hContact == hContact) { found = true; } } if(!found) { // remove prot first, so that our contact deleted event handler (if present) isn't activated HANDLE oldHContact = hContact; hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT,( WPARAM )hContact, 0 ); CallService(MS_PROTO_REMOVEFROMCONTACT, (WPARAM)oldHContact, (LPARAM)PROTO); CallService(MS_DB_CONTACT_DELETE, (WPARAM)oldHContact, 0); } else hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT,( WPARAM )hContact, 0 ); } else hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT,( WPARAM )hContact, 0 ); } }
void SetCurrentProtocol(int index) { current.Free(); int protosSize = GetNumProtocols(); if (protosSize > 0) current.index = (index % protosSize + protosSize) % protosSize; DBWriteContactSettingWord(NULL, "MyDetails", "ProtocolNumber", current.index); }
BOOL CList_SetAllOffline(BOOL bHide) { HANDLE hContact; char * szProto; hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); while ( hContact ) { szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0); if ( MM_FindModule( szProto )) { int i = DBGetContactSettingByte(hContact, szProto, "ChatRoom", 0); if ( i != 0 ) { DBWriteContactSettingWord(hContact, szProto,"ApparentMode",(LPARAM)(WORD) 0); DBWriteContactSettingWord(hContact, szProto, "Status", ID_STATUS_OFFLINE); if (bHide && i == GCW_CHATROOM) DBWriteContactSettingByte(hContact, "CList", "Hidden", 1); } } hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0); } return TRUE; }
int Chat_Unload(void) { if (!PluginConfig.m_chat_enabled) return 0; DBWriteContactSettingWord(NULL, "Chat", "SplitterX", (WORD)g_Settings.iSplitterX); DBWriteContactSettingWord(NULL, "Chat", "splitY", (WORD)g_Settings.iSplitterY); CList_SetAllOffline(TRUE, NULL); mir_free(pszActiveWndID); mir_free(pszActiveWndModule); DestroyMenu(g_hMenu); DestroyServiceFunctions(); DestroyHookableEvents(); FreeIcons(); OptionsUnInit(); UnhookEvents(); return 0; }
int PingEnableAll(WPARAM wParam, LPARAM lParam) { PINGLIST pl; CallService(PROTO "/GetPingList", 0, (LPARAM)&pl); for(PINGLIST::iterator i = pl.begin(); i != pl.end(); i++) { if(i->status == options.off_status) { i->status = options.nrstatus; DBWriteContactSettingWord(i->hContact, PROTO, "Status", i->status); } } CallService(PROTO "/SetPingList", (WPARAM)&pl, 0); return 0; }
void SkypeProfile_Save(SkypeProfile *pstProf) { DBWriteContactSettingByte(NULL, SKYPE_PROTONAME, "Gender", pstProf->Sex); DBWriteContactSettingString(NULL, SKYPE_PROTONAME, "HomePhone", pstProf->HomePhone); DBWriteContactSettingString(NULL, SKYPE_PROTONAME, "OfficePhone", pstProf->OfficePhone); DBWriteContactSettingString(NULL, SKYPE_PROTONAME, "HomePage", pstProf->HomePage); DBWriteContactSettingTString(NULL, SKYPE_PROTONAME, "Nick", pstProf->FullName); DBWriteContactSettingTString(NULL, SKYPE_PROTONAME, "City", pstProf->City); DBWriteContactSettingTString(NULL, SKYPE_PROTONAME, "Province", pstProf->Province); DBWriteContactSettingWord(NULL, SKYPE_PROTONAME, "BirthYear", (WORD)pstProf->Birthday.wYear); DBWriteContactSettingByte(NULL, SKYPE_PROTONAME, "BirthMonth", (BYTE)pstProf->Birthday.wMonth); DBWriteContactSettingByte(NULL, SKYPE_PROTONAME, "BirthDay", (BYTE)pstProf->Birthday.wDay); }
int PingDisableAll(WPARAM wParam, LPARAM lParam) { PINGLIST pl; CallService(PROTO "/GetPingList", 0, (LPARAM)&pl); for(PINGLIST::iterator i = pl.begin(); i != pl.end(); i++) { i->status = options.off_status; DBWriteContactSettingWord(i->hContact, PROTO, "Status", i->status); set_changing_clist_handle(TRUE); DBWriteContactSettingString(i->hContact, "CList", "MyHandle", i->pszLabel); set_changing_clist_handle(FALSE); } CallService(PROTO "/SetPingList", (WPARAM)&pl, 0); return 0; }
BOOL CList_SetAllOffline(BOOL bHide, const char *pszModule) { HANDLE hContact; char* szProto; hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); while (hContact) { szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0); if (MM_FindModule(szProto)) { if (!pszModule || (pszModule && !strcmp(pszModule, szProto))) { int i = M->GetByte(hContact, szProto, "ChatRoom", 0); if (i != 0) { DBWriteContactSettingWord(hContact, szProto, "ApparentMode", (LPARAM)(WORD) 0); DBWriteContactSettingWord(hContact, szProto, "Status", ID_STATUS_OFFLINE); } } } hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0); } return TRUE; }
int __declspec(dllexport) Unload(void) { DBWriteContactSettingWord(NULL, "Chat", "SplitterX", (WORD)g_Settings.iSplitterX); DBWriteContactSettingWord(NULL, "Chat", "SplitterY", (WORD)g_Settings.iSplitterY); DBWriteContactSettingDword(NULL, "Chat", "roomx", g_Settings.iX); DBWriteContactSettingDword(NULL, "Chat", "roomy", g_Settings.iY); DBWriteContactSettingDword(NULL, "Chat", "roomwidth" , g_Settings.iWidth); DBWriteContactSettingDword(NULL, "Chat", "roomheight", g_Settings.iHeight); CList_SetAllOffline(TRUE, NULL); mir_free( pszActiveWndID ); mir_free( pszActiveWndModule ); DestroyMenu(g_hMenu); DestroyServiceFunctions(); DestroyHookableEvents(); FreeIcons(); OptionsUnInit(); FreeLibrary(GetModuleHandleA("riched20.dll")); UnhookEvents(); return 0; }
void SaveOptions() { DBWriteContactSettingDword(NULL, PLUG, "PingPeriod", options.ping_period); DBWriteContactSettingDword(NULL, PLUG, "PingTimeout", options.ping_timeout); CallService(PLUG "/SetPingTimeout", (WPARAM)options.ping_timeout, 0); DBWriteContactSettingByte(NULL, PLUG, "ShowPopup", options.show_popup ? 1 : 0); DBWriteContactSettingByte(NULL, PLUG, "ShowPopup2", options.show_popup2 ? 1 : 0); DBWriteContactSettingByte(NULL, PLUG, "BlockReps", options.block_reps ? 1 : 0); DBWriteContactSettingByte(NULL, PLUG, "LoggingEnabled", options.logging ? 1 : 0); DBWriteContactSettingByte(NULL, PLUG, "NoTestStatus", options.no_test_icon ? 1 : 0); DBWriteContactSettingWord(NULL, PLUG, "Indent", options.indent); DBWriteContactSettingWord(NULL, PLUG, "RowHeight", options.row_height); DBWriteContactSettingDword(NULL, PLUG, "Retries", (DWORD)options.retries); CallService(PLUG "/SetLogFilename", (WPARAM)MAX_PATH, (LPARAM)options.log_filename); ICMP::get_instance()->set_timeout(options.ping_timeout * 1000); DBWriteContactSettingByte(NULL, PLUG, "AttachToClist", options.attach_to_clist ? 1 : 0); DBWriteContactSettingByte(NULL, PLUG, "LogCSV", options.log_csv ? 1 : 0); }
void CDatabase::SetContactStatus(const wchar_t* uri, int status) const { HANDLE hContact = FindContact(uri); if(hContact) { const char* protocol = reinterpret_cast<const char*>(CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0)); if(protocol && !lstrcmpA(protocol, g_env.ProtocolName())) { DBWriteContactSettingWord(hContact, g_env.ProtocolName(), "Status", status); } else MTLASSERT(!"Not RTC contact"); } }
void SaveOptions() { DBWriteContactSettingDword(NULL, PROTO, "PingPeriod", options.ping_period); DBWriteContactSettingDword(NULL, PROTO, "PingTimeout", options.ping_timeout); //CallService(PROTO "/SetPingTimeout", (WPARAM)options.ping_timeout, 0); DBWriteContactSettingByte(NULL, PROTO, "ShowPopup", options.show_popup ? 1 : 0); DBWriteContactSettingByte(NULL, PROTO, "ShowPopup2", options.show_popup2 ? 1 : 0); DBWriteContactSettingByte(NULL, PROTO, "BlockReps", options.block_reps ? 1 : 0); DBWriteContactSettingByte(NULL, PROTO, "LoggingEnabled", options.logging ? 1 : 0); DBWriteContactSettingWord(NULL, PROTO, "RespondingStatus", options.rstatus); DBWriteContactSettingWord(NULL, PROTO, "NotRespondingStatus", options.nrstatus); DBWriteContactSettingWord(NULL, PROTO, "TestingStatus", options.tstatus); DBWriteContactSettingWord(NULL, PROTO, "DisabledStatus", options.off_status); DBWriteContactSettingByte(NULL, PROTO, "NoTestStatus", options.no_test_status ? 1 : 0); DBWriteContactSettingByte(NULL, PROTO, "HideProtocol", options.hide_proto ? 1 : 0); DBWriteContactSettingByte(NULL, PROTO, "UseStatusMessage", options.use_status_msg ? 1 : 0); DBWriteContactSettingDword(NULL, PROTO, "Retries", options.retries); CallService(PROTO "/SetLogFilename", (WPARAM)MAX_PATH, (LPARAM)options.log_filename); ICMP::get_instance()->set_timeout(options.ping_timeout * 1000); }
void ChangePwd() { char newpass[255] = {0}; int action = DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_CHANGEPASS), NULL, (DLGPROC)DlgChangePass, (LPARAM)newpass); if(action == IDCANCEL || (action == IDOK && !strlen(newpass))) return; EnterCriticalSection(&csDbAccess); DecodeAll(); CryptoEngine->FreeKey(key); if(action == IDREMOVE){ WritePlainHeader(); bEncoding = 0; CryptoEngine = NULL; DBWriteContactSettingWord(NULL, "SecureMMAP", "CryptoModule", 0); zero_fill(encryptKey, sizeof encryptKey); if (gl_bUnicodeAwareCore) xModifyMenu(hSetPwdMenu, 0, LPGENT("Set Password"), 0); else xModifyMenu(hSetPwdMenu, 0, (TCHAR*) LPGEN("Set Password"), 0); //ugly hack } if(action == IDOK){ strcpy(encryptKey, newpass); encryptKeyLength = strlen(newpass); bEncoding = 1; EncoderInit(); EncodeAll(); WriteCryptHeader(); } zero_fill(newpass, sizeof newpass); LeaveCriticalSection(&csDbAccess); }
int Chat_Unload(void) { DBWriteContactSettingWord(NULL, "Chat", "SplitterX", (WORD)g_Settings.iSplitterX); CList_SetAllOffline(TRUE, NULL); mir_free( pszActiveWndID ); mir_free( pszActiveWndModule ); DestroyHookableEvents(); DestroyMenu(g_hMenu); FreeIcons(); OptionsUnInit(); DeleteCriticalSection(&cs); return 0; }
void CDatabase::SetAllContactsStatusToOffline(void) const { HANDLE hContact = reinterpret_cast<HANDLE>(CallService(MS_DB_CONTACT_FINDFIRST, 0, 0)); while(hContact) { const char* protocol = reinterpret_cast<const char*>(CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0)); if(protocol && 0 == lstrcmpA(protocol, g_env.ProtocolName())) { if(DBGetContactSettingByte(hContact, g_env.ProtocolName(), "ChatRoom", 0) == 0) // Chat API support { DBWriteContactSettingWord(hContact, g_env.ProtocolName(), "Status", ID_STATUS_OFFLINE); DBDeleteContactSetting(hContact, "CList", "StatusMsg"); } } hContact = reinterpret_cast<HANDLE>(CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0)); } }
void save_listbox_items() { DBWriteContactSettingDword(0, "WorldTime", "NumEntries", listbox_items.getCount()); int index = 0; for(int i = 0; i < listbox_items.getCount(); i++, index++) { char p1[20], p2[20], p3[20], p4[20], p5[20]; mir_snprintf(p1, SIZEOF(p1), "Label%d", i); mir_snprintf(p2, SIZEOF(p2), "Index%d", i); mir_snprintf(p3, SIZEOF(p3), "Sunrise%d", i); mir_snprintf(p4, SIZEOF(p4), "Sunset%d", i); mir_snprintf(p5, SIZEOF(p5), "TZName%d", i); DBWriteContactSettingTString(0, "WorldTime", p1, listbox_items[i].pszText); DBWriteContactSettingDword(0, "WorldTime", p2, listbox_items[i].timezone_list_index); DBWriteContactSettingDword(0, "WorldTime", p3, listbox_items[i].sunrise.wHour * 60 + listbox_items[i].sunrise.wMinute); DBWriteContactSettingDword(0, "WorldTime", p4, listbox_items[i].sunset.wHour * 60 + listbox_items[i].sunset.wMinute); DBWriteContactSettingTString(0, "WorldTime", p5, timezone_list[listbox_items[i].timezone_list_index].tcName); } DBWriteContactSettingWord(0, "WorldTime", "DataVersion", 1); }
void SetAllOffline() { char *proto; HANDLE hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 ), hContactNext; while ( hContact != NULL ) { proto = ( char* )CallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM )hContact,0 ); if ( proto && !strcmp( PROTO, proto)) { if(DBGetContactSettingByte(hContact, PROTO, "ChatRoom", 0)) { // clean up after chat plugin hContactNext = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT,( WPARAM )hContact, 0 ); CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0); hContact = hContactNext; continue; } else { DBWriteContactSettingWord( hContact, PROTO, "Status", ID_STATUS_OFFLINE); DBWriteContactSettingDword(hContact, PROTO, "IdleTS", 0); } } hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT,( WPARAM )hContact, 0 ); } }