예제 #1
0
	void OnAuthClicked(CCtrlButton*)
	{
		DWORD flags = CallProtoServiceInt(NULL, m_acs.szProto, PS_GETCAPS, PFLAGNUM_4, 0);
		if (flags & PF4_NOCUSTOMAUTH)
			m_authReq.Enable(false);
		else
			m_authReq.Enable(m_chkAuth.Enabled());
	}
예제 #2
0
	virtual void OnInitDialog()
	{
		if (!m_hContact || !m_proto->icqOnline())
			EndDialog(m_hwnd, 0);

		m_auth.SendMsg(EM_LIMITTEXT, 255, 0);
		m_auth.SetText(TranslateT("Please authorize me to add you to my contact list."));
	}
예제 #3
0
	void OnOk(CCtrlButton*)
	{
		MCONTACT hContact = INVALID_CONTACT_ID;
		switch (m_acs.handleType) {
		case HANDLE_EVENT:
			{
				DBEVENTINFO dbei = { sizeof(dbei) };
				db_event_get(m_acs.hDbEvent, &dbei);
				hContact = (MCONTACT)CallProtoServiceInt(NULL, dbei.szModule, PS_ADDTOLISTBYEVENT, 0, (LPARAM)m_acs.hDbEvent);
			}
			break;

		case HANDLE_SEARCHRESULT:
			hContact = (MCONTACT)CallProtoServiceInt(NULL, m_acs.szProto, PS_ADDTOLIST, 0, (LPARAM)m_acs.psr);
			break;

		case HANDLE_CONTACT:
			hContact = m_acs.hContact;
			break;
		}

		if (hContact == NULL)
			return;

		ptrT szHandle(m_myHandle.GetText());
		if (mir_tstrlen(szHandle))
			db_set_ts(hContact, "CList", "MyHandle", szHandle);

		int item = m_group.GetCurSel();
		if (item > 0)
			CallService(MS_CLIST_CONTACTCHANGEGROUP, hContact, m_group.GetItemData(item));

		db_unset(hContact, "CList", "NotOnList");

		if (m_chkAdded.GetState())
			CallContactService(hContact, PSS_ADDED, 0, 0);

		if (m_chkAuth.GetState()) {
			DWORD flags = CallProtoServiceInt(NULL, m_acs.szProto, PS_GETCAPS, PFLAGNUM_4, 0);
			if (flags & PF4_NOCUSTOMAUTH)
				CallContactService(hContact, PSS_AUTHREQUEST, 0, 0);
			else
				CallContactService(hContact, PSS_AUTHREQUEST, 0, ptrT(m_authReq.GetText()));
		}

		if (m_chkOpen.GetState())
			CallService(MS_CLIST_CONTACTDOUBLECLICKED, hContact, 0);
	}
예제 #4
0
	void btnOk_OnClick(CCtrlButton *)
	{
		TCHAR *szTitle = m_txtTitle.GetText();
		TCHAR *szText = m_txtText.GetText();
		TCHAR *szTags = m_txtTags.GetText();
		TCHAR *szFrom = mir_tstrdup(m_pNote->GetFrom());
		m_pNote->SetData(szTitle, szFrom, szText, szTags);
		mir_free(szTitle);
		mir_free(szText);
		mir_free(szTags);
		mir_free(szFrom);

		m_autoClose = false;
		if (m_fnProcess) (m_proto->*m_fnProcess)(m_pNote, true);
		EndDialog(m_hwnd, TRUE);
	}
예제 #5
0
	virtual void OnApply()
	{
		ptrT tszGroup(m_group.GetText());
		if (mir_tstrcmp(m_proto->m_tszDefaultGroup, tszGroup))
			m_proto->m_tszDefaultGroup = tszGroup.detach();

		if (m_proto->isOnline())
			MessageBox(NULL, TranslateT("Changes will be applied after protocol restart"), m_proto->m_tszUserName, MB_OK);
	}
