LRESULT Skype::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) { if (uMsg == WM_COPYDATA) { if (hwnd_skype == nullptr || hwnd_skype != reinterpret_cast<HWND>(wParam)) return FALSE; auto pCDS = reinterpret_cast<PCOPYDATASTRUCT>(lParam); wstring command = ToUTF8(reinterpret_cast<LPCSTR>(pCDS->lpData)); LOG(LevelDebug, L"Received WM_COPYDATA: " + command); wstring profile_command = L"PROFILE RICH_MOOD_TEXT "; if (StartsWith(command, profile_command)) { wstring mood = command.substr(profile_command.length()); if (mood != current_mood && mood != previous_mood) { LOG(LevelDebug, L"Saved previous mood message: " + mood); previous_mood = mood; } } return TRUE; } else if (uMsg == wm_attach) { hwnd_skype = nullptr; switch (lParam) { case SKYPECONTROLAPI_ATTACH_SUCCESS: LOG(LevelDebug, L"Attach succeeded."); hwnd_skype = reinterpret_cast<HWND>(wParam); GetMoodText(); if (!current_mood.empty()) SetMoodText(current_mood); break; case SKYPECONTROLAPI_ATTACH_PENDING_AUTHORIZATION: LOG(LevelDebug, L"Waiting for user confirmation..."); break; case SKYPECONTROLAPI_ATTACH_REFUSED: LOG(LevelError, L"User denied access to client."); break; case SKYPECONTROLAPI_ATTACH_NOT_AVAILABLE: LOG(LevelError, L"API is not available."); break; case SKYPECONTROLAPI_ATTACH_API_AVAILABLE: LOG(LevelDebug, L"API is now available."); Discover(); break; default: LOG(LevelDebug, L"Received unknown message."); break; } return TRUE; } else if (uMsg == wm_discover) { LOG(LevelDebug, L"Received SkypeControlAPIDiscover message."); } return FALSE; }
void godisc(void *ptr) { for(;;) { pthread_testcancel(); Discover(); sleep(1); } }
void UPnP::Run () { for (auto& address : context.GetRouterInfo ().GetAddresses ()) { if (!address.host.is_v6 ()) { Discover (); if (address.transportStyle == data::RouterInfo::eTransportSSU ) { TryPortMapping (I2P_UPNP_UDP, address.port); } else if (address.transportStyle == data::RouterInfo::eTransportNTCP ) { TryPortMapping (I2P_UPNP_TCP, address.port); } } } }
void Node::StartNode(BOOL assingle) { if(assingle) { //单节点启动时,前承后继和finger表都是本身 getFingerTable()->setPredecessor(chordId) ; getFingerTable()->setSuccessor(0,chordId) ; Set_Fingers(1,chordId) ; // //-直接进入normal状态 ChangeState(new NormalState(this)) ; } else { Discover() ; } }
void UPnP::Run () { const std::vector<std::shared_ptr<i2p::data::RouterInfo::Address> > a = context.GetRouterInfo().GetAddresses(); for (auto address : a) { if (!address->host.is_v6 ()) { Discover (); if (address->transportStyle == data::RouterInfo::eTransportSSU ) { TryPortMapping (I2P_UPNP_UDP, address->port); } else if (address->transportStyle == data::RouterInfo::eTransportNTCP ) { TryPortMapping (I2P_UPNP_TCP, address->port); } } } }
void CDiaSlideH::OnSeltag() { if( !Discover() ){ return; } RTK_TAG tag; TAG_NAME tName; char name[TAGNAME_TEXT_LENGTH + 1]; if(GetFirstTag(&tag)){ tName.node = tag.node; tName.sname.group = tag.group; tName.sname.tag = tag.key; tagname_to_text(&tName, name, TAGNAME_TEXT_LENGTH + 1); m_TagName = name; UpdateData(false); } }