void Plugin::SecondInit () { if (ProtoMgr_) ProtoMgr_->PluginsAvailable (); emit gotNewProtocols (GetProtocols ()); }
wxString::size_type wxFilterClassFactoryBase::FindExtension( const wxString& location) const { for (const wxChar *const *p = GetProtocols(wxSTREAM_FILEEXT); *p; p++) { if ( location.EndsWith(*p) ) return location.length() - wxStrlen(*p); } return wxString::npos; }
bool wxFilterClassFactoryBase::CanHandle(const wxChar *protocol, wxStreamProtocolType type) const { if (type == wxSTREAM_FILEEXT) return FindExtension(protocol) != wxString::npos; else for (const wxChar *const *p = GetProtocols(type); *p; p++) if (wxStrcmp(*p, protocol) == 0) return true; return false; }
wxString::size_type wxFilterClassFactoryBase::FindExtension( const wxChar *location) const { size_t len = wxStrlen(location); for (const wxChar *const *p = GetProtocols(wxSTREAM_FILEEXT); *p; p++) { size_t l = wxStrlen(*p); if (l <= len && wxStrcmp(*p, location + len - l) == 0) return len - l; } return wxString::npos; }
void ProtocolArray::SetNicks(const char *nick) { if (nick == NULL || nick[0] == '\0') return; lstrcpyn(default_nick, nick, sizeof(default_nick)); DBWriteContactSettingString(0, MODULE_NAME, SETTING_DEFAULT_NICK, nick); std::vector<Protocol> protos; GetProtocols(&protos); unsigned int protosSize = protos.size(); for (int i = 0; i < protosSize; ++i) protos[i].SetNick(default_nick); }
void ProtocolArray::SetStatusMsgs(int status, const char *message) { DBWriteContactSettingString(NULL,"SRAway",StatusModeToDbSetting(status,"Msg"),message); if (!DBGetContactSettingByte(NULL,"SRAway",StatusModeToDbSetting(status,"UsePrev"),0)) { // Save default also DBWriteContactSettingString(NULL,"SRAway",StatusModeToDbSetting(status,"Default"),message); } std::vector<Protocol> protos; GetProtocols(&protos); unsigned int protosSize = protos.size(); for (int i = 0; i < protosSize; ++i) { if (protos[i].GetStatus() == status) protos[i].SetStatusMsg(status, message); } }
static BOOL CALLBACK DlgProcSetNickname(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { switch ( msg ) { case WM_INITDIALOG: { TranslateDialogDefault(hwndDlg); SendMessage(GetDlgItem(hwndDlg, IDC_NICKNAME), EM_LIMITTEXT, MS_MYDETAILS_GETMYNICKNAME_BUFFER_SIZE - 1, 0); return TRUE; } case WMU_SETDATA: { int proto_num = (int)wParam; SetWindowLong(hwndDlg, GWL_USERDATA, proto_num); if (proto_num == -1) { SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)LoadSkinnedIcon(SKINICON_OTHER_MIRANDA)); // All protos have the same nick? std::vector<Protocol> protos; GetProtocols(&protos); int protosSize = protos.size(); if (protosSize > 0) { std::string nick = protos[0].GetNick(); bool foundDefNick = true; for(int i = 1; i < protosSize; i++) { if (stricmp(protos[i].GetNick(), nick.c_str()) != 0) { foundDefNick = false; break; } } if (foundDefNick) { if (stricmp(protocols->default_nick, nick.c_str()) != 0) lstrcpy(protocols->default_nick, nick.c_str()); } } SetDlgItemText(hwndDlg, IDC_NICKNAME, protocols->default_nick); SendDlgItemMessage(hwndDlg, IDC_NICKNAME, EM_LIMITTEXT, MS_MYDETAILS_GETMYNICKNAME_BUFFER_SIZE, 0); } else { Protocol proto = GetProtocolByIndex(proto_num); char tmp[128]; mir_snprintf(tmp, sizeof(tmp), Translate("Set My Nickname for %s"), proto.GetDescription()); SendMessage(hwndDlg, WM_SETTEXT, 0, (LPARAM)tmp); HICON hIcon = (HICON) proto.Call(PS_LOADICON, PLI_PROTOCOL); if (hIcon != NULL) { SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon); DestroyIcon(hIcon); } SetDlgItemText(hwndDlg, IDC_NICKNAME, proto.GetNick()); SendDlgItemMessage(hwndDlg, IDC_NICKNAME, EM_LIMITTEXT, min(MS_MYDETAILS_GETMYNICKNAME_BUFFER_SIZE, proto.GetNickMaxLength()), 0); } return TRUE; } case WM_COMMAND: switch(wParam) { case IDOK: { char tmp[MS_MYDETAILS_GETMYNICKNAME_BUFFER_SIZE]; GetDlgItemText(hwndDlg, IDC_NICKNAME, tmp, sizeof(tmp)); int proto_num = (int) GetWindowLong(hwndDlg, GWL_USERDATA); if (proto_num == -1) { protocols->SetNicks(tmp); } else { GetProtocolByIndex(proto_num).SetNick(tmp); } DestroyWindow(hwndDlg); break; } case IDCANCEL: { DestroyWindow(hwndDlg); break; } } break; case WM_CLOSE: DestroyWindow(hwndDlg); break; case WM_DESTROY: InterlockedExchange(&nickname_dialog_open, 0); break; } return FALSE; }