예제 #6
0
	void OnRequestClick(CCtrlButton*)
	{
		if (IDYES != MessageBox(NULL, TranslateT(szAskSendSms), PRODUCT_NAME, MB_YESNO))
			return;

		ptrA cc(m_cc.GetTextA()), number(m_login.GetTextA());
		string password;
		if (m_proto->Register(REG_STATE_REQ_CODE, string(cc), string(number), string(), password)) {
			if (!password.empty()) {
				MessageBox(NULL, TranslateT(szPasswordSet), PRODUCT_NAME, MB_ICONWARNING);
				m_proto->setString(WHATSAPP_KEY_PASS, password.c_str());
			}
			else {
				m_pw1.Enable(); // unblock sms code entry field
				m_pw2.Enable();
			}
		}
	}
예제 #7
0
void CJabberDlgNoteItem::OnInitDialog()
{
	CSuper::OnInitDialog();
	WindowSetIcon(m_hwnd, m_proto, "notes");

	if (m_fnProcess) {
		CMString buf;
		if (m_fnProcess == &CJabberProto::ProcessIncomingNote)
			buf.Format(TranslateT("Incoming note from %s"), m_pNote->GetFrom());
		else
			buf.Format(TranslateT("Send note to %s"), m_pNote->GetFrom());

		SetWindowText(m_hwnd, buf);
	}

	m_txtTitle.SetText(m_pNote->GetTitle());
	m_txtText.SetText(m_pNote->GetText());
	m_txtTags.SetText(m_pNote->GetTagsStr());
}
예제 #8
0
void CJabberDlgNoteItem::OnInitDialog()
{
	CSuper::OnInitDialog();
	WindowSetIcon( m_hwnd, m_proto, "notes" );

	if (m_fnProcess)
	{
		TCHAR buf[256];
		if (m_fnProcess == &CJabberProto::ProcessIncomingNote)
			mir_sntprintf(buf, SIZEOF(buf), TranslateT("Incoming note from %s"), m_pNote->GetFrom());
		else
			mir_sntprintf(buf, SIZEOF(buf), TranslateT("Send note to %s"), m_pNote->GetFrom());

		SetWindowText(m_hwnd, buf);
	}

	m_txtTitle.SetText(m_pNote->GetTitle());
	m_txtText.SetText(m_pNote->GetText());
	m_txtTags.SetText(m_pNote->GetTagsStr());
}
예제 #9
0
    virtual void OnInitDialog()
    {
        // what, no plugins?!
        if (arDbPlugins.getCount() == 0) {
            m_driverList.Enable(false);
            m_profileName.Enable(false);
            ShowWindow(m_warning.GetHwnd(), TRUE);
        }
        else {
            for (int i = 0; i < arDbPlugins.getCount(); i++) {
                DATABASELINK *p = arDbPlugins[i];
                m_driverList.AddString(TranslateTS(p->szFullName), (LPARAM)p);
            }
        }

        // default item
        m_driverList.SetCurSel(0);

        // subclass the profile name box
        mir_subclassWindow(m_profileName.GetHwnd(), ProfileNameValidate);

        // decide if there is a default profile name given in the INI and if it should be used
        if (m_pd->noProfiles || (shouldAutoCreate(m_pd->ptszProfile) && _taccess(m_pd->ptszProfile, 0))) {
            TCHAR *profile = _tcsrchr(m_pd->ptszProfile, '\\');
            if (profile) ++profile;
            else profile = m_pd->ptszProfile;

            TCHAR *p = _tcsrchr(profile, '.');
            TCHAR c = 0;
            if (p) {
                c = *p;
                *p = 0;
            }

            m_profileName.SetText(profile);
            if (c) *p = c;
        }

        // focus on the textbox
        PostMessage(m_hwnd, WM_FOCUSTEXTBOX, 0, 0);
    }
