void MucConfigForm::sendIq(JabberDataBlockRef childData ) { ResourceContextRef rc=this->rc.lock(); if (!rc) return; GetMucConfig *getah=new GetMucConfig(roomJid, formRef.lock()); rc->jabberStanzaDispatcherRT->addListener(JabberDataBlockListenerRef(getah)); getah->doRequest(rc, childData); }
ClientInfoForm::ref ClientInfoForm::createInfoForm( HWND parent, const std::string &jid, ResourceContextRef rc) { ClientInfoForm *vf=new ClientInfoForm(); vf->parentHWnd=parent; vf->title=utf8::utf8_wchar(jid); vf->wt=WndTitleRef(new WndTitle(vf, icons::ICON_SEARCH_INDEX)); vf->init(); SetParent(vf->thisHWnd, parent); vf->rc=rc; ClientInfoForm::ref vfRef=ClientInfoForm::ref(vf); vfRef->infoListener=new GetInfo(jid, vfRef); rc->jabberStanzaDispatcherRT->addListener(JabberDataBlockListenerRef(vfRef->infoListener)); vfRef->infoListener->doRequest(rc); return vfRef; }
VcardForm::ref VcardForm::createVcardForm( HWND parent,const std::string &jid, ResourceContextRef rc, bool edit) { VcardForm *vf=new VcardForm(); vf->editForm=edit; vf->parentHWnd=parent; vf->title=utf8::utf8_wchar(jid); vf->wt=WndTitleRef(new WndTitle(vf, icons::ICON_VCARD)); vf->init(); SetParent(vf->thisHWnd, parent); vf->rc=rc; VcardForm::ref vfRef=VcardForm::ref(vf); GetVcard *getv=new GetVcard(jid, vfRef); rc->jabberStanzaDispatcherRT->addListener(JabberDataBlockListenerRef(getv)); getv->doRequest(rc); return vfRef; }
void ServiceDiscovery::go() { wchar_t buf[1024]; SendMessage(editWnd, WM_GETTEXT, 1024, (LPARAM) buf); std::string newJid=utf8::wchar_utf8(std::wstring(buf)); GetDisco *gd=new GetDisco(newJid, this->newNode, thisRef.lock()); rc->jabberStanzaDispatcherRT->addListener(JabberDataBlockListenerRef(gd)); DiscoNode node; node.jid=this->jid; node.node=this->node; node.subnodes=nodeList->getODRList(); node.cursorPos=nodeList->getCursorPos(); if (node.subnodes) if (node.subnodes->size()>0) nodes.push(node); this->jid=newJid; this->node=newNode; infoReply.reset(); itemReply.reset(); gd->doRequest(rc); SetFocus(nodeList->getHWnd()); }
INT_PTR CALLBACK DlgAddEditContact::dialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { DlgAddEditContact *p=(DlgAddEditContact *) GetWindowLong(hDlg, GWL_USERDATA); switch (message) { case WM_INITDIALOG: { p=(DlgAddEditContact *) lParam; SetWindowLong(hDlg, GWL_USERDATA, (LONG) p ); // Create a Done button and size it. SHINITDLGINFO shidi; shidi.dwMask = SHIDIM_FLAGS; shidi.dwFlags = SHIDIF_SIPDOWN | SHIDIF_SIZEDLGFULLSCREEN | SHIDIF_EMPTYMENU; shidi.hDlg = hDlg; SHInitDialog(&shidi); // MenuBar SHMENUBARINFO mbi; memset ( &mbi, 0, sizeof ( mbi ) ); mbi.cbSize = sizeof ( mbi ); mbi.hwndParent = hDlg; mbi.nToolBarId = IDR_MENU_OK_CANCEL; mbi.hInstRes = g_hInst; mbi.dwFlags |= SHCMBF_HMENU; SHCreateMenuBar ( &mbi ); if (p->contact) { SetDlgItemText(hDlg, IDC_E_JID, p->contact->rosterJid); SetDlgItemText(hDlg, IDC_E_NICK, p->contact->nickname); SetDlgItemText(hDlg, IDC_C_GROUP, p->contact->group); } StringVectorRef groups=p->rc->roster->getRosterGroups(); for (size_t i=0; i<groups->size(); i++) AddComboString(hDlg, IDC_C_GROUP, (*groups)[i]); CheckDlgButton(hDlg, IDC_X_SUBSCR, BST_CHECKED); } return (INT_PTR)TRUE; case WM_COMMAND: if (LOWORD(wParam==ID_VCARD_NICK)) { std::string jid; GetDlgItemText(hDlg, IDC_E_JID, jid); if (!verifyJid(hDlg, jid)) return TRUE; GetVcardNick *getNick=new GetVcardNick(jid, hDlg, IDC_E_NICK); p->rc->jabberStanzaDispatcherRT->addListener(JabberDataBlockListenerRef(getNick)); getNick->doRequest(p->rc); return TRUE; } if (LOWORD(wParam) == IDOK) { std::string jid; GetDlgItemText(hDlg, IDC_E_JID, jid); std::trim(jid); if (!verifyJid(hDlg, jid)) return TRUE; std::string group; GetDlgItemText(hDlg, IDC_C_GROUP, group); std::string nick; GetDlgItemText(hDlg, IDC_E_NICK, nick); p->rc->roster->rosterSet( (nick.length()==0)? NULL : nick.c_str(), jid.c_str(), (group.length()==0)? NULL: group.c_str(), NULL); if (p->edit) if (IsDlgButtonChecked(hDlg, IDC_X_SUBSCR)==BST_CHECKED) p->rc->sendPresence(jid.c_str(), presence::PRESENCE_AUTH_ASK, std::string(), 0); EndDialog(hDlg, LOWORD(wParam)); delete p; return TRUE; } if (LOWORD(wParam) == IDCANCEL) { EndDialog(hDlg, LOWORD(wParam)); delete p; return TRUE; } break; case WM_CLOSE: EndDialog(hDlg, message); delete p; return TRUE; } return (INT_PTR)FALSE; }