void TwitterProto::SignOn(void*) { debugLogA( _T("***** Beginning SignOn process")); WaitForSingleObject(&signon_lock_,INFINITE); // Kill the old thread if it's still around // this doesn't seem to work.. should we wait infinitely? if(hMsgLoop_) { debugLogA( _T("***** Requesting MessageLoop to exit")); QueueUserAPC(APC_callback,hMsgLoop_,(ULONG_PTR)this); debugLogA( _T("***** Waiting for old MessageLoop to exit")); //WaitForSingleObject(hMsgLoop_,INFINITE); WaitForSingleObject(hMsgLoop_,180000); CloseHandle(hMsgLoop_); } if(NegotiateConnection()) // Could this be? The legendary Go Time?? { if(!in_chat_ && db_get_b(0,m_szModuleName,TWITTER_KEY_CHATFEED,0)) OnJoinChat(0,true); SetAllContactStatuses(ID_STATUS_ONLINE); hMsgLoop_ = ForkThreadEx(&TwitterProto::MessageLoop, NULL, 0); } ReleaseMutex(signon_lock_); debugLogA( _T("***** SignOn complete")); }
void TwitterProto::UpdateSettings() { if (getByte(TWITTER_KEY_CHATFEED)) { if (!in_chat_) OnJoinChat(0, 0); } else { if (in_chat_) OnLeaveChat(0, 0); for (MCONTACT hContact = db_find_first(m_szModuleName); hContact;) { MCONTACT hNext = db_find_next(hContact, m_szModuleName); if (isChatRoom(hContact)) CallService(MS_DB_CONTACT_DELETE, WPARAM(hContact), 0); hContact = hNext; } } }
void MinecraftDynmapProto::SignOnWorker(void*) { SYSTEMTIME t; GetLocalTime(&t); debugLogA("[%d.%d.%d] Using Omegle Protocol %s", t.wDay, t.wMonth, t.wYear, __VERSION_STRING_DOTS); ScopedLock s(signon_lock_); int old_status = m_iStatus; // Load server from database ptrA str(db_get_sa(NULL, m_szModuleName, MINECRAFTDYNMAP_KEY_SERVER)); if (!str || !str[0]) { MessageBox(NULL, TranslateT("Set server address to connect."), m_tszUserName, MB_OK); SetStatus(ID_STATUS_OFFLINE); return; } m_server = str; // Fix format of given server if (m_server.substr(0, 7) != "http://" && m_server.substr(0, 8) != "https://") m_server = "http://" + m_server; if (m_server.substr(m_server.length() - 1, 1) == "/") m_server = m_server.substr(0, m_server.length() -1); if (doSignOn()) { // Signed in, switch to online, create chatroom and start events loop m_iStatus = m_iDesiredStatus; ProtoBroadcastAck(0, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, m_iStatus); setDword("LogonTS", (DWORD)time(NULL)); ClearChat(); OnJoinChat(0, false); ResetEvent(events_loop_event_); ForkThread(&MinecraftDynmapProto::EventsLoop, this); } else { // Some error ProtoBroadcastAck(0, ACKTYPE_STATUS, ACKRESULT_FAILED, (HANDLE)old_status, m_iStatus); } }
void OmegleProto::SignOn(void*) { SYSTEMTIME t; GetLocalTime(&t); debugLogA("[%d.%d.%d] Using Omegle Protocol %s", t.wDay, t.wMonth, t.wYear, __VERSION_STRING_DOTS); ScopedLock s(signon_lock_); int old_status = m_iStatus; m_iStatus = m_iDesiredStatus; ProtoBroadcastAck(0, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, m_iStatus); setDword("LogonTS", (DWORD)time(NULL)); ClearChat(); OnJoinChat(0, false); if (getByte(OMEGLE_KEY_AUTO_CONNECT, 0)) NewChat(); //ToggleStatusMenuItems(true); }