예제 #10
0
	virtual INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
	{
		switch (msg) {
		case WM_FOCUSTEXTBOX:
			SetFocus(m_profileName.GetHwnd());
			break;

		case WM_INPUTCHANGED: // when input in the edit box changes
			NotifyChange();
			m_btnOk.Enable(GetWindowTextLength(m_profileName.GetHwnd()) > 0);
			break;

		case WM_SHOWWINDOW:
			if (wParam) {
				m_btnOk.SetText(TranslateT("&Create"));
				SendMessage(m_hwnd, WM_INPUTCHANGED, 0, 0);
			}
			break;
		}
		return CDlgBase::DlgProc(msg, wParam, lParam);
	}
예제 #11
0
	void onOk(CCtrlButton*)
	{
		if (!m_proto->icqOnline())
			return;

		DWORD dwUin;
		uid_str szUid;
		if (m_proto->getContactUid(m_hContact, &dwUin, &szUid))
			return; // Invalid contact

		char *szReason = GetWindowTextUtf(m_auth.GetHwnd());
		m_proto->icq_sendAuthReqServ(dwUin, szUid, szReason);
		SAFE_FREE((void**)&szReason);

		// auth bug fix (thx Bio)
		if (m_proto->m_bSsiEnabled && dwUin)
			m_proto->resetServContactAuthState(m_hContact);

		EndDialog(m_hwnd, 0);
	}
예제 #12
0
	virtual void OnApply()
	{
		LRESULT curSel = m_driverList.GetCurSel();
		if (curSel == -1)
			return; // should never happen

		ptrT szName(m_profileName.GetText());
		if (szName == 0)
			return;

		// profile placed in "profile_name" subfolder
		mir_sntprintf(m_pd->ptszProfile, MAX_PATH, _T("%s\\%s\\%s.dat"), m_pd->ptszProfileDir, szName, szName);
		m_pd->newProfile = 1;
		m_pd->dblink = (DATABASELINK *)m_driverList.GetItemData(curSel);

		if (CreateProfile(m_pd->ptszProfile, m_pd->dblink) == 0)
			SetWindowLongPtr(m_hwnd, DWLP_MSGRESULT, PSNRET_INVALID_NOCHANGEPAGE);
		else
			m_pd->bRun = true;
	}
예제 #13
0
	void btnOk_OnClick(CCtrlButton*)
	{
		m_proto->m_szInviteJids.clear();

		// invite users from clist
		for (MCONTACT hContact = db_find_first(m_proto->m_szModuleName); hContact; hContact = db_find_next(hContact, m_proto->m_szModuleName)) {
			if (m_proto->isChatRoom(hContact))
				continue;

			if (HANDLE hItem = m_clc.FindContact(hContact)) {
				if (m_clc.GetCheck(hItem)) {
					ptrA jid(m_proto->getStringA(hContact, "ID"));
					if (jid != NULL)
						m_proto->m_szInviteJids.push_back((char*)jid);
				}
			}
		}

		ptrA tszText(m_entry.GetTextA());
		if (tszText != NULL)
			m_proto->m_szInviteJids.push_back(string(tszText));
	}
예제 #14
0
	void OnRegisterClick(CCtrlButton*)
	{
		if (GetWindowTextLength(m_pw1.GetHwnd()) != 3 || GetWindowTextLength(m_pw2.GetHwnd()) != 3) {
			MessageBox(NULL, TranslateT("Please correctly specify your registration code received by SMS"), PRODUCT_NAME, MB_ICONEXCLAMATION);
			return;
		}

		char code[10];
		GetWindowTextA(m_pw1.GetHwnd(), code, 4);
		GetWindowTextA(m_pw2.GetHwnd(), code + 3, 4);

		string password;
		ptrA cc(m_cc.GetTextA()), number(m_login.GetTextA());
		if (m_proto->Register(REG_STATE_REG_CODE, string(cc), string(number), string(code), password)) {
			m_proto->setString(WHATSAPP_KEY_PASS, password.c_str());
			MessageBox(NULL, TranslateT(szPasswordSet), PRODUCT_NAME, MB_ICONWARNING);
		}
	}
