From 597d5a26ad80b3e45d4863c5083994900dfd54ec Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 28 May 2012 15:20:02 +0000 Subject: collection of various fixes from the forums git-svn-id: http://svn.miranda-ng.org/main/trunk@215 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- include/m_version.h | 8 +++---- protocols/IcqOscarJ/icq_clients.cpp | 2 ++ protocols/IcqOscarJ/icq_opts.cpp | 40 +++++++++++++++++----------------- protocols/IcqOscarJ/icq_packet.cpp | 19 +++++++--------- protocols/IcqOscarJ/icq_popups.cpp | 16 +++++++++++++- protocols/JabberG/jabber_groupchat.cpp | 23 ++++++++++++++++++- 6 files changed, 71 insertions(+), 37 deletions(-) diff --git a/include/m_version.h b/include/m_version.h index b4e2498b2d..3e4129d315 100644 --- a/include/m_version.h +++ b/include/m_version.h @@ -27,10 +27,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define MIRANDA_MAKE_VERSION(a,b,c,d) (((((DWORD)(a))&0xFF)<<24)|((((DWORD)(b))&0xFF)<<16)|((((DWORD)(c))&0xFF)<<8)|(((DWORD)(d))&0xFF)) #endif -#define MIRANDA_VERSION_FILEVERSION 0,92,1,198 -#define MIRANDA_VERSION_STRING "0.92.1.198" -#define MIRANDA_VERSION_DISPLAY "0.92.1 alpha build #198" -#define MIRANDA_VERSION_DWORD MIRANDA_MAKE_VERSION(0, 92, 1, 198) +#define MIRANDA_VERSION_FILEVERSION 0,92,1,207 +#define MIRANDA_VERSION_STRING "0.92.1.207" +#define MIRANDA_VERSION_DISPLAY "0.92.1 alpha build #207" +#define MIRANDA_VERSION_DWORD MIRANDA_MAKE_VERSION(0, 92, 1, 207) #define MIRANDA_VERSION_CORE MIRANDA_MAKE_VERSION(0, 92, 1, 0) #define MIRANDA_VERSION_CORE_STRING "0.92.1.0" diff --git a/protocols/IcqOscarJ/icq_clients.cpp b/protocols/IcqOscarJ/icq_clients.cpp index 8c028a424e..b09b2fb785 100644 --- a/protocols/IcqOscarJ/icq_clients.cpp +++ b/protocols/IcqOscarJ/icq_clients.cpp @@ -1066,6 +1066,8 @@ const char* CIcqProto::detectUserClient(HANDLE hContact, int nIsICQ, WORD wUserC else szClient = "AIM"; } + else if(wUserClass & CLASS_WIRELESS) + szClient = "AIM (Mobile)"; else szClient = "AIM"; } diff --git a/protocols/IcqOscarJ/icq_opts.cpp b/protocols/IcqOscarJ/icq_opts.cpp index 1dca3b4e85..d7433ea978 100644 --- a/protocols/IcqOscarJ/icq_opts.cpp +++ b/protocols/IcqOscarJ/icq_opts.cpp @@ -1,22 +1,22 @@ // ---------------------------------------------------------------------------80 // ICQ plugin for Miranda Instant Messenger // ________________________________________ -// +// // Copyright © 2000-2001 Richard Hughes, Roland Rabien, Tristan Van de Vreede // Copyright © 2001-2002 Jon Keating, Richard Hughes // Copyright © 2002-2004 Martin Öberg, Sam Kothari, Robert Rainwater // Copyright © 2004-2010 Joe Kucera -// +// // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. -// +// // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. @@ -208,7 +208,7 @@ static INT_PTR CALLBACK DlgProcIcqOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP ///////////////////////////////////////////////////////////////////////////////////////// static const UINT icqPrivacyControls[] = { - IDC_DCALLOW_ANY, IDC_DCALLOW_CLIST, IDC_DCALLOW_AUTH, IDC_ADD_ANY, IDC_ADD_AUTH, + IDC_DCALLOW_ANY, IDC_DCALLOW_CLIST, IDC_DCALLOW_AUTH, IDC_ADD_ANY, IDC_ADD_AUTH, IDC_WEBAWARE, IDC_PUBLISHPRIMARY, IDC_STATIC_DC1, IDC_STATIC_DC2, IDC_STATIC_CLIST }; @@ -231,7 +231,7 @@ static INT_PTR CALLBACK DlgProcIcqPrivacyOpts(HWND hwndDlg, UINT msg, WPARAM wPa icq_EnableMultipleControls(hwndDlg, icqPrivacyControls, SIZEOF(icqPrivacyControls), FALSE); ShowDlgItem(hwndDlg, IDC_STATIC_NOTONLINE, SW_SHOW); } - else + else ShowDlgItem(hwndDlg, IDC_STATIC_NOTONLINE, SW_HIDE); CheckDlgButton(hwndDlg, IDC_DCALLOW_ANY, (nDcType == 0)); @@ -261,12 +261,12 @@ static INT_PTR CALLBACK DlgProcIcqPrivacyOpts(HWND hwndDlg, UINT msg, WPARAM wPa if ((HWND)lParam != GetFocus()) return 0; break; case IDC_STATUSMSG_CLIST: - if (IsDlgButtonChecked(hwndDlg, IDC_STATUSMSG_CLIST)) + if (IsDlgButtonChecked(hwndDlg, IDC_STATUSMSG_CLIST)) { EnableDlgItem(hwndDlg, IDC_STATUSMSG_VISIBLE, TRUE); LoadDBCheckState(ppro, hwndDlg, IDC_STATUSMSG_VISIBLE, "StatusMsgReplyVisible", 0); } - else + else { EnableDlgItem(hwndDlg, IDC_STATUSMSG_VISIBLE, FALSE); CheckDlgButton(hwndDlg, IDC_STATUSMSG_VISIBLE, FALSE); @@ -289,7 +289,7 @@ static INT_PTR CALLBACK DlgProcIcqPrivacyOpts(HWND hwndDlg, UINT msg, WPARAM wPa ppro->setSettingByte(NULL, "DCType", 2); else if (IsDlgButtonChecked(hwndDlg, IDC_DCALLOW_CLIST)) ppro->setSettingByte(NULL, "DCType", 1); - else + else ppro->setSettingByte(NULL, "DCType", 0); StoreDBCheckState(ppro, hwndDlg, IDC_ADD_AUTH, "Auth"); @@ -329,7 +329,7 @@ static INT_PTR CALLBACK DlgProcIcqPrivacyOpts(HWND hwndDlg, UINT msg, WPARAM wPa break; } - return FALSE; + return FALSE; } ///////////////////////////////////////////////////////////////////////////////////////// @@ -367,7 +367,7 @@ static BOOL CALLBACK FillCpCombo(LPSTR str) cp = atoi(str); for (i=0; cpTable[i].cpName != NULL && cpTable[i].cpId!=cp; i++); - if (cpTable[i].cpName) + if (cpTable[i].cpName) ComboBoxAddStringUtf(hCpCombo, cpTable[i].cpName, cpTable[i].cpId); return TRUE; @@ -421,9 +421,9 @@ static INT_PTR CALLBACK DlgProcIcqFeaturesOpts(HWND hwndDlg, UINT msg, WPARAM wP EnumSystemCodePagesA(FillCpCombo, CP_INSTALLED); if(sCodePage == 0) SendDlgItemMessage(hwndDlg, IDC_UTFCODEPAGE, CB_SETCURSEL, (WPARAM)0, 0); - else + else { - for (int i = 0; i < SendDlgItemMessage(hwndDlg, IDC_UTFCODEPAGE, CB_GETCOUNT, 0, 0); i++) + for (int i = 0; i < SendDlgItemMessage(hwndDlg, IDC_UTFCODEPAGE, CB_GETCOUNT, 0, 0); i++) { if (SendDlgItemMessage(hwndDlg, IDC_UTFCODEPAGE, CB_GETITEMDATA, (WPARAM)i, 0) == sCodePage) { @@ -451,8 +451,8 @@ static INT_PTR CALLBACK DlgProcIcqFeaturesOpts(HWND hwndDlg, UINT msg, WPARAM wP break; case IDC_XSTATUSENABLE: icq_EnableMultipleControls(hwndDlg, icqXStatusControls, SIZEOF(icqXStatusControls), IsDlgButtonChecked(hwndDlg, IDC_XSTATUSENABLE)); - case IDC_MOODSENABLE: - icq_EnableMultipleControls(hwndDlg, icqCustomStatusControls, SIZEOF(icqCustomStatusControls), IsDlgButtonChecked(hwndDlg, IDC_XSTATUSENABLE) || IsDlgButtonChecked(hwndDlg, IDC_MOODSENABLE)); + case IDC_MOODSENABLE: + icq_EnableMultipleControls(hwndDlg, icqCustomStatusControls, SIZEOF(icqCustomStatusControls), IsDlgButtonChecked(hwndDlg, IDC_XSTATUSENABLE) || IsDlgButtonChecked(hwndDlg, IDC_MOODSENABLE)); default: OptDlgChanged(hwndDlg); break; @@ -518,9 +518,9 @@ static INT_PTR CALLBACK DlgProcIcqContactsOpts(HWND hwndDlg, UINT msg, WPARAM wP LoadDBCheckState(ppro, hwndDlg, IDC_AUTOLOADAVATARS, "AvatarsAutoLoad", DEFAULT_LOAD_AVATARS); LoadDBCheckState(ppro, hwndDlg, IDC_STRICTAVATARCHECK, "StrictAvatarCheck", DEFAULT_AVATARS_CHECK); - icq_EnableMultipleControls(hwndDlg, icqContactsControls, SIZEOF(icqContactsControls), + icq_EnableMultipleControls(hwndDlg, icqContactsControls, SIZEOF(icqContactsControls), ppro->getSettingByte(NULL, "UseServerCList", DEFAULT_SS_ENABLED)?TRUE:FALSE); - icq_EnableMultipleControls(hwndDlg, icqAvatarControls, SIZEOF(icqAvatarControls), + icq_EnableMultipleControls(hwndDlg, icqAvatarControls, SIZEOF(icqAvatarControls), ppro->getSettingByte(NULL, "AvatarsEnabled", DEFAULT_AVATARS_ENABLED)?TRUE:FALSE); if (ppro->icqOnline()) @@ -541,9 +541,9 @@ static INT_PTR CALLBACK DlgProcIcqContactsOpts(HWND hwndDlg, UINT msg, WPARAM wP return TRUE; case IDC_ENABLE: icq_EnableMultipleControls(hwndDlg, icqContactsControls, SIZEOF(icqContactsControls), IsDlgButtonChecked(hwndDlg, IDC_ENABLE)); - if (ppro->icqOnline()) + if (ppro->icqOnline()) ShowDlgItem(hwndDlg, IDC_RECONNECTREQD, SW_SHOW); - else + else EnableDlgItem(hwndDlg, IDC_UPLOADNOW, FALSE); break; case IDC_ENABLEAVATARS: @@ -582,7 +582,7 @@ int CIcqProto::OnOptionsInit(WPARAM wParam, LPARAM lParam) if (IsWinVerXPPlus()) { hUxTheme = GetModuleHandleA("uxtheme.dll"); - if (hUxTheme) + if (hUxTheme) pfnEnableThemeDialogTexture = (BOOL (WINAPI *)(HANDLE, DWORD))GetProcAddress(hUxTheme, "EnableThemeDialogTexture"); } diff --git a/protocols/IcqOscarJ/icq_packet.cpp b/protocols/IcqOscarJ/icq_packet.cpp index 7642c82ace..3de6bd055b 100644 --- a/protocols/IcqOscarJ/icq_packet.cpp +++ b/protocols/IcqOscarJ/icq_packet.cpp @@ -198,17 +198,14 @@ void packBuffer(icq_packet *pPacket, const BYTE* pbyBuffer, WORD wLength) //} int __fastcall getUINLen(DWORD dwUin) -{ // TODO: invent something more clever - if (dwUin >= 1000000000) return 10; - if (dwUin >= 100000000) return 9; - if (dwUin >= 10000000) return 8; - if (dwUin >= 1000000) return 7; - if (dwUin >= 100000) return 6; - if (dwUin >= 10000) return 5; - if (dwUin >= 1000) return 4; - if (dwUin >= 100) return 3; - if (dwUin >= 10) return 2; - return 1; +{ + BYTE dwUinLen = 0; + + while(dwUin) { + dwUin /= 10; + dwUinLen += 1; + } + return dwUinLen; } int __fastcall getUIDLen(DWORD dwUin, const char *szUid) diff --git a/protocols/IcqOscarJ/icq_popups.cpp b/protocols/IcqOscarJ/icq_popups.cpp index d40b2526a1..e1cdadada6 100644 --- a/protocols/IcqOscarJ/icq_popups.cpp +++ b/protocols/IcqOscarJ/icq_popups.cpp @@ -58,11 +58,13 @@ static const UINT icqPopupColorControls[] = { INT_PTR CALLBACK DlgProcIcqPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { + static bool bInitDone = true; BYTE bEnabled; CIcqProto* ppro = (CIcqProto*)GetWindowLongPtr( hwndDlg, GWLP_USERDATA ); switch (msg) { case WM_INITDIALOG: + bInitDone = false; TranslateDialogDefault(hwndDlg); ppro = (CIcqProto*)lParam; @@ -93,6 +95,7 @@ INT_PTR CALLBACK DlgProcIcqPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR CheckDlgButton(hwndDlg, IDC_POPUPS_ENABLED, bEnabled); icq_EnableMultipleControls(hwndDlg, icqPopupsControls, SIZEOF(icqPopupsControls), bEnabled); icq_EnableMultipleControls(hwndDlg, icqPopupColorControls, SIZEOF(icqPopupColorControls), bEnabled & !IsDlgButtonChecked(hwndDlg,IDC_USEWINCOLORS)); + bInitDone = true; return TRUE; case WM_COMMAND: @@ -114,9 +117,20 @@ INT_PTR CALLBACK DlgProcIcqPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR case IDC_USEWINCOLORS: bEnabled = IsDlgButtonChecked(hwndDlg,IDC_POPUPS_ENABLED); icq_EnableMultipleControls(hwndDlg, icqPopupColorControls, SIZEOF(icqPopupColorControls), bEnabled & !IsDlgButtonChecked(hwndDlg,IDC_USEWINCOLORS)); + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + break; + case IDC_POPUP_LOG0_TIMEOUT: + case IDC_POPUP_LOG1_TIMEOUT: + case IDC_POPUP_LOG2_TIMEOUT: + case IDC_POPUP_LOG3_TIMEOUT: + case IDC_POPUP_SPAM_TIMEOUT: + if((HIWORD(wParam) == EN_CHANGE) && bInitDone) + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + break; + default: + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; } - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; case WM_NOTIFY: diff --git a/protocols/JabberG/jabber_groupchat.cpp b/protocols/JabberG/jabber_groupchat.cpp index c68f0d4b68..eb2ae55adb 100644 --- a/protocols/JabberG/jabber_groupchat.cpp +++ b/protocols/JabberG/jabber_groupchat.cpp @@ -319,6 +319,22 @@ void CJabberProto::GroupchatJoinRoom( const TCHAR* server, const TCHAR* room, co XmlNode x( _T("x")); x << XATTR( _T("xmlns"), _T(JABBER_FEAT_MUC)); if ( info.password && info.password[0] ) x << XCHILD( _T("password"), info.password ); + + char setting[MAXMODULELABELLENGTH]; + DBVARIANT dbv; + mir_snprintf(setting, sizeof(setting), "muc_%s@%s_lastevent", mir_u2a(room), mir_u2a(server)); + time_t lasteventtime = this->JGetDword( NULL, setting, 0 ); + if ( lasteventtime > 0 ) { + _tzset(); + lasteventtime += _timezone + 1; + struct tm* time = localtime(&lasteventtime); + TCHAR lasteventdate[20]; + TCHAR* timeformat = mir_a2u("%04d-%02d-%02dT%02d:%02d:%02dZ"); + mir_sntprintf(lasteventdate, sizeof(lasteventdate), timeformat, time->tm_year+1900, time->tm_mon+1, time->tm_mday, time->tm_hour, time->tm_min, time->tm_sec); + x << XCHILD( _T("history") ) << XATTR( _T("since"), lasteventdate); + JFreeVariant( &dbv ); + } + SendPresenceTo( status, text, x ); } @@ -1232,8 +1248,13 @@ void CJabberProto::GroupchatProcessMessage( HXML node ) for ( int i = 1; ( xNode = xmlGetNthChild( node, _T("x"), i )) != NULL; i++ ) if (( p = xmlGetAttrValue( xNode, _T("xmlns"))) != NULL ) if ( !_tcscmp( p, _T("jabber:x:delay")) && msgTime==0 ) - if (( p = xmlGetAttrValue( xNode, _T("stamp"))) != NULL ) + if (( p = xmlGetAttrValue( xNode, _T("stamp"))) != NULL ) { msgTime = JabberIsoToUnixTime( p ); + if ( msgTime > 0 ) { + char setting[MAXMODULELABELLENGTH]; + mir_snprintf(setting, sizeof(setting), "muc_%s_lastevent", mir_u2a(gcd.ptszID)); + this->JSetDword(NULL, setting, msgTime); + } } time_t now = time( NULL ); if ( msgTime == 0 || msgTime > now ) -- cgit v1.2.3