本文整理汇总了C++中CJabberProto类的典型用法代码示例。如果您正苦于以下问题:C++ CJabberProto类的具体用法?C++ CJabberProto怎么用?C++ CJabberProto使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CJabberProto类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PersonalDlgProc
static INT_PTR CALLBACK PersonalDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
const unsigned long iPageId = 0;
CJabberProto *ppro = (CJabberProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
switch (msg) {
case WM_INITDIALOG:
if (lParam) {
ppro = (CJabberProto*)lParam;
TranslateDialogDefault(hwndDlg);
SendDlgItemMessage(hwndDlg, IDC_GENDER, CB_ADDSTRING, 0, (LPARAM)TranslateT("Male"));
SendDlgItemMessage(hwndDlg, IDC_GENDER, CB_ADDSTRING, 0, (LPARAM)TranslateT("Female"));
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
SendMessage(hwndDlg, WM_JABBER_REFRESH_VCARD, 0, 0);
ppro->WindowSubscribe(hwndDlg);
}
break;
case WM_JABBER_REFRESH_VCARD:
SetDialogField(ppro, hwndDlg, IDC_FULLNAME, "FullName");
SetDialogField(ppro, hwndDlg, IDC_NICKNAME, "Nick");
SetDialogField(ppro, hwndDlg, IDC_FIRSTNAME, "FirstName");
SetDialogField(ppro, hwndDlg, IDC_MIDDLE, "MiddleName");
SetDialogField(ppro, hwndDlg, IDC_LASTNAME, "LastName");
SetDialogField(ppro, hwndDlg, IDC_BIRTH, "BirthDate");
SetDialogField(ppro, hwndDlg, IDC_GENDER, "GenderString", true);
SetDialogField(ppro, hwndDlg, IDC_OCCUPATION, "Role");
SetDialogField(ppro, hwndDlg, IDC_HOMEPAGE, "Homepage");
break;
case WM_COMMAND:
if (((HWND)lParam == GetFocus() && HIWORD(wParam) == EN_CHANGE) ||
((HWND)lParam == GetDlgItem(hwndDlg, IDC_GENDER) && (HIWORD(wParam) == CBN_EDITCHANGE || HIWORD(wParam) == CBN_SELCHANGE))) {
ppro->m_vCardUpdates |= (1UL << iPageId);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
break;
case WM_NOTIFY:
if (((LPNMHDR)lParam)->idFrom == 0) {
switch (((LPNMHDR)lParam)->code) {
case PSN_PARAMCHANGED:
SendMessage(hwndDlg, WM_INITDIALOG, 0, ((PSHNOTIFY*)lParam)->lParam);
break;
case PSN_APPLY:
ppro->m_vCardUpdates &= ~(1UL << iPageId);
ppro->SaveVcardToDB(hwndDlg, iPageId);
if (!ppro->m_vCardUpdates)
ppro->SetServerVcard(ppro->m_bPhotoChanged, ppro->m_szPhotoFileName);
break;
}
}
break;
case WM_DESTROY:
ppro->WindowUnsubscribe(hwndDlg);
break;
}
return FALSE;
}
示例2: NoteDlgProc
static INT_PTR CALLBACK NoteDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
const unsigned long iPageId = 4;
CJabberProto *ppro = (CJabberProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
switch (msg) {
case WM_INITDIALOG:
if (!lParam) break; // Launched from userinfo
ppro = (CJabberProto*)lParam;
TranslateDialogDefault(hwndDlg);
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
SendMessage(hwndDlg, WM_JABBER_REFRESH_VCARD, 0, 0);
ppro->WindowSubscribe(hwndDlg);
break;
case WM_JABBER_REFRESH_VCARD:
SetDialogField(ppro, hwndDlg, IDC_DESC, "About");
break;
case WM_COMMAND:
if ((HWND)lParam == GetFocus() && HIWORD(wParam) == EN_CHANGE) {
ppro->m_vCardUpdates |= (1UL << iPageId);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
break;
case WM_NOTIFY:
if (((LPNMHDR)lParam)->idFrom == 0) {
switch (((LPNMHDR)lParam)->code) {
case PSN_PARAMCHANGED:
SendMessage(hwndDlg, WM_INITDIALOG, 0, ((PSHNOTIFY*)lParam)->lParam);
break;
case PSN_APPLY:
ppro->m_vCardUpdates &= ~(1UL<<iPageId);
ppro->SaveVcardToDB(hwndDlg, iPageId);
if (!ppro->m_vCardUpdates)
ppro->SetServerVcard(ppro->m_bPhotoChanged, ppro->m_szPhotoFileName);
break;
}
}
break;
case WM_DESTROY:
ppro->WindowUnsubscribe(hwndDlg);
break;
}
return FALSE;
}
示例3: JabberPrebuildContactMenu
static int JabberPrebuildContactMenu(WPARAM wParam, LPARAM lParam)
{
Menu_ShowItem(g_hMenuRequestAuth, FALSE);
Menu_ShowItem(g_hMenuGrantAuth, FALSE);
Menu_ShowItem(g_hMenuRevokeAuth, FALSE);
Menu_ShowItem(g_hMenuCommands, FALSE);
Menu_ShowItem(g_hMenuSendNote, FALSE);
Menu_ShowItem(g_hMenuConvert, FALSE);
Menu_ShowItem(g_hMenuRosterAdd, FALSE);
Menu_ShowItem(g_hMenuLogin, FALSE);
Menu_ShowItem(g_hMenuRefresh, FALSE);
Menu_ShowItem(g_hMenuAddBookmark, FALSE);
Menu_ShowItem(g_hMenuResourcesRoot, FALSE);
Menu_ShowItem(g_hMenuDirectPresence[0], FALSE);
CJabberProto *ppro = JabberGetInstanceByHContact(wParam);
return(ppro) ? ppro->OnPrebuildContactMenu(wParam, lParam) : 0;
}
示例4: JabberByteSendConnection
void JabberByteSendConnection( HANDLE hConn, DWORD /*dwRemoteIP*/, void* extra )
{
CJabberProto* ppro = ( CJabberProto* )extra;
TCHAR szPort[8];
JABBER_BYTE_TRANSFER *jbt;
int recvResult, bytesParsed;
HANDLE hListen;
JABBER_LIST_ITEM *item;
char* buffer;
int datalen;
NETLIBCONNINFO connInfo = { sizeof(connInfo) };
CallService(MS_NETLIB_GETCONNECTIONINFO, (WPARAM)hConn, (LPARAM)&connInfo);
mir_sntprintf( szPort, SIZEOF( szPort ), _T("%u"), connInfo.wPort );
ppro->Log( "bytestream_send_connection incoming connection accepted: %s", connInfo.szIpPort );
if (( item = ppro->ListGetItemPtr( LIST_BYTE, szPort )) == NULL ) {
ppro->Log( "No bytestream session is currently active, connection closed." );
Netlib_CloseHandle( hConn );
return;
}
jbt = item->jbt;
if (( buffer = ( char* )mir_alloc( JABBER_NETWORK_BUFFER_SIZE )) == NULL ) {
ppro->Log( "bytestream_send cannot allocate network buffer, connection closed." );
jbt->state = JBT_ERROR;
Netlib_CloseHandle( hConn );
if ( jbt->hEvent != NULL ) SetEvent( jbt->hEvent );
return;
}
hListen = jbt->hConn;
jbt->hConn = hConn;
jbt->state = JBT_INIT;
datalen = 0;
while ( jbt->state!=JBT_DONE && jbt->state!=JBT_ERROR ) {
recvResult = Netlib_Recv( hConn, buffer+datalen, JABBER_NETWORK_BUFFER_SIZE-datalen, 0 );
if ( recvResult <= 0 )
break;
datalen += recvResult;
bytesParsed = ppro->ByteSendParse( hConn, jbt, buffer, datalen );
if ( bytesParsed < datalen )
memmove( buffer, buffer+bytesParsed, datalen-bytesParsed );
datalen -= bytesParsed;
}
if ( jbt->hConn )
Netlib_CloseHandle( jbt->hConn );
ppro->Log( "bytestream_send_connection closing connection" );
jbt->hConn = hListen;
mir_free( buffer );
if ( jbt->hEvent != NULL )
SetEvent( jbt->hEvent );
}
示例5: JabberMenuHandleGrantAuth
static INT_PTR JabberMenuHandleGrantAuth(WPARAM wParam, LPARAM lParam)
{
CJabberProto *ppro = JabberGetInstanceByHContact(wParam);
return(ppro) ? ppro->OnMenuHandleGrantAuth(wParam, lParam) : 0;
}
示例6: JabberByteSendConnection
void JabberByteSendConnection( HANDLE hConn, DWORD /*dwRemoteIP*/, void* extra )
{
CJabberProto* ppro = ( CJabberProto* )extra;
SOCKET s;
SOCKADDR_IN saddr;
int len;
WORD localPort;
TCHAR szPort[8];
JABBER_BYTE_TRANSFER *jbt;
int recvResult, bytesParsed;
HANDLE hListen;
JABBER_LIST_ITEM *item;
char* buffer;
int datalen;
localPort = 0;
if (( s = JCallService( MS_NETLIB_GETSOCKET, ( WPARAM ) hConn, 0 )) != INVALID_SOCKET ) {
len = sizeof( saddr );
if ( getsockname( s, ( SOCKADDR * ) &saddr, &len ) != SOCKET_ERROR )
localPort = ntohs( saddr.sin_port );
}
if ( localPort == 0 ) {
ppro->Log( "bytestream_send_connection unable to determine the local port, connection closed." );
Netlib_CloseHandle( hConn );
return;
}
mir_sntprintf( szPort, SIZEOF( szPort ), _T("%d"), localPort );
ppro->Log( "bytestream_send_connection incoming connection accepted: local_port=" TCHAR_STR_PARAM, szPort );
if (( item = ppro->ListGetItemPtr( LIST_BYTE, szPort )) == NULL ) {
ppro->Log( "No bytestream session is currently active, connection closed." );
Netlib_CloseHandle( hConn );
return;
}
jbt = item->jbt;
if (( buffer = ( char* )mir_alloc( JABBER_NETWORK_BUFFER_SIZE )) == NULL ) {
ppro->Log( "bytestream_send cannot allocate network buffer, connection closed." );
jbt->state = JBT_ERROR;
Netlib_CloseHandle( hConn );
if ( jbt->hEvent != NULL ) SetEvent( jbt->hEvent );
return;
}
hListen = jbt->hConn;
jbt->hConn = hConn;
jbt->state = JBT_INIT;
datalen = 0;
while ( jbt->state!=JBT_DONE && jbt->state!=JBT_ERROR ) {
recvResult = Netlib_Recv( hConn, buffer+datalen, JABBER_NETWORK_BUFFER_SIZE-datalen, 0 );
if ( recvResult <= 0 )
break;
datalen += recvResult;
bytesParsed = ppro->ByteSendParse( hConn, jbt, buffer, datalen );
if ( bytesParsed < datalen )
memmove( buffer, buffer+bytesParsed, datalen-bytesParsed );
datalen -= bytesParsed;
}
if ( jbt->hConn )
Netlib_CloseHandle( jbt->hConn );
ppro->Log( "bytestream_send_connection closing connection" );
jbt->hConn = hListen;
mir_free( buffer );
if ( jbt->hEvent != NULL )
SetEvent( jbt->hEvent );
}
示例7: ContactDlgProc
static INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM, LPARAM lParam)
{
const unsigned long iPageId = 5;
CJabberProto *ppro = (CJabberProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
switch (msg) {
case WM_INITDIALOG:
if (!lParam) break; // Launched from userinfo
ppro = (CJabberProto*)lParam;
{
LVCOLUMN lvc;
RECT rc;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
TranslateDialogDefault(hwndDlg);
GetClientRect(GetDlgItem(hwndDlg, IDC_EMAILS), &rc);
rc.right -= GetSystemMetrics(SM_CXVSCROLL);
lvc.mask = LVCF_WIDTH;
lvc.cx = 30;
ListView_InsertColumn(GetDlgItem(hwndDlg, IDC_EMAILS), 0, &lvc);
ListView_InsertColumn(GetDlgItem(hwndDlg, IDC_PHONES), 0, &lvc);
lvc.cx = rc.right - 30 - 40;
ListView_InsertColumn(GetDlgItem(hwndDlg, IDC_EMAILS), 1, &lvc);
ListView_InsertColumn(GetDlgItem(hwndDlg, IDC_PHONES), 1, &lvc);
lvc.cx = 20;
ListView_InsertColumn(GetDlgItem(hwndDlg, IDC_EMAILS), 2, &lvc);
ListView_InsertColumn(GetDlgItem(hwndDlg, IDC_EMAILS), 3, &lvc);
ListView_InsertColumn(GetDlgItem(hwndDlg, IDC_PHONES), 2, &lvc);
ListView_InsertColumn(GetDlgItem(hwndDlg, IDC_PHONES), 3, &lvc);
SendMessage(hwndDlg, M_REMAKELISTS, 0, 0);
ppro->WindowSubscribe(hwndDlg);
}
break;
case M_REMAKELISTS:
{
int i;
char idstr[33];
TCHAR number[20];
//e-mails
ListView_DeleteAllItems(GetDlgItem(hwndDlg, IDC_EMAILS));
LVITEM lvi;
lvi.mask = LVIF_TEXT | LVIF_PARAM;
lvi.iSubItem = 0;
lvi.iItem = 0;
for (i=0;;i++) {
mir_snprintf(idstr, "e-mail%d", i);
ptrT email( ppro->getTStringA(idstr));
if (email == NULL) break;
mir_sntprintf(number, _T("%d"), i+1);
lvi.pszText = number;
lvi.lParam = (LPARAM)i;
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_EMAILS), &lvi);
ListView_SetItemText(GetDlgItem(hwndDlg, IDC_EMAILS), lvi.iItem, 1, email);
lvi.iItem++;
}
lvi.mask = LVIF_PARAM;
lvi.lParam = -1;
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_EMAILS), &lvi);
//phones
ListView_DeleteAllItems(GetDlgItem(hwndDlg, IDC_PHONES));
lvi.mask = LVIF_TEXT | LVIF_PARAM;
lvi.iSubItem = 0;
lvi.iItem = 0;
for (i=0;;i++) {
mir_snprintf(idstr, "Phone%d", i);
ptrT phone( ppro->getTStringA(idstr));
if (phone == NULL) break;
mir_sntprintf(number, _T("%d"), i+1);
lvi.pszText = number;
lvi.lParam = (LPARAM)i;
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_PHONES), &lvi);
ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PHONES), lvi.iItem, 1, phone);
lvi.iItem++;
}
lvi.mask = LVIF_PARAM;
lvi.lParam = -1;
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_PHONES), &lvi);
}
break;
case WM_NOTIFY:
switch (((LPNMHDR)lParam)->idFrom) {
case 0:
switch (((LPNMHDR)lParam)->code) {
case PSN_PARAMCHANGED:
SendMessage(hwndDlg, WM_INITDIALOG, 0, ((PSHNOTIFY*)lParam)->lParam);
break;
case PSN_APPLY:
ppro->m_vCardUpdates &= ~(1UL << iPageId);
ppro->SaveVcardToDB(hwndDlg, iPageId);
if (!ppro->m_vCardUpdates)
ppro->SetServerVcard(ppro->m_bPhotoChanged, ppro->m_szPhotoFileName);
//.........这里部分代码省略.........
示例8: WorkDlgProc
static INT_PTR CALLBACK WorkDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
const unsigned long iPageId = 2;
CJabberProto *ppro = (CJabberProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
switch (msg) {
case WM_INITDIALOG:
if (lParam) { // proto info is available
ppro = (CJabberProto*)lParam;
TranslateDialogDefault(hwndDlg);
for (int i = 0; i < g_cbCountries; i++) {
if (g_countries[i].id != 0xFFFF && g_countries[i].id != 0) {
TCHAR *country = mir_a2t(g_countries[i].szName);
SendDlgItemMessage(hwndDlg, IDC_COUNTRY, CB_ADDSTRING, 0, (LPARAM)TranslateTS(country));
mir_free(country);
}
}
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
SendMessage(hwndDlg, WM_JABBER_REFRESH_VCARD, 0, 0);
ppro->WindowSubscribe(hwndDlg);
}
break;
case WM_JABBER_REFRESH_VCARD:
SetDialogField(ppro, hwndDlg, IDC_COMPANY, "Company");
SetDialogField(ppro, hwndDlg, IDC_DEPARTMENT, "CompanyDepartment");
SetDialogField(ppro, hwndDlg, IDC_TITLE, "CompanyPosition");
SetDialogField(ppro, hwndDlg, IDC_ADDRESS1, "CompanyStreet");
SetDialogField(ppro, hwndDlg, IDC_ADDRESS2, "CompanyStreet2");
SetDialogField(ppro, hwndDlg, IDC_CITY, "CompanyCity");
SetDialogField(ppro, hwndDlg, IDC_STATE, "CompanyState");
SetDialogField(ppro, hwndDlg, IDC_ZIP, "CompanyZIP");
SetDialogField(ppro, hwndDlg, IDC_COUNTRY, "CompanyCountry", true);
break;
case WM_COMMAND:
if (((HWND)lParam == GetFocus() && HIWORD(wParam) == EN_CHANGE) ||
((HWND)lParam == GetDlgItem(hwndDlg, IDC_COUNTRY) && (HIWORD(wParam) == CBN_EDITCHANGE || HIWORD(wParam) == CBN_SELCHANGE)))
{
ppro->m_vCardUpdates |= (1UL << iPageId);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
break;
case WM_NOTIFY:
if (((LPNMHDR)lParam)->idFrom == 0) {
switch (((LPNMHDR)lParam)->code) {
case PSN_PARAMCHANGED:
SendMessage(hwndDlg, WM_INITDIALOG, 0, ((PSHNOTIFY*)lParam)->lParam);
break;
case PSN_APPLY:
ppro->m_vCardUpdates &= ~(1UL << iPageId);
ppro->SaveVcardToDB(hwndDlg, iPageId);
if (!ppro->m_vCardUpdates)
ppro->SetServerVcard(ppro->m_bPhotoChanged, ppro->m_szPhotoFileName);
break;
}
}
break;
case WM_DESTROY:
ppro->WindowUnsubscribe(hwndDlg);
break;
}
return FALSE;
}
示例9: JabberFileServerConnection
void JabberFileServerConnection(JABBER_SOCKET hConnection, DWORD /*dwRemoteIP*/, void* extra)
{
CJabberProto *ppro = (CJabberProto*)extra;
NETLIBCONNINFO connInfo = { sizeof(connInfo) };
CallService(MS_NETLIB_GETCONNECTIONINFO, (WPARAM)hConnection, (LPARAM)&connInfo);
TCHAR szPort[10];
mir_sntprintf(szPort, _countof(szPort), _T("%d"), connInfo.wPort);
ppro->debugLogA("File server incoming connection accepted: %s", connInfo.szIpPort);
JABBER_LIST_ITEM *item = ppro->ListGetItemPtr(LIST_FILE, szPort);
if (item == NULL) {
ppro->debugLogA("No file is currently served, file server connection closed.");
Netlib_CloseHandle(hConnection);
return;
}
filetransfer *ft = item->ft;
JABBER_SOCKET slisten = ft->s;
ft->s = hConnection;
ppro->debugLogA("Set ft->s to %d (saving %d)", hConnection, slisten);
char* buffer = (char*)mir_alloc(JABBER_NETWORK_BUFFER_SIZE + 1);
if (buffer == NULL) {
ppro->debugLogA("Cannot allocate network buffer, file server connection closed.");
Netlib_CloseHandle(hConnection);
ft->state = FT_ERROR;
if (ft->hFileEvent != NULL)
SetEvent(ft->hFileEvent);
return;
}
ppro->debugLogA("Entering recv loop for this file connection... (ft->s is hConnection)");
int datalen = 0;
while (ft->state != FT_DONE && ft->state != FT_ERROR) {
int recvResult, bytesParsed;
recvResult = Netlib_Recv(hConnection, buffer + datalen, JABBER_NETWORK_BUFFER_SIZE - datalen, 0);
if (recvResult <= 0)
break;
datalen += recvResult;
buffer[datalen] = '\0';
ppro->debugLogA("RECV:%s", buffer);
bytesParsed = ppro->FileSendParse(hConnection, ft, buffer, datalen);
if (bytesParsed < datalen)
memmove(buffer, buffer + bytesParsed, datalen - bytesParsed);
datalen -= bytesParsed;
}
ppro->debugLogA("Closing connection for this file transfer... (ft->s is now hBind)");
Netlib_CloseHandle(hConnection);
ft->s = slisten;
ppro->debugLogA("ft->s is restored to %d", ft->s);
if (ft->hFileEvent != NULL)
SetEvent(ft->hFileEvent);
mir_free(buffer);
}
示例10: JabberMenuHandleDirectPresence
static INT_PTR JabberMenuHandleDirectPresence(WPARAM wParam, LPARAM lParam, LPARAM lRes)
{
CJabberProto *ppro = JabberGetInstanceByHContact(wParam);
return(ppro) ? ppro->OnMenuHandleDirectPresence(wParam, lParam, lRes) : 0;
}
示例11: JabberMenuSendNote
static INT_PTR JabberMenuSendNote(WPARAM wParam, LPARAM lParam)
{
CJabberProto *ppro = JabberGetInstanceByHContact(wParam);
return(ppro) ? ppro->OnMenuSendNote(wParam, lParam) : 0;
}
示例12: JabberContactMenuRunCommands
static INT_PTR JabberContactMenuRunCommands(WPARAM wParam, LPARAM lParam)
{
CJabberProto *ppro = JabberGetInstanceByHContact(wParam);
return(ppro) ? ppro->ContactMenuRunCommands(wParam, lParam) : 0;
}
示例13: JabberMenuTransportLogin
static INT_PTR JabberMenuTransportLogin(WPARAM wParam, LPARAM lParam)
{
CJabberProto *ppro = JabberGetInstanceByHContact(wParam);
return(ppro) ? ppro->OnMenuTransportLogin(wParam, lParam) : 0;
}
示例14: JabberChangePasswordDlgProc
static INT_PTR CALLBACK JabberChangePasswordDlgProc( HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam )
{
CJabberProto* ppro = (CJabberProto*)GetWindowLongPtr( hwndDlg, GWLP_USERDATA );
switch ( msg ) {
case WM_INITDIALOG:
ppro = (CJabberProto*)lParam;
SetWindowLongPtr( hwndDlg, GWLP_USERDATA, ( LONG_PTR )lParam );
WindowSetIcon( hwndDlg, ppro, "key" );
TranslateDialogDefault( hwndDlg );
if ( ppro->m_bJabberOnline && ppro->m_ThreadInfo!=NULL ) {
TCHAR text[1024];
mir_sntprintf( text, SIZEOF( text ), _T("%s %[email protected]") _T(TCHAR_STR_PARAM), TranslateT( "Set New Password for" ), ppro->m_ThreadInfo->username, ppro->m_ThreadInfo->server );
SetWindowText( hwndDlg, text );
}
return TRUE;
case WM_COMMAND:
switch ( LOWORD( wParam )) {
case IDOK:
if ( ppro->m_bJabberOnline && ppro->m_ThreadInfo!=NULL ) {
TCHAR newPasswd[512], text[512];
GetDlgItemText( hwndDlg, IDC_NEWPASSWD, newPasswd, SIZEOF( newPasswd ));
GetDlgItemText( hwndDlg, IDC_NEWPASSWD2, text, SIZEOF( text ));
if ( _tcscmp( newPasswd, text )) {
MessageBox( hwndDlg, TranslateT( "New password does not match." ), TranslateT( "Change Password" ), MB_OK|MB_ICONSTOP|MB_SETFOREGROUND );
break;
}
GetDlgItemText( hwndDlg, IDC_OLDPASSWD, text, SIZEOF( text ));
if ( _tcscmp( text, ppro->m_ThreadInfo->password )) {
MessageBox( hwndDlg, TranslateT( "Current password is incorrect." ), TranslateT( "Change Password" ), MB_OK|MB_ICONSTOP|MB_SETFOREGROUND );
break;
}
_tcsncpy( ppro->m_ThreadInfo->newPassword, newPasswd, SIZEOF( ppro->m_ThreadInfo->newPassword ));
int iqId = ppro->SerialNext();
ppro->IqAdd( iqId, IQ_PROC_NONE, &CJabberProto::OnIqResultSetPassword );
XmlNodeIq iq( _T("set"), iqId, _A2T(ppro->m_ThreadInfo->server));
HXML q = iq << XQUERY( _T(JABBER_FEAT_REGISTER));
q << XCHILD( _T("username"), ppro->m_ThreadInfo->username );
q << XCHILD( _T("password"), newPasswd );
ppro->m_ThreadInfo->send( iq );
}
DestroyWindow( hwndDlg );
break;
case IDCANCEL:
DestroyWindow( hwndDlg );
break;
}
break;
case WM_CLOSE:
DestroyWindow( hwndDlg );
break;
case WM_DESTROY:
ppro->m_hwndJabberChangePassword = NULL;
WindowFreeIcon( hwndDlg );
break;
}
return FALSE;
}
示例15: loadRecent
BOOL loadRecent(int iRecent)
{
DBVARIANT dbv;
char setting[MAXMODULELABELLENGTH];
cleanup();
mir_snprintf(setting, sizeof(setting), "rcMuc_%d_server", iRecent);
if ( !ppro->JGetStringT( NULL, setting, &dbv )) {
server = mir_tstrdup( dbv.ptszVal );
JFreeVariant( &dbv );
}
mir_snprintf(setting, sizeof(setting), "rcMuc_%d_room", iRecent);
if ( !ppro->JGetStringT( NULL, setting, &dbv )) {
room = mir_tstrdup(dbv.ptszVal);
JFreeVariant( &dbv );
}
mir_snprintf(setting, sizeof(setting), "rcMuc_%d_nick", iRecent);
if ( !ppro->JGetStringT( NULL, setting, &dbv )) {
nick = mir_tstrdup(dbv.ptszVal);
JFreeVariant( &dbv );
}
mir_snprintf(setting, sizeof(setting), "rcMuc_%d_passwordW", iRecent);
password = ppro->JGetStringCrypt(NULL, setting);
return room || server || nick || password;
}