예제 #15
0
	void OnInitDialog()
	{
		char szUin[10];
		Window_SetSkinIcon_IcoLib(m_hwnd, SKINICON_OTHER_ADDCONTACT);
		if (m_acs.handleType == HANDLE_EVENT) {
			DWORD dwUin;
			DBEVENTINFO dbei = { sizeof(dbei) };
			dbei.cbBlob = sizeof(DWORD);
			dbei.pBlob = (PBYTE)&dwUin;
			db_event_get(m_acs.hDbEvent, &dbei);
			_ltoa(dwUin, szUin, 10);
			m_acs.szProto = dbei.szModule;
		}

		MCONTACT hContact;
		TCHAR *szName = NULL, *tmpStr = NULL;
		if (m_acs.handleType == HANDLE_CONTACT)
			szName = cli.pfnGetContactDisplayName(hContact = m_acs.hContact, 0);
		else {
			int isSet = 0;
			hContact = 0;

			if (m_acs.handleType == HANDLE_EVENT) {
				DBEVENTINFO dbei = { sizeof(dbei) };
				dbei.cbBlob = db_event_getBlobSize(m_acs.hDbEvent);
				dbei.pBlob = (PBYTE)mir_alloc(dbei.cbBlob);
				db_event_get(m_acs.hDbEvent, &dbei);
				hContact = *(MCONTACT*)(dbei.pBlob + sizeof(DWORD));
				mir_free(dbei.pBlob);
				if (hContact != INVALID_CONTACT_ID) {
					szName = cli.pfnGetContactDisplayName(hContact, 0);
					isSet = 1;
				}
			}
			if (!isSet)
			{
				if (m_acs.handleType == HANDLE_EVENT)
					szName = mir_a2t(szUin);
				else
				{
					szName = sttDecodeString(m_acs.psr->flags, m_acs.psr->id);
					if (!szName)
						szName = sttDecodeString(m_acs.psr->flags, m_acs.psr->nick);
				}
			}
		}

		if (szName && szName[0])
			SetCaption(CMString(FORMAT, TranslateT("Add %s"), szName));
		else
			SetCaption(TranslateT("Add contact"));
		mir_free(tmpStr);

		if (m_acs.handleType == HANDLE_CONTACT && m_acs.hContact)
			if (m_acs.szProto == NULL || (m_acs.szProto != NULL && *m_acs.szProto == 0))
				m_acs.szProto = GetContactProto(m_acs.hContact);

		int groupSel = 0;
		ptrT tszGroup(db_get_tsa(hContact, "CList", "Group"));
		TCHAR *grpName;
		for (int groupId = 1; (grpName = Clist_GroupGetName(groupId, NULL)) != NULL; groupId++) {
			int id = m_group.AddString(grpName, groupId);
			if (!mir_tstrcmpi(tszGroup, grpName))
				groupSel = id;
		}

		m_group.InsertString(TranslateT("None"), 0);
		m_group.SetCurSel(groupSel);

		// By default check both checkboxes
		m_chkAdded.SetState(true);
		m_chkAuth.SetState(true);

		// Set last choice
		if (db_get_b(NULL, "Miranda", "AuthOpenWindow", 1))
			m_chkOpen.SetState(true);

		DWORD flags = (m_acs.szProto) ? CallProtoServiceInt(NULL, m_acs.szProto, PS_GETCAPS, PFLAGNUM_4, 0) : 0;
		if (flags & PF4_FORCEADDED)  // force you were added requests for this protocol
			m_chkAdded.Enable(false);

		if (flags & PF4_FORCEAUTH)  // force auth requests for this protocol
			m_chkAuth.Enable(false);

		if (flags & PF4_NOCUSTOMAUTH)
			m_authReq.Enable(false);
		else {
			m_authReq.Enable(m_chkAuth.Enabled());
			m_authReq.SetText(TranslateT("Please authorize my request and add me to your contact list."));
		}
	}
예제 #16
0
	virtual void OnInitDialog()
	{
		m_pw1.SendMsg(EM_LIMITTEXT, 3, 0); m_pw1.Enable(false);
		m_pw2.SendMsg(EM_LIMITTEXT, 3, 0); m_pw2.Enable(false);
	}