From 253783569bef2320d04fe1d310709c64c64fd3a1 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 16 Feb 2014 18:08:37 +0000 Subject: - custom list of time zones removed; - adaptation of ICQ for new Time API; - code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@8140 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/IcqOscarJ/src/UI/userinfotab.cpp | 148 ++- protocols/IcqOscarJ/src/changeinfo/constants.cpp | 233 ++--- protocols/IcqOscarJ/src/changeinfo/db.cpp | 144 +-- protocols/IcqOscarJ/src/changeinfo/dlgproc.cpp | 272 +++--- protocols/IcqOscarJ/src/changeinfo/editlist.cpp | 117 +-- protocols/IcqOscarJ/src/changeinfo/editstring.cpp | 148 ++- protocols/IcqOscarJ/src/icq_advsearch.cpp | 32 +- protocols/IcqOscarJ/src/icq_db.cpp | 13 +- protocols/IcqOscarJ/src/icq_fieldnames.cpp | 1015 +++++++++++---------- protocols/IcqOscarJ/src/icq_fieldnames.h | 1 + protocols/IcqOscarJ/src/icq_opts.cpp | 147 ++- protocols/IcqOscarJ/src/icqoscar.h | 1 + protocols/IcqOscarJ/src/init.cpp | 28 +- protocols/IcqOscarJ/src/utilities.cpp | 144 +-- protocols/IcqOscarJ/src/version.h | 2 +- 15 files changed, 1177 insertions(+), 1268 deletions(-) (limited to 'protocols/IcqOscarJ/src') diff --git a/protocols/IcqOscarJ/src/UI/userinfotab.cpp b/protocols/IcqOscarJ/src/UI/userinfotab.cpp index a70d2d49e5..f015918ad0 100644 --- a/protocols/IcqOscarJ/src/UI/userinfotab.cpp +++ b/protocols/IcqOscarJ/src/UI/userinfotab.cpp @@ -43,7 +43,7 @@ extern const char *nameXStatus[]; static void SetValue(CIcqProto* ppro, HWND hwndDlg, int idCtrl, MCONTACT hContact, char* szModule, char* szSetting, int special) { - DBVARIANT dbv = {0}; + DBVARIANT dbv = { 0 }; char str[MAX_PATH]; char* pstr = NULL; int unspecified = 0; @@ -51,11 +51,10 @@ static void SetValue(CIcqProto* ppro, HWND hwndDlg, int idCtrl, MCONTACT hContac dbv.type = DBVT_DELETED; - if ((hContact == NULL) && ((int)szModule<0x100)) - { + if ((hContact == NULL) && ((int)szModule < 0x100)) { dbv.type = (BYTE)szModule; - switch((int)szModule) { + switch ((int)szModule) { case DBVT_BYTE: dbv.cVal = (BYTE)szSetting; break; @@ -82,26 +81,22 @@ static void SetValue(CIcqProto* ppro, HWND hwndDlg, int idCtrl, MCONTACT hContac } } - if (!unspecified) - { + if (!unspecified) { switch (dbv.type) { case DBVT_BYTE: unspecified = (special == SVS_ZEROISUNSPEC && dbv.bVal == 0); - pstr = _itoa(special == SVS_SIGNED ? dbv.cVal:dbv.bVal, str, 10); + pstr = _itoa(special == SVS_SIGNED ? dbv.cVal : dbv.bVal, str, 10); break; case DBVT_WORD: - if (special == SVS_ICQVERSION) - { - if (dbv.wVal != 0) - { + if (special == SVS_ICQVERSION) { + if (dbv.wVal != 0) { char szExtra[80]; mir_snprintf(str, 250, "%d", dbv.wVal); pstr = str; - if (hContact && ppro->IsDirectConnectionOpen(hContact, DIRECTCONN_STANDARD, 1)) - { + if (hContact && ppro->IsDirectConnectionOpen(hContact, DIRECTCONN_STANDARD, 1)) { ICQTranslateUtfStatic(LPGEN(" (DC Established)"), szExtra, 80); strcat(str, (char*)szExtra); bUtf = 1; @@ -110,18 +105,15 @@ static void SetValue(CIcqProto* ppro, HWND hwndDlg, int idCtrl, MCONTACT hContac else unspecified = 1; } - else if (special == SVS_STATUSID) - { + else if (special == SVS_STATUSID) { char *pXName; char *pszStatus = MirandaStatusToStringUtf(dbv.wVal); BYTE bXStatus = ppro->getContactXStatus(hContact); - if (bXStatus) - { + if (bXStatus) { pXName = ppro->getSettingStringUtf(hContact, DBSETTING_XSTATUS_NAME, NULL); - if (!strlennull(pXName)) - { // give default name - pXName = ICQTranslateUtf(nameXStatus[bXStatus-1]); + if (!strlennull(pXName)) { // give default name + pXName = ICQTranslateUtf(nameXStatus[bXStatus - 1]); } mir_snprintf(str, sizeof(str), "%s (%s)", pszStatus, pXName); SAFE_FREE((void**)&pXName); @@ -134,39 +126,35 @@ static void SetValue(CIcqProto* ppro, HWND hwndDlg, int idCtrl, MCONTACT hContac pstr = str; unspecified = 0; } - else - { + else { unspecified = (special == SVS_ZEROISUNSPEC && dbv.wVal == 0); - pstr = _itoa(special == SVS_SIGNED ? dbv.sVal:dbv.wVal, str, 10); + pstr = _itoa(special == SVS_SIGNED ? dbv.sVal : dbv.wVal, str, 10); } break; case DBVT_DWORD: unspecified = (special == SVS_ZEROISUNSPEC && dbv.dVal == 0); - if (special == SVS_IP) - { + if (special == SVS_IP) { struct in_addr ia; ia.S_un.S_addr = htonl(dbv.dVal); pstr = inet_ntoa(ia); if (dbv.dVal == 0) - unspecified=1; + unspecified = 1; } - else if (special == SVS_TIMESTAMP) - { + else if (special == SVS_TIMESTAMP) { if (dbv.dVal == 0) unspecified = 1; else pstr = time2text(dbv.dVal); } else - pstr = _itoa(special == SVS_SIGNED ? dbv.lVal:dbv.dVal, str, 10); + pstr = _itoa(special == SVS_SIGNED ? dbv.lVal : dbv.dVal, str, 10); break; case DBVT_ASCIIZ: case DBVT_WCHAR: unspecified = (special == SVS_ZEROISUNSPEC && dbv.pszVal[0] == '\0'); - if (!unspecified && pstr != szSetting) - { + if (!unspecified && pstr != szSetting) { pstr = ppro->getSettingStringUtf(hContact, szModule, szSetting, NULL); bUtf = 1; bAlloc = 1; @@ -177,7 +165,7 @@ static void SetValue(CIcqProto* ppro, HWND hwndDlg, int idCtrl, MCONTACT hContac default: pstr = str; - strcpy(str,"???"); + strcpy(str, "???"); break; } } @@ -211,67 +199,61 @@ static INT_PTR CALLBACK IcqDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM case 0: switch (((LPNMHDR)lParam)->code) { case PSN_PARAMCHANGED: - SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (( PSHNOTIFY* )lParam )->lParam ); + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, ((PSHNOTIFY*)lParam)->lParam); break; case PSN_INFOCHANGED: - { - CIcqProto* ppro = (CIcqProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - if (!ppro) - break; - - char* szProto; - MCONTACT hContact = (MCONTACT)((LPPSHNOTIFY)lParam)->lParam; - - if (hContact == NULL) - szProto = ppro->m_szModuleName; - else - szProto = GetContactProto(hContact); - - if (!szProto) - break; - - SetValue(ppro, hwndDlg, IDC_UIN, hContact, szProto, UNIQUEIDSETTING, SVS_NORMAL); - SetValue(ppro, hwndDlg, IDC_ONLINESINCE, hContact, szProto, "LogonTS", SVS_TIMESTAMP); - SetValue(ppro, hwndDlg, IDC_IDLETIME, hContact, szProto, "IdleTS", SVS_TIMESTAMP); - SetValue(ppro, hwndDlg, IDC_IP, hContact, szProto, "IP", SVS_IP); - SetValue(ppro, hwndDlg, IDC_REALIP, hContact, szProto, "RealIP", SVS_IP); - - if (hContact) - { - SetValue(ppro, hwndDlg, IDC_PORT, hContact, szProto, "UserPort", SVS_ZEROISUNSPEC); - SetValue(ppro, hwndDlg, IDC_VERSION, hContact, szProto, "Version", SVS_ICQVERSION); - SetValue(ppro, hwndDlg, IDC_MIRVER, hContact, szProto, "MirVer", SVS_ZEROISUNSPEC); - if (ppro->getByte(hContact, "ClientID", 0)) - ppro->setDword(hContact, "TickTS", 0); - SetValue(ppro, hwndDlg, IDC_SYSTEMUPTIME, hContact, szProto, "TickTS", SVS_TIMESTAMP); - SetValue(ppro, hwndDlg, IDC_STATUS, hContact, szProto, "Status", SVS_STATUSID); - } - else - { - char str[MAX_PATH]; - WORD v[4]; - CallService(MS_SYSTEM_GETFILEVERSION, 0, (LPARAM)&v); - mir_snprintf(str, SIZEOF(str), "Miranda NG %d.%d.%d.%d (ICQ %s)", v[0], v[1], v[2], v[3], __VERSION_STRING_DOTS); - - SetValue(ppro, hwndDlg, IDC_PORT, hContact, (char*)DBVT_WORD, (char*)ppro->wListenPort, SVS_ZEROISUNSPEC); - SetValue(ppro, hwndDlg, IDC_VERSION, hContact, (char*)DBVT_WORD, (char*)ICQ_VERSION, SVS_ICQVERSION); - SetValue(ppro, hwndDlg, IDC_MIRVER, hContact, (char*)DBVT_ASCIIZ, str, SVS_ZEROISUNSPEC); - SetDlgItemText(hwndDlg, IDC_SUPTIME, TranslateT("Member since:")); - SetValue(ppro, hwndDlg, IDC_SYSTEMUPTIME, hContact, szProto, "MemberTS", SVS_TIMESTAMP); - SetValue(ppro, hwndDlg, IDC_STATUS, hContact, (char*)DBVT_WORD, (char*)ppro->m_iStatus, SVS_STATUSID); - } + CIcqProto* ppro = (CIcqProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + if (!ppro) + break; + + char* szProto; + MCONTACT hContact = (MCONTACT)((LPPSHNOTIFY)lParam)->lParam; + + if (hContact == NULL) + szProto = ppro->m_szModuleName; + else + szProto = GetContactProto(hContact); + + if (!szProto) + break; + + SetValue(ppro, hwndDlg, IDC_UIN, hContact, szProto, UNIQUEIDSETTING, SVS_NORMAL); + SetValue(ppro, hwndDlg, IDC_ONLINESINCE, hContact, szProto, "LogonTS", SVS_TIMESTAMP); + SetValue(ppro, hwndDlg, IDC_IDLETIME, hContact, szProto, "IdleTS", SVS_TIMESTAMP); + SetValue(ppro, hwndDlg, IDC_IP, hContact, szProto, "IP", SVS_IP); + SetValue(ppro, hwndDlg, IDC_REALIP, hContact, szProto, "RealIP", SVS_IP); + + if (hContact) { + SetValue(ppro, hwndDlg, IDC_PORT, hContact, szProto, "UserPort", SVS_ZEROISUNSPEC); + SetValue(ppro, hwndDlg, IDC_VERSION, hContact, szProto, "Version", SVS_ICQVERSION); + SetValue(ppro, hwndDlg, IDC_MIRVER, hContact, szProto, "MirVer", SVS_ZEROISUNSPEC); + if (ppro->getByte(hContact, "ClientID", 0)) + ppro->setDword(hContact, "TickTS", 0); + SetValue(ppro, hwndDlg, IDC_SYSTEMUPTIME, hContact, szProto, "TickTS", SVS_TIMESTAMP); + SetValue(ppro, hwndDlg, IDC_STATUS, hContact, szProto, "Status", SVS_STATUSID); + } + else { + char str[MAX_PATH]; + WORD v[4]; + CallService(MS_SYSTEM_GETFILEVERSION, 0, (LPARAM)&v); + mir_snprintf(str, SIZEOF(str), "Miranda NG %d.%d.%d.%d (ICQ %s)", v[0], v[1], v[2], v[3], __VERSION_STRING_DOTS); + + SetValue(ppro, hwndDlg, IDC_PORT, hContact, (char*)DBVT_WORD, (char*)ppro->wListenPort, SVS_ZEROISUNSPEC); + SetValue(ppro, hwndDlg, IDC_VERSION, hContact, (char*)DBVT_WORD, (char*)ICQ_VERSION, SVS_ICQVERSION); + SetValue(ppro, hwndDlg, IDC_MIRVER, hContact, (char*)DBVT_ASCIIZ, str, SVS_ZEROISUNSPEC); + SetDlgItemText(hwndDlg, IDC_SUPTIME, TranslateT("Member since:")); + SetValue(ppro, hwndDlg, IDC_SYSTEMUPTIME, hContact, szProto, "MemberTS", SVS_TIMESTAMP); + SetValue(ppro, hwndDlg, IDC_STATUS, hContact, (char*)DBVT_WORD, (char*)ppro->m_iStatus, SVS_STATUSID); } - break; } - break; } break; case WM_COMMAND: - switch(LOWORD(wParam)) { + switch (LOWORD(wParam)) { case IDCANCEL: - SendMessage(GetParent(hwndDlg),msg,wParam,lParam); + SendMessage(GetParent(hwndDlg), msg, wParam, lParam); break; } break; diff --git a/protocols/IcqOscarJ/src/changeinfo/constants.cpp b/protocols/IcqOscarJ/src/changeinfo/constants.cpp index 394505a519..0148fba616 100644 --- a/protocols/IcqOscarJ/src/changeinfo/constants.cpp +++ b/protocols/IcqOscarJ/src/changeinfo/constants.cpp @@ -25,157 +25,108 @@ // ChangeInfo Plugin stuff // // ----------------------------------------------------------------------------- -#include "icqoscar.h" +#include "icqoscar.h" -static FieldNamesItem timezones[]={ - {24 ,LPGEN("GMT-12:00 Eniwetok; Kwajalein")}, - {23 ,LPGEN("GMT-11:30")}, - {22 ,LPGEN("GMT-11:00 Midway Island; Samoa")}, - {21 ,LPGEN("GMT-10:30")}, - {20 ,LPGEN("GMT-10:00 Hawaii")}, - {19 ,LPGEN("GMT-9:30")}, - {18 ,LPGEN("GMT-9:00 Alaska")}, - {17 ,LPGEN("GMT-8:30")}, - {16 ,LPGEN("GMT-8:00 Pacific Time; Tijuana")}, - {15 ,LPGEN("GMT-7:30")}, - {14 ,LPGEN("GMT-7:00 Arizona; Mountain Time")}, - {13 ,LPGEN("GMT-6:30")}, - {12 ,LPGEN("GMT-6:00 Central Time; Central America; Saskatchewan")}, - {11 ,LPGEN("GMT-5:30")}, - {10 ,LPGEN("GMT-5:00 Eastern Time; Bogota; Lima; Quito")}, - {9 ,LPGEN("GMT-4:30")}, - {8 ,LPGEN("GMT-4:00 Atlantic Time; Santiago; Caracas; La Paz")}, - {7 ,LPGEN("GMT-3:30 Newfoundland")}, - {6 ,LPGEN("GMT-3:00 Greenland; Buenos Aires; Georgetown")}, - {5 ,LPGEN("GMT-2:30")}, - {4 ,LPGEN("GMT-2:00 Mid-Atlantic")}, - {3 ,LPGEN("GMT-1:30")}, - {2 ,LPGEN("GMT-1:00 Cape Verde Islands; Azores")}, - {1 ,LPGEN("GMT-0:30")}, - {0 ,LPGEN("GMT+0:00 London; Dublin; Edinburgh; Lisbon; Casablanca")}, - {-1 ,LPGEN("GMT+0:30")}, - {-2 ,LPGEN("GMT+1:00 Central European Time; West Central Africa; Warsaw")}, - {-3 ,LPGEN("GMT+1:30")}, - {-4 ,LPGEN("GMT+2:00 Jerusalem; Helsinki; Harare; Cairo; Bucharest; Athens")}, - {-5 ,LPGEN("GMT+2:30")}, - {-6 ,LPGEN("GMT+3:00 Moscow; St. Petersburg; Nairobi; Kuwait; Baghdad")}, - {-7 ,LPGEN("GMT+3:30 Tehran")}, - {-8 ,LPGEN("GMT+4:00 Baku; Tbilisi; Yerevan; Abu Dhabi; Muscat")}, - {-9 ,LPGEN("GMT+4:30 Kabul")}, - {-10 ,LPGEN("GMT+5:00 Calcutta; Chennai; Mumbai; New Delhi; Ekaterinburg")}, - {-11 ,LPGEN("GMT+5:30")}, - {-12 ,LPGEN("GMT+6:00 Astana; Dhaka; Almaty; Novosibirsk; Sri Jayawardenepura")}, - {-13 ,LPGEN("GMT+6:30 Rangoon")}, - {-14 ,LPGEN("GMT+7:00 Bankok; Hanoi; Jakarta; Krasnoyarsk")}, - {-15 ,LPGEN("GMT+7:30")}, - {-16 ,LPGEN("GMT+8:00 Perth; Taipei; Singapore; Hong Kong; Beijing")}, - {-17 ,LPGEN("GMT+8:30")}, - {-18 ,LPGEN("GMT+9:00 Tokyo; Osaka; Seoul; Sapporo; Yakutsk")}, - {-19 ,LPGEN("GMT+9:30 Darwin; Adelaide")}, - {-20 ,LPGEN("GMT+10:00 East Australia; Guam; Vladivostok")}, - {-21 ,LPGEN("GMT+10:30")}, - {-22 ,LPGEN("GMT+11:00 Magadan; Solomon Is.; New Caledonia")}, - {-23 ,LPGEN("GMT+11:30")}, - {-24 ,LPGEN("GMT+12:00 Auckland; Wellington; Fiji; Kamchatka; Marshall Is.")}, - {-100,NULL} +static FieldNamesItem months[] = { + { 1, LPGEN("January") }, + { 2, LPGEN("February") }, + { 3, LPGEN("March") }, + { 4, LPGEN("April") }, + { 5, LPGEN("May") }, + { 6, LPGEN("June") }, + { 7, LPGEN("July") }, + { 8, LPGEN("August") }, + { 9, LPGEN("September") }, + { 10, LPGEN("October") }, + { 11, LPGEN("November") }, + { 12, LPGEN("December") }, + { 0, NULL } }; +const int ageRange[] = { 13, 0x7FFF }; // 14, 130 +const int yearRange[] = { 1753, 0x7FFF }; // 1880, 2000 +const int dayRange[] = { 1, 31 }; -static FieldNamesItem months[]={ - {1, LPGEN("January")}, - {2, LPGEN("February")}, - {3, LPGEN("March")}, - {4, LPGEN("April")}, - {5, LPGEN("May")}, - {6, LPGEN("June")}, - {7, LPGEN("July")}, - {8, LPGEN("August")}, - {9, LPGEN("September")}, - {10,LPGEN("October")}, - {11,LPGEN("November")}, - {12,LPGEN("December")}, - {0, NULL} -}; +const SettingItem setting[] = +{ + // personal + { LPGEN("Personal"), LI_DIVIDER }, + { LPGEN("Nickname"), LI_STRING, DBVT_UTF8, "Nick" }, + { LPGEN("First name"), LI_STRING, DBVT_UTF8, "FirstName" }, + { LPGEN("Last name"), LI_STRING, DBVT_UTF8, "LastName" }, + { LPGEN("Gender"), LI_LIST, DBVT_BYTE, "Gender", genderField }, + { LPGEN("About"), LI_LONGSTRING, DBVT_UTF8, "About" }, + + // password + { LPGEN("Password"), LI_DIVIDER }, + { LPGEN("Password"), LI_STRING | LIF_PASSWORD, DBVT_UTF8, "Password" }, + // contact + { LPGEN("Contact"), LI_DIVIDER }, + { LPGEN("Primary e-mail"), LI_STRING, DBVT_UTF8, "e-mail0" }, + { LPGEN("Secondary e-mail"), LI_STRING, DBVT_UTF8, "e-mail1" }, + { LPGEN("Tertiary e-mail"), LI_STRING, DBVT_UTF8, "e-mail2" }, + { LPGEN("Homepage"), LI_STRING, DBVT_UTF8, "Homepage" }, + { LPGEN("Street"), LI_STRING, DBVT_UTF8, "Street" }, + { LPGEN("City"), LI_STRING, DBVT_UTF8, "City" }, + { LPGEN("State"), LI_STRING, DBVT_UTF8, "State" }, + { LPGEN("ZIP/postcode"), LI_STRING, DBVT_UTF8, "ZIP" }, + { LPGEN("Country"), LI_LIST, DBVT_WORD, "Country", countryField }, + { LPGEN("Phone number"), LI_STRING, DBVT_UTF8, "Phone" }, + { LPGEN("Fax number"), LI_STRING, DBVT_UTF8, "Fax" }, + { LPGEN("Cellular number"), LI_STRING, DBVT_UTF8, "Cellular" }, + + // more + { LPGEN("Personal Detail"), LI_DIVIDER }, + { LPGEN("Timezone"), LI_LIST | LIF_ZEROISVALID | LIF_SIGNED, DBVT_BYTE, "Timezone", timezonesField }, + { LPGEN("Year of birth"), LI_NUMBER, DBVT_WORD, "BirthYear", yearRange }, + { LPGEN("Month of birth"), LI_LIST, DBVT_BYTE, "BirthMonth", months }, + { LPGEN("Day of birth"), LI_NUMBER, DBVT_BYTE, "BirthDay", dayRange }, + { LPGEN("Marital Status"), LI_LIST, DBVT_BYTE, "MaritalStatus", maritalField }, + { LPGEN("Spoken language 1"), LI_LIST, DBVT_BYTE, "Language1", languageField }, + { LPGEN("Spoken language 2"), LI_LIST, DBVT_BYTE, "Language2", languageField }, + { LPGEN("Spoken language 3"), LI_LIST, DBVT_BYTE, "Language3", languageField }, -const int ageRange[]={13,0x7FFF}; // 14, 130 -const int yearRange[]={1753,0x7FFF}; // 1880, 2000 -const int dayRange[]={1,31}; + // more + { LPGEN("Originally from"), LI_DIVIDER }, + { LPGEN("Street"), LI_STRING, DBVT_UTF8, "OriginStreet" }, + { LPGEN("City"), LI_STRING, DBVT_UTF8, "OriginCity" }, + { LPGEN("State"), LI_STRING, DBVT_UTF8, "OriginState" }, + { LPGEN("Country"), LI_LIST, DBVT_WORD, "OriginCountry", countryField }, + // study + { LPGEN("Education"), LI_DIVIDER }, + { LPGEN("Level"), LI_LIST, DBVT_WORD, "StudyLevel", studyLevelField }, + { LPGEN("Institute"), LI_STRING, DBVT_UTF8, "StudyInstitute" }, + { LPGEN("Degree"), LI_STRING, DBVT_UTF8, "StudyDegree" }, + { LPGEN("Graduation Year"), LI_NUMBER, DBVT_WORD, "StudyYear", yearRange }, -const SettingItem setting[]={ - //personal - {LPGEN("Personal"), LI_DIVIDER}, - {LPGEN("Nickname"), LI_STRING, DBVT_UTF8, "Nick"}, - {LPGEN("First name"), LI_STRING, DBVT_UTF8, "FirstName"}, - {LPGEN("Last name"), LI_STRING, DBVT_UTF8, "LastName"}, - {LPGEN("Gender"), LI_LIST, DBVT_BYTE, "Gender", genderField}, - {LPGEN("About"), LI_LONGSTRING, DBVT_UTF8, "About"}, - //password - {LPGEN("Password"), LI_DIVIDER}, - {LPGEN("Password"), LI_STRING|LIF_PASSWORD,DBVT_UTF8, "Password"}, - //contact - {LPGEN("Contact"), LI_DIVIDER}, - {LPGEN("Primary e-mail"), LI_STRING, DBVT_UTF8, "e-mail0"}, - {LPGEN("Secondary e-mail"), LI_STRING, DBVT_UTF8, "e-mail1"}, - {LPGEN("Tertiary e-mail"), LI_STRING, DBVT_UTF8, "e-mail2"}, - {LPGEN("Homepage"), LI_STRING, DBVT_UTF8, "Homepage"}, - {LPGEN("Street"), LI_STRING, DBVT_UTF8, "Street"}, - {LPGEN("City"), LI_STRING, DBVT_UTF8, "City"}, - {LPGEN("State"), LI_STRING, DBVT_UTF8, "State"}, - {LPGEN("ZIP/postcode"), LI_STRING, DBVT_UTF8, "ZIP"}, - {LPGEN("Country"), LI_LIST, DBVT_WORD, "Country", countryField}, - {LPGEN("Phone number"), LI_STRING, DBVT_UTF8, "Phone"}, - {LPGEN("Fax number"), LI_STRING, DBVT_UTF8, "Fax"}, - {LPGEN("Cellular number"),LI_STRING, DBVT_UTF8, "Cellular"}, - //more - {LPGEN("Personal Detail"),LI_DIVIDER}, - {LPGEN("Timezone"), LI_LIST|LIF_ZEROISVALID|LIF_SIGNED,DBVT_BYTE, "Timezone", timezones}, - {LPGEN("Year of birth"), LI_NUMBER, DBVT_WORD, "BirthYear", yearRange}, - {LPGEN("Month of birth"), LI_LIST, DBVT_BYTE, "BirthMonth", months}, - {LPGEN("Day of birth"), LI_NUMBER, DBVT_BYTE, "BirthDay", dayRange}, - {LPGEN("Marital Status"), LI_LIST, DBVT_BYTE, "MaritalStatus", maritalField}, - {LPGEN("Spoken language 1"), LI_LIST, DBVT_BYTE, "Language1", languageField}, - {LPGEN("Spoken language 2"), LI_LIST, DBVT_BYTE, "Language2", languageField}, - {LPGEN("Spoken language 3"), LI_LIST, DBVT_BYTE, "Language3", languageField}, - //more - {LPGEN("Originally from"),LI_DIVIDER}, - {LPGEN("Street"), LI_STRING, DBVT_UTF8, "OriginStreet"}, - {LPGEN("City"), LI_STRING, DBVT_UTF8, "OriginCity"}, - {LPGEN("State"), LI_STRING, DBVT_UTF8, "OriginState"}, - {LPGEN("Country"), LI_LIST, DBVT_WORD, "OriginCountry", countryField}, - //study - {LPGEN("Education"), LI_DIVIDER}, - {LPGEN("Level"), LI_LIST, DBVT_WORD, "StudyLevel", studyLevelField}, - {LPGEN("Institute"), LI_STRING, DBVT_UTF8, "StudyInstitute"}, - {LPGEN("Degree"), LI_STRING, DBVT_UTF8, "StudyDegree"}, - {LPGEN("Graduation Year"),LI_NUMBER, DBVT_WORD, "StudyYear", yearRange}, - //work - {LPGEN("Work"), LI_DIVIDER}, - {LPGEN("Company name"), LI_STRING, DBVT_UTF8, "Company"}, - {LPGEN("Company homepage"),LI_STRING, DBVT_UTF8, "CompanyHomepage"}, - {LPGEN("Company street"), LI_STRING, DBVT_UTF8, "CompanyStreet"}, - {LPGEN("Company city"), LI_STRING, DBVT_UTF8, "CompanyCity"}, - {LPGEN("Company state"), LI_STRING, DBVT_UTF8, "CompanyState"}, - {LPGEN("Company phone"), LI_STRING, DBVT_UTF8, "CompanyPhone"}, - {LPGEN("Company fax"), LI_STRING, DBVT_UTF8, "CompanyFax"}, - {LPGEN("Company ZIP/postcode"),LI_STRING,DBVT_UTF8, "CompanyZIP"}, - {LPGEN("Company country"),LI_LIST, DBVT_WORD, "CompanyCountry", countryField}, - {LPGEN("Company department"),LI_STRING, DBVT_UTF8, "CompanyDepartment"}, - {LPGEN("Company position"),LI_STRING, DBVT_UTF8, "CompanyPosition"}, - {LPGEN("Company industry"),LI_LIST, DBVT_WORD, "CompanyIndustry", industryField}, + // work + { LPGEN("Work"), LI_DIVIDER }, + { LPGEN("Company name"), LI_STRING, DBVT_UTF8, "Company" }, + { LPGEN("Company homepage"), LI_STRING, DBVT_UTF8, "CompanyHomepage" }, + { LPGEN("Company street"), LI_STRING, DBVT_UTF8, "CompanyStreet" }, + { LPGEN("Company city"), LI_STRING, DBVT_UTF8, "CompanyCity" }, + { LPGEN("Company state"), LI_STRING, DBVT_UTF8, "CompanyState" }, + { LPGEN("Company phone"), LI_STRING, DBVT_UTF8, "CompanyPhone" }, + { LPGEN("Company fax"), LI_STRING, DBVT_UTF8, "CompanyFax" }, + { LPGEN("Company ZIP/postcode"), LI_STRING, DBVT_UTF8, "CompanyZIP" }, + { LPGEN("Company country"), LI_LIST, DBVT_WORD, "CompanyCountry", countryField }, + { LPGEN("Company department"), LI_STRING, DBVT_UTF8, "CompanyDepartment" }, + { LPGEN("Company position"), LI_STRING, DBVT_UTF8, "CompanyPosition" }, + { LPGEN("Company industry"), LI_LIST, DBVT_WORD, "CompanyIndustry", industryField }, - //interests - {LPGEN("Personal Interests"), LI_DIVIDER}, - {LPGEN("Interest category 1"),LI_LIST, DBVT_WORD, "Interest0Cat", interestsField}, - {LPGEN("Interest areas 1"),LI_STRING, DBVT_UTF8, "Interest0Text"}, - {LPGEN("Interest category 2"),LI_LIST, DBVT_WORD, "Interest1Cat", interestsField}, - {LPGEN("Interest areas 2"),LI_STRING, DBVT_UTF8, "Interest1Text"}, - {LPGEN("Interest category 3"),LI_LIST, DBVT_WORD, "Interest2Cat", interestsField}, - {LPGEN("Interest areas 3"),LI_STRING, DBVT_UTF8, "Interest2Text"}, - {LPGEN("Interest category 4"),LI_LIST, DBVT_WORD, "Interest3Cat", interestsField}, - {LPGEN("Interest areas 4"),LI_STRING, DBVT_UTF8, "Interest3Text"}, + //interests + { LPGEN("Personal Interests"), LI_DIVIDER }, + { LPGEN("Interest category 1"), LI_LIST, DBVT_WORD, "Interest0Cat", interestsField }, + { LPGEN("Interest areas 1"), LI_STRING, DBVT_UTF8, "Interest0Text" }, + { LPGEN("Interest category 2"), LI_LIST, DBVT_WORD, "Interest1Cat", interestsField }, + { LPGEN("Interest areas 2"), LI_STRING, DBVT_UTF8, "Interest1Text" }, + { LPGEN("Interest category 3"), LI_LIST, DBVT_WORD, "Interest2Cat", interestsField }, + { LPGEN("Interest areas 3"), LI_STRING, DBVT_UTF8, "Interest2Text" }, + { LPGEN("Interest category 4"), LI_LIST, DBVT_WORD, "Interest3Cat", interestsField }, + { LPGEN("Interest areas 4"), LI_STRING, DBVT_UTF8, "Interest3Text" }, }; const int settingCount = SIZEOF(setting); diff --git a/protocols/IcqOscarJ/src/changeinfo/db.cpp b/protocols/IcqOscarJ/src/changeinfo/db.cpp index f32985e764..07807549cd 100644 --- a/protocols/IcqOscarJ/src/changeinfo/db.cpp +++ b/protocols/IcqOscarJ/src/changeinfo/db.cpp @@ -29,43 +29,48 @@ void ChangeInfoData::LoadSettingsFromDb(int keepChanged) { - for (int i=0; i < settingCount; i++) - { - if (setting[i].displayType == LI_DIVIDER) continue; - if (keepChanged && settingData[i].changed) continue; - if (setting[i].dbType == DBVT_ASCIIZ || setting[i].dbType == DBVT_UTF8) - SAFE_FREE((void**)(char**)&settingData[i].value); + for (int i = 0; i < settingCount; i++) { + const SettingItem &si = setting[i]; + if (si.displayType == LI_DIVIDER) + continue; + + SettingItemData &sid = settingData[i]; + if (keepChanged && sid.changed) + continue; + + if (si.dbType == DBVT_ASCIIZ || si.dbType == DBVT_UTF8) + SAFE_FREE((void**)(char**)&sid.value); else if (!keepChanged) - settingData[i].value = 0; + sid.value = 0; - settingData[i].changed = 0; + sid.changed = 0; - if (setting[i].displayType & LIF_PASSWORD) continue; + if (si.displayType & LIF_PASSWORD) + continue; - DBVARIANT dbv = {DBVT_DELETED}; - if (!ppro->getSetting(NULL, setting[i].szDbSetting, &dbv)) - { - switch(dbv.type) { + DBVARIANT dbv = { DBVT_DELETED }; + if (!ppro->getSetting(NULL, si.szDbSetting, &dbv)) { + switch (dbv.type) { case DBVT_ASCIIZ: - settingData[i].value = (LPARAM)ppro->getSettingStringUtf(NULL, setting[i].szDbSetting, NULL); - break; + sid.value = (LPARAM)ppro->getSettingStringUtf(NULL, si.szDbSetting, NULL); + break; case DBVT_UTF8: - settingData[i].value = (LPARAM)null_strdup(dbv.pszVal); + sid.value = (LPARAM)null_strdup(dbv.pszVal); break; case DBVT_WORD: - if (setting[i].displayType & LIF_SIGNED) - settingData[i].value = dbv.sVal; - else - settingData[i].value = dbv.wVal; + if (si.displayType & LIF_SIGNED) + sid.value = dbv.sVal; + else + sid.value = dbv.wVal; break; case DBVT_BYTE: - if (setting[i].displayType & LIF_SIGNED) - settingData[i].value = dbv.cVal; - else - settingData[i].value = dbv.bVal; + if (si.displayType & LIF_SIGNED) + sid.value = dbv.cVal; + else + sid.value = dbv.bVal; break; #ifdef _DEBUG @@ -77,24 +82,24 @@ void ChangeInfoData::LoadSettingsFromDb(int keepChanged) db_free(&dbv); } - char buf[MAX_PATH]; - TCHAR tbuf[MAX_PATH]; + char buf[MAX_PATH]; + TCHAR tbuf[MAX_PATH]; - if (utf8_to_tchar_static(GetItemSettingText(i, buf, SIZEOF(buf)), tbuf, SIZEOF(tbuf))) - ListView_SetItemText(hwndList, i, 1, tbuf); + if (utf8_to_tchar_static(GetItemSettingText(i, buf, SIZEOF(buf)), tbuf, SIZEOF(tbuf))) + ListView_SetItemText(hwndList, i, 1, tbuf); } } void ChangeInfoData::FreeStoredDbSettings(void) { - for (int i=0; i < settingCount; i++ ) + for (int i = 0; i < settingCount; i++) if (setting[i].dbType == DBVT_ASCIIZ || setting[i].dbType == DBVT_UTF8) SAFE_FREE((void**)&settingData[i].value); } int ChangeInfoData::ChangesMade(void) { - for (int i=0; i < settingCount; i++ ) + for (int i = 0; i < settingCount; i++) if (settingData[i].changed) return 1; return 0; @@ -102,7 +107,7 @@ int ChangeInfoData::ChangesMade(void) void ChangeInfoData::ClearChangeFlags(void) { - for (int i=0; i < settingCount; i++) + for (int i = 0; i < settingCount; i++) settingData[i].changed = 0; } @@ -118,40 +123,38 @@ static INT_PTR CALLBACK PwConfirmDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, { PwConfirmDlgParam* dat = (PwConfirmDlgParam*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - switch(msg) { + switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam); - SendDlgItemMessage(hwndDlg,IDC_PASSWORD,EM_LIMITTEXT,15,0); + SendDlgItemMessage(hwndDlg, IDC_PASSWORD, EM_LIMITTEXT, 15, 0); return TRUE; case WM_COMMAND: - switch(LOWORD(wParam)) { + switch (LOWORD(wParam)) { case IDOK: - { + { char szTest[16]; - GetDlgItemTextA(hwndDlg,IDC_OLDPASS,szTest,sizeof(szTest)); + GetDlgItemTextA(hwndDlg, IDC_OLDPASS, szTest, sizeof(szTest)); - if (strcmpnull(szTest, dat->ppro->GetUserPassword(TRUE))) - { + if (strcmpnull(szTest, dat->ppro->GetUserPassword(TRUE))) { MessageBox(hwndDlg, TranslateT("The password does not match your current password. Check Caps Lock and try again."), TranslateT("Change ICQ Details"), MB_OK); - SendDlgItemMessage(hwndDlg,IDC_OLDPASS,EM_SETSEL,0,(LPARAM)-1); - SetFocus(GetDlgItem(hwndDlg,IDC_OLDPASS)); + SendDlgItemMessage(hwndDlg, IDC_OLDPASS, EM_SETSEL, 0, (LPARAM)-1); + SetFocus(GetDlgItem(hwndDlg, IDC_OLDPASS)); break; } - GetDlgItemTextA(hwndDlg,IDC_PASSWORD,szTest,sizeof(szTest)); - if(strcmpnull(szTest, dat->Pass)) - { + GetDlgItemTextA(hwndDlg, IDC_PASSWORD, szTest, sizeof(szTest)); + if (strcmpnull(szTest, dat->Pass)) { MessageBox(hwndDlg, TranslateT("The password does not match the password you originally entered. Check Caps Lock and try again."), TranslateT("Change ICQ Details"), MB_OK); - SendDlgItemMessage(hwndDlg,IDC_PASSWORD,EM_SETSEL,0,(LPARAM)-1); - SetFocus(GetDlgItem(hwndDlg,IDC_PASSWORD)); + SendDlgItemMessage(hwndDlg, IDC_PASSWORD, EM_SETSEL, 0, (LPARAM)-1); + SetFocus(GetDlgItem(hwndDlg, IDC_PASSWORD)); break; } } case IDCANCEL: - EndDialog(hwndDlg,wParam); + EndDialog(hwndDlg, wParam); break; } break; @@ -163,55 +166,54 @@ int ChangeInfoData::SaveSettingsToDb(HWND hwndDlg) { int ret = 1; - for (int i = 0; i < settingCount; i++) - { - if (!settingData[i].changed) continue; - if (!(setting[i].displayType & LIF_ZEROISVALID) && settingData[i].value==0) - { - ppro->delSetting(setting[i].szDbSetting); + for (int i = 0; i < settingCount; i++) { + SettingItemData &sid = settingData[i]; + if (!sid.changed) + continue; + + const SettingItem &si = setting[i]; + if (!(si.displayType & LIF_ZEROISVALID) && sid.value == 0) { + ppro->delSetting(si.szDbSetting); continue; } - switch(setting[i].dbType) { + switch (si.dbType) { case DBVT_ASCIIZ: - if (setting[i].displayType & LIF_PASSWORD) - { - int nSettingLen = strlennull((char*)settingData[i].value); + if (si.displayType & LIF_PASSWORD) { + int nSettingLen = strlennull((char*)sid.value); - if (nSettingLen > 8 || nSettingLen < 1) - { + if (nSettingLen > 8 || nSettingLen < 1) { MessageBox(hwndDlg, TranslateT("The ICQ server does not support passwords longer than 8 characters. Please use a shorter password."), TranslateT("Change ICQ Details"), MB_OK); - ret=0; + ret = 0; break; } - PwConfirmDlgParam param = { ppro, (char*)settingData[i].value }; - if (IDOK != DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_PWCONFIRM), hwndDlg, PwConfirmDlgProc, (LPARAM)¶m)) - { + PwConfirmDlgParam param = { ppro, (char*)sid.value }; + if (IDOK != DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_PWCONFIRM), hwndDlg, PwConfirmDlgProc, (LPARAM)¶m)) { ret = 0; break; } - strcpy(ppro->m_szPassword, (char*)settingData[i].value); + strcpy(ppro->m_szPassword, (char*)sid.value); } else { - if (*(char*)settingData[i].value) - db_set_utf(NULL, ppro->m_szModuleName, setting[i].szDbSetting, (char*)settingData[i].value); + if (*(char*)sid.value) + db_set_utf(NULL, ppro->m_szModuleName, si.szDbSetting, (char*)sid.value); else - ppro->delSetting(setting[i].szDbSetting); + ppro->delSetting(si.szDbSetting); } break; case DBVT_UTF8: - if (*(char*)settingData[i].value) - db_set_utf(NULL, ppro->m_szModuleName, setting[i].szDbSetting, (char*)settingData[i].value); + if (*(char*)sid.value) + db_set_utf(NULL, ppro->m_szModuleName, si.szDbSetting, (char*)sid.value); else - ppro->delSetting(setting[i].szDbSetting); + ppro->delSetting(si.szDbSetting); break; case DBVT_WORD: - ppro->setWord(setting[i].szDbSetting, (WORD)settingData[i].value); + ppro->setWord(si.szDbSetting, (WORD)sid.value); break; case DBVT_BYTE: - ppro->setByte(setting[i].szDbSetting, (BYTE)settingData[i].value); + ppro->setByte(si.szDbSetting, (BYTE)sid.value); break; } } diff --git a/protocols/IcqOscarJ/src/changeinfo/dlgproc.cpp b/protocols/IcqOscarJ/src/changeinfo/dlgproc.cpp index 4a1f068b7e..e8d71f869f 100644 --- a/protocols/IcqOscarJ/src/changeinfo/dlgproc.cpp +++ b/protocols/IcqOscarJ/src/changeinfo/dlgproc.cpp @@ -27,7 +27,6 @@ // ----------------------------------------------------------------------------- #include "icqoscar.h" - #define DM_PROTOACK (WM_USER+10) static int DrawTextUtf(HDC hDC, char *text, LPRECT lpRect, UINT uFormat, LPSIZE lpSize) @@ -43,7 +42,6 @@ static int DrawTextUtf(HDC hDC, char *text, LPRECT lpRect, UINT uFormat, LPSIZE return res; } - char* ChangeInfoData::GetItemSettingText(int i, char *buf, size_t bufsize) { char *text = buf; @@ -51,66 +49,69 @@ char* ChangeInfoData::GetItemSettingText(int i, char *buf, size_t bufsize) buf[0] = '\0'; - if (settingData[i].value == 0 && !(setting[i].displayType & LIF_ZEROISVALID)) - { - if (setting[i].displayType & LIF_CHANGEONLY) + const SettingItem &si = setting[i]; + SettingItemData &sid = settingData[i]; + if (sid.value == 0 && !(si.displayType & LIF_ZEROISVALID)) { + if (si.displayType & LIF_CHANGEONLY) text = ICQTranslateUtfStatic(LPGEN(""), buf, bufsize); else text = ICQTranslateUtfStatic(LPGEN(""), buf, bufsize); } - else - { - switch (setting[i].displayType & LIM_TYPE) { + else { + switch (si.displayType & LIM_TYPE) { case LI_STRING: case LI_LONGSTRING: - text = BinaryToEscapes((char*)settingData[i].value); + text = BinaryToEscapes((char*)sid.value); alloced = 1; break; case LI_NUMBER: - _itoa(settingData[i].value, text, 10); + _itoa(sid.value, text, 10); break; case LI_LIST: - if (setting[i].dbType == DBVT_ASCIIZ) - text = ICQTranslateUtfStatic((char*)settingData[i].value, buf, bufsize); - else - { + if (si.dbType == DBVT_ASCIIZ) + text = ICQTranslateUtfStatic((char*)sid.value, buf, bufsize); + else { text = ICQTranslateUtfStatic(LPGEN("Unknown value"), buf, bufsize); - FieldNamesItem *list = (FieldNamesItem*)setting[i].pList; - for (int j=0; TRUE; j++) - if (list[j].code == settingData[i].value) - { + FieldNamesItem *list = (FieldNamesItem*)si.pList; + if (list == timezonesField) { + HANDLE tz = tmi.createByContact(NULL, ppro->m_szModuleName, 0); + text = make_utf8_string_static(tmi.getTzName(tz), buf, bufsize); + break; + } + + for (int j = 0;; j++) { + if (list[j].code == sid.value) { text = ICQTranslateUtfStatic(list[j].text, buf, bufsize); break; } - else if (!list[j].text) - { - if (list[j].code == settingData[i].value) + else if (!list[j].text) { + if (list[j].code == sid.value) text = ICQTranslateUtfStatic("Unspecified", buf, bufsize); break; } + } } break; } } - if (setting[i].displayType & LIF_PASSWORD) - { - if (settingData[i].changed) - for (int j=0; text[j]; j++) text[j] = '*'; - else - { - if (alloced) - { + + if (si.displayType & LIF_PASSWORD) { + if (sid.changed) { + for (int j = 0; text[j]; j++) + text[j] = '*'; + } + else { + if (alloced) { SAFE_FREE(&text); alloced = 0; } text = "********"; } } - if (text != buf) - { + if (text != buf) { char *tmp = text; text = null_strcpy(buf, text, bufsize - 1); @@ -121,29 +122,26 @@ char* ChangeInfoData::GetItemSettingText(int i, char *buf, size_t bufsize) return text; } - void ChangeInfoData::PaintItemSetting(HDC hdc, RECT *rc, int i, UINT itemState) { char str[MAX_PATH]; char *text = GetItemSettingText(i, str, SIZEOF(str)); - if (settingData[i].value == 0 && !(setting[i].displayType & LIF_ZEROISVALID)) + const SettingItem &si = setting[i]; + SettingItemData &sid = settingData[i]; + if (sid.value == 0 && !(si.displayType & LIF_ZEROISVALID)) SetTextColor(hdc, GetSysColor(COLOR_GRAYTEXT)); - if ((setting[i].displayType & LIM_TYPE) == LI_LIST && (itemState & CDIS_SELECTED || iEditItem == i)) - { - RECT rcBtn; - - rcBtn = *rc; + if ((si.displayType & LIM_TYPE) == LI_LIST && (itemState & CDIS_SELECTED || iEditItem == i)) { + RECT rcBtn = *rc; rcBtn.left = rcBtn.right - rc->bottom + rc->top; - InflateRect(&rcBtn,-2,-2); + InflateRect(&rcBtn, -2, -2); rc->right = rcBtn.left; - DrawFrameControl(hdc, &rcBtn, DFC_SCROLL, iEditItem == i ? DFCS_SCROLLDOWN|DFCS_PUSHED : DFCS_SCROLLDOWN); + DrawFrameControl(hdc, &rcBtn, DFC_SCROLL, iEditItem == i ? DFCS_SCROLLDOWN | DFCS_PUSHED : DFCS_SCROLLDOWN); } - DrawTextUtf(hdc, text, rc, DT_END_ELLIPSIS|DT_LEFT|DT_NOCLIP|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER, NULL); + DrawTextUtf(hdc, text, rc, DT_END_ELLIPSIS | DT_LEFT | DT_NOCLIP | DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER, NULL); } - static int ChangeInfoDlg_Resize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL *urc) { switch (urc->wId) { @@ -151,10 +149,10 @@ static int ChangeInfoDlg_Resize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL * return RD_ANCHORX_WIDTH | RD_ANCHORY_HEIGHT; case IDC_SAVE: - return RD_ANCHORX_RIGHT | RD_ANCHORY_BOTTOM; + return RD_ANCHORX_RIGHT | RD_ANCHORY_BOTTOM; case IDC_UPLOADING: - return RD_ANCHORX_WIDTH | RD_ANCHORY_BOTTOM; + return RD_ANCHORX_WIDTH | RD_ANCHORY_BOTTOM; } return RD_ANCHORX_LEFT | RD_ANCHORY_TOP; // default @@ -165,7 +163,7 @@ INT_PTR CALLBACK ChangeInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM { ChangeInfoData* dat = (ChangeInfoData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - switch(msg) { + switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); @@ -179,35 +177,31 @@ INT_PTR CALLBACK ChangeInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM ListView_SetExtendedListViewStyle(dat->hwndList, LVS_EX_FULLROWSELECT); dat->iEditItem = -1; { - HFONT hFont; - LOGFONT lf; - dat->hListFont = (HFONT)SendMessage(dat->hwndList, WM_GETFONT, 0, 0); + + LOGFONT lf; GetObject(dat->hListFont, sizeof(lf), &lf); lf.lfHeight -= 5; - hFont = CreateFontIndirect(&lf); + HFONT hFont = CreateFontIndirect(&lf); SendMessage(dat->hwndList, WM_SETFONT, (WPARAM)hFont, 0); - } - { // Prepare ListView Columns - LV_COLUMN lvc = {0}; - RECT rc; + // Prepare ListView Columns + RECT rc; GetClientRect(dat->hwndList, &rc); rc.right -= GetSystemMetrics(SM_CXVSCROLL); + + LV_COLUMN lvc = { 0 }; lvc.mask = LVCF_WIDTH; lvc.cx = rc.right / 3; ListView_InsertColumn(dat->hwndList, 0, &lvc); lvc.cx = rc.right - lvc.cx; ListView_InsertColumn(dat->hwndList, 1, &lvc); - } - { // Prepare Setting Items - LV_ITEM lvi = {0}; - lvi.mask = LVIF_PARAM | LVIF_TEXT; - for (lvi.iItem = 0; lvi.iItem < settingCount; lvi.iItem++) - { + // Prepare Setting Items + LV_ITEM lvi = { 0 }; + lvi.mask = LVIF_PARAM | LVIF_TEXT; + for (lvi.iItem = 0; lvi.iItem < settingCount; lvi.iItem++) { TCHAR text[MAX_PATH]; - lvi.lParam = lvi.iItem; lvi.pszText = text; utf8_to_tchar_static(setting[lvi.iItem].szDescription, text, SIZEOF(text)); @@ -227,7 +221,7 @@ INT_PTR CALLBACK ChangeInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM dat->LoadSettingsFromDb(0); { char *pwd = dat->ppro->GetUserPassword(TRUE); - strcpy(dat->Password, (pwd) ? pwd : "" ); /// FIXME + strcpy(dat->Password, (pwd) ? pwd : ""); /// FIXME } break; @@ -241,25 +235,20 @@ INT_PTR CALLBACK ChangeInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM break; case PSN_APPLY: - if (dat->ChangesMade()) - { - if (MessageBox(hwndDlg, TranslateT("You've made some changes to your ICQ details but it has not been saved to the server. Are you sure you want to close this dialog?"), TranslateT("Change ICQ Details"), MB_YESNOCANCEL) != IDYES) - { + if (dat->ChangesMade()) { + if (MessageBox(hwndDlg, TranslateT("You've made some changes to your ICQ details but it has not been saved to the server. Are you sure you want to close this dialog?"), TranslateT("Change ICQ Details"), MB_YESNOCANCEL) != IDYES) { SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, PSNRET_INVALID_NOCHANGEPAGE); return TRUE; } } - break; } break; case IDC_LIST: switch (((LPNMHDR)lParam)->code) { case LVN_GETDISPINFO: - if (dat->iEditItem != -1) - { - if (dat->editTopIndex != ListView_GetTopIndex(dat->hwndList)) - { + if (dat->iEditItem != -1) { + if (dat->editTopIndex != ListView_GetTopIndex(dat->hwndList)) { dat->EndStringEdit(1); dat->EndListEdit(1); } @@ -268,56 +257,48 @@ INT_PTR CALLBACK ChangeInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM case NM_CUSTOMDRAW: { - LPNMLVCUSTOMDRAW cd=(LPNMLVCUSTOMDRAW)lParam; + LPNMLVCUSTOMDRAW cd = (LPNMLVCUSTOMDRAW)lParam; - switch(cd->nmcd.dwDrawStage) { + switch (cd->nmcd.dwDrawStage) { case CDDS_PREPAINT: SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, CDRF_NOTIFYITEMDRAW); return TRUE; case CDDS_ITEMPREPAINT: + if (dat->iEditItem != -1) { + if (dat->editTopIndex != ListView_GetTopIndex(dat->hwndList)) { + dat->EndStringEdit(1); + dat->EndListEdit(1); + } + } { RECT rcItem; - - if (dat->iEditItem != -1) - { - if (dat->editTopIndex != ListView_GetTopIndex(dat->hwndList)) - { - dat->EndStringEdit(1); - dat->EndListEdit(1); - } - } - ListView_GetItemRect(dat->hwndList, cd->nmcd.dwItemSpec, &rcItem, LVIR_BOUNDS); - if (GetWindowLongPtr(dat->hwndList, GWL_STYLE) & WS_DISABLED) - { // Disabled List + if (GetWindowLongPtr(dat->hwndList, GWL_STYLE) & WS_DISABLED) { // Disabled List SetTextColor(cd->nmcd.hdc, cd->clrText); FillRect(cd->nmcd.hdc, &rcItem, GetSysColorBrush(COLOR_3DFACE)); } else if ((cd->nmcd.uItemState & CDIS_SELECTED || dat->iEditItem == (int)cd->nmcd.dwItemSpec) - && setting[cd->nmcd.lItemlParam].displayType != LI_DIVIDER) - { // Selected item + && setting[cd->nmcd.lItemlParam].displayType != LI_DIVIDER) { // Selected item SetTextColor(cd->nmcd.hdc, GetSysColor(COLOR_HIGHLIGHTTEXT)); FillRect(cd->nmcd.hdc, &rcItem, GetSysColorBrush(COLOR_HIGHLIGHT)); } - else - { // Unselected item + else { // Unselected item SetTextColor(cd->nmcd.hdc, GetSysColor(COLOR_WINDOWTEXT)); FillRect(cd->nmcd.hdc, &rcItem, GetSysColorBrush(COLOR_WINDOW)); } HFONT hoFont = (HFONT)SelectObject(cd->nmcd.hdc, dat->hListFont); - if (setting[cd->nmcd.lItemlParam].displayType == LI_DIVIDER) - { + if (setting[cd->nmcd.lItemlParam].displayType == LI_DIVIDER) { RECT rcLine; SIZE textSize; char str[MAX_PATH]; char *szText = ICQTranslateUtfStatic(setting[cd->nmcd.lItemlParam].szDescription, str, MAX_PATH); SetTextColor(cd->nmcd.hdc, GetSysColor(COLOR_3DSHADOW)); - DrawTextUtf(cd->nmcd.hdc, szText, &rcItem, DT_CENTER|DT_NOCLIP|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER, &textSize); + DrawTextUtf(cd->nmcd.hdc, szText, &rcItem, DT_CENTER | DT_NOCLIP | DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER, &textSize); rcLine.top = (rcItem.top + rcItem.bottom) / 2 - 1; rcLine.bottom = rcLine.top + 2; rcLine.left = rcItem.left + 3; @@ -327,8 +308,7 @@ INT_PTR CALLBACK ChangeInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM rcLine.right = rcItem.right - 3; DrawEdge(cd->nmcd.hdc, &rcLine, BDR_SUNKENOUTER, BF_RECT); } - else - { + else { RECT rcItemDescr, rcItemValue; char str[MAX_PATH]; @@ -337,7 +317,7 @@ INT_PTR CALLBACK ChangeInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM rcItemDescr.right = rcItemValue.left; rcItemDescr.left += 2; - DrawTextUtf(cd->nmcd.hdc, ICQTranslateUtfStatic(setting[cd->nmcd.lItemlParam].szDescription, str, MAX_PATH), &rcItemDescr, DT_END_ELLIPSIS|DT_LEFT|DT_NOCLIP|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER, NULL); + DrawTextUtf(cd->nmcd.hdc, ICQTranslateUtfStatic(setting[cd->nmcd.lItemlParam].szDescription, str, MAX_PATH), &rcItemDescr, DT_END_ELLIPSIS | DT_LEFT | DT_NOCLIP | DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER, NULL); dat->PaintItemSetting(cd->nmcd.hdc, &rcItemValue, cd->nmcd.lItemlParam, cd->nmcd.uItemState); } @@ -348,18 +328,19 @@ INT_PTR CALLBACK ChangeInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM return TRUE; } } - break; } + break; + case NM_CLICK: - { - LPNMLISTVIEW nm=(LPNMLISTVIEW)lParam; + { + LPNMLISTVIEW nm = (LPNMLISTVIEW)lParam; LV_ITEM lvi; RECT rc; dat->EndStringEdit(1); dat->EndListEdit(1); if (nm->iSubItem != 1) break; - lvi.mask = LVIF_PARAM|LVIF_STATE; + lvi.mask = LVIF_PARAM | LVIF_STATE; lvi.stateMask = 0xFFFFFFFF; lvi.iItem = nm->iItem; lvi.iSubItem = nm->iSubItem; ListView_GetItem(dat->hwndList, &lvi); @@ -371,61 +352,65 @@ INT_PTR CALLBACK ChangeInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM case LI_STRING: case LI_LONGSTRING: case LI_NUMBER: - dat->BeginStringEdit(nm->iItem, &rc, lvi. lParam, 0); + dat->BeginStringEdit(nm->iItem, &rc, lvi.lParam, 0); break; case LI_LIST: - dat->BeginListEdit(nm->iItem, &rc, lvi. lParam, 0); + dat->BeginListEdit(nm->iItem, &rc, lvi.lParam, 0); break; } - break; } + break; + case LVN_KEYDOWN: - { - LPNMLVKEYDOWN nm=(LPNMLVKEYDOWN)lParam; + { + LPNMLVKEYDOWN nm = (LPNMLVKEYDOWN)lParam; LV_ITEM lvi; RECT rc; dat->EndStringEdit(1); dat->EndListEdit(1); - if(nm->wVKey==VK_SPACE || nm->wVKey==VK_RETURN || nm->wVKey==VK_F2) nm->wVKey=0; - if(nm->wVKey && (nm->wVKey<'0' || (nm->wVKey>'9' && nm->wVKey<'A') || (nm->wVKey>'Z' && nm->wVKeywVKey>=VK_F1)) + if (nm->wVKey == VK_SPACE || nm->wVKey == VK_RETURN || nm->wVKey == VK_F2) nm->wVKey = 0; + if (nm->wVKey && (nm->wVKey<'0' || (nm->wVKey>'9' && nm->wVKey<'A') || (nm->wVKey>'Z' && nm->wVKey < VK_NUMPAD0) || nm->wVKey >= VK_F1)) break; - lvi.mask=LVIF_PARAM|LVIF_STATE; - lvi.stateMask=0xFFFFFFFF; - lvi.iItem = ListView_GetNextItem(dat->hwndList, -1, LVNI_ALL|LVNI_SELECTED); - if (lvi.iItem==-1) break; - lvi.iSubItem=1; - ListView_GetItem(dat->hwndList,&lvi); - ListView_EnsureVisible(dat->hwndList,lvi.iItem,FALSE); - ListView_GetSubItemRect(dat->hwndList,lvi.iItem,lvi.iSubItem,LVIR_BOUNDS,&rc); + lvi.mask = LVIF_PARAM | LVIF_STATE; + lvi.stateMask = 0xFFFFFFFF; + lvi.iItem = ListView_GetNextItem(dat->hwndList, -1, LVNI_ALL | LVNI_SELECTED); + if (lvi.iItem == -1) break; + lvi.iSubItem = 1; + ListView_GetItem(dat->hwndList, &lvi); + ListView_EnsureVisible(dat->hwndList, lvi.iItem, FALSE); + ListView_GetSubItemRect(dat->hwndList, lvi.iItem, lvi.iSubItem, LVIR_BOUNDS, &rc); dat->editTopIndex = ListView_GetTopIndex(dat->hwndList); - switch(setting[lvi.lParam].displayType & LIM_TYPE) { + switch (setting[lvi.lParam].displayType & LIM_TYPE) { case LI_STRING: case LI_LONGSTRING: case LI_NUMBER: - dat->BeginStringEdit(lvi.iItem,&rc,lvi.lParam,nm->wVKey); + dat->BeginStringEdit(lvi.iItem, &rc, lvi.lParam, nm->wVKey); break; case LI_LIST: - dat->BeginListEdit(lvi.iItem,&rc,lvi.lParam,nm->wVKey); + dat->BeginListEdit(lvi.iItem, &rc, lvi.lParam, nm->wVKey); break; } SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, TRUE); - return TRUE; } + return TRUE; + case NM_KILLFOCUS: - if (!IsStringEditWindow(GetFocus())) dat->EndStringEdit(1); - if (!IsListEditWindow(GetFocus())) dat->EndListEdit(1); - break; + if (!IsStringEditWindow(GetFocus())) + dat->EndStringEdit(1); + if (!IsListEditWindow(GetFocus())) + dat->EndListEdit(1); } - break; } break; + case WM_KILLFOCUS: dat->EndStringEdit(1); dat->EndListEdit(1); break; + case WM_COMMAND: - switch(LOWORD(wParam)) { + switch (LOWORD(wParam)) { case IDCANCEL: SendMessage(GetParent(hwndDlg), msg, wParam, lParam); break; @@ -441,21 +426,19 @@ INT_PTR CALLBACK ChangeInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM ShowDlgItem(hwndDlg, IDC_UPLOADING, SW_SHOW); dat->hAckHook = HookEventMessage(ME_PROTO_ACK, hwndDlg, DM_PROTOACK); - if (!dat->UploadSettings()) - { + if (!dat->UploadSettings()) { EnableDlgItem(hwndDlg, IDC_SAVE, TRUE); EnableDlgItem(hwndDlg, IDC_LIST, TRUE); ShowDlgItem(hwndDlg, IDC_UPLOADING, SW_HIDE); - UnhookEvent(dat->hAckHook); + UnhookEvent(dat->hAckHook); dat->hAckHook = NULL; } - break; } break; case WM_SIZE: { // make the dlg resizeable - UTILRESIZEDIALOG urd = {0}; + UTILRESIZEDIALOG urd = { 0 }; if (IsIconic(hwndDlg)) break; urd.cbSize = sizeof(urd); @@ -464,7 +447,7 @@ INT_PTR CALLBACK ChangeInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM urd.lParam = 0; // user-defined urd.lpTemplate = MAKEINTRESOURCEA(IDD_INFO_CHANGEINFO); urd.pfnResizer = ChangeInfoDlg_Resize; - CallService(MS_UTILS_RESIZEDIALOG, 0, (LPARAM) &urd); + CallService(MS_UTILS_RESIZEDIALOG, 0, (LPARAM)&urd); { // update listview column widths RECT rc; @@ -474,18 +457,17 @@ INT_PTR CALLBACK ChangeInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM ListView_SetColumnWidth(dat->hwndList, 0, rc.right / 3); ListView_SetColumnWidth(dat->hwndList, 1, rc.right - rc.right / 3); } - break; } + break; case DM_PROTOACK: { - ACKDATA *ack=(ACKDATA*)lParam; - int i,done; + ACKDATA *ack = (ACKDATA*)lParam; + int i, done; if (ack->type != ACKTYPE_SETINFO) break; - if (ack->result == ACKRESULT_SUCCESS) - { - for (i=0; i < SIZEOF(dat->hUpload); i++) + if (ack->result == ACKRESULT_SUCCESS) { + for (i = 0; i < SIZEOF(dat->hUpload); i++) if (dat->hUpload[i] && ack->hProcess == dat->hUpload[i]) break; if (i == SIZEOF(dat->hUpload)) break; @@ -493,21 +475,20 @@ INT_PTR CALLBACK ChangeInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM for (done = 0, i = 0; i < SIZEOF(dat->hUpload); i++) done += dat->hUpload[i] == NULL; TCHAR buf[MAX_PATH]; - mir_sntprintf(buf, sizeof(buf), TranslateT("Upload in progress...%d%%"), 100*done/(SIZEOF(dat->hUpload))); + mir_sntprintf(buf, sizeof(buf), TranslateT("Upload in progress...%d%%"), 100 * done / (SIZEOF(dat->hUpload))); SetDlgItemText(hwndDlg, IDC_UPLOADING, buf); if (done < SIZEOF(dat->hUpload)) break; dat->ClearChangeFlags(); - UnhookEvent(dat->hAckHook); + UnhookEvent(dat->hAckHook); dat->hAckHook = NULL; EnableDlgItem(hwndDlg, IDC_LIST, TRUE); EnableDlgItem(hwndDlg, IDC_UPLOADING, FALSE); SetDlgItemText(hwndDlg, IDC_UPLOADING, TranslateT("Upload complete")); SendMessage(GetParent(hwndDlg), PSM_FORCECHANGED, 0, 0); } - else if (ack->result==ACKRESULT_FAILED) - { - UnhookEvent(dat->hAckHook); + else if (ack->result == ACKRESULT_FAILED) { + UnhookEvent(dat->hAckHook); dat->hAckHook = NULL; EnableDlgItem(hwndDlg, IDC_LIST, TRUE); EnableDlgItem(hwndDlg, IDC_UPLOADING, FALSE); @@ -515,18 +496,17 @@ INT_PTR CALLBACK ChangeInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM SendMessage(GetParent(hwndDlg), PSM_FORCECHANGED, 0, 0); EnableDlgItem(hwndDlg, IDC_SAVE, TRUE); } - break; } + break; + case WM_DESTROY: - if (dat->hAckHook) - { + if (dat->hAckHook) { UnhookEvent(dat->hAckHook); dat->hAckHook = NULL; } - { - HFONT hFont = (HFONT)SendMessage(dat->hwndList, WM_GETFONT, 0, 0); - DeleteObject(hFont); - } + + DeleteObject((HFONT)SendMessage(dat->hwndList, WM_GETFONT, 0, 0)); + dat->FreeStoredDbSettings(); SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0); delete dat; diff --git a/protocols/IcqOscarJ/src/changeinfo/editlist.cpp b/protocols/IcqOscarJ/src/changeinfo/editlist.cpp index b18cc30a68..33c0a1e53a 100644 --- a/protocols/IcqOscarJ/src/changeinfo/editlist.cpp +++ b/protocols/IcqOscarJ/src/changeinfo/editlist.cpp @@ -25,8 +25,8 @@ // ChangeInfo Plugin stuff // // ----------------------------------------------------------------------------- -#include "icqoscar.h" +#include "icqoscar.h" static ChangeInfoData *dataListEdit = NULL; static HWND hwndListEdit = NULL; @@ -80,43 +80,51 @@ void ChangeInfoData::BeginListEdit(int iItem, RECT *rc, int iSetting, WORD wVKey UpdateWindow(hwndList); dataListEdit = this; - hwndListEdit = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, _T("LISTBOX"), _T(""), WS_POPUP | WS_BORDER | WS_VSCROLL, rc->left, rc->bottom, rc->right - rc->left, 150, NULL, NULL, hInst, NULL); + hwndListEdit = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, _T("LISTBOX"), _T(""), WS_POPUP | WS_BORDER | WS_VSCROLL, + rc->left, rc->bottom, rc->right - rc->left, 150, NULL, NULL, hInst, NULL); SendMessage(hwndListEdit, WM_SETFONT, (WPARAM)hListFont, 0); int itemHeight = SendMessage(hwndListEdit, LB_GETITEMHEIGHT, 0, 0); - FieldNamesItem *list = (FieldNamesItem*)setting[iSetting].pList; + const SettingItem &si = setting[iSetting]; + SettingItemData &sid = settingData[iSetting]; + FieldNamesItem *list = (FieldNamesItem*)si.pList; // some country codes were changed leaving old details uknown, convert it for the user if (list == countryField) { - if (settingData[iSetting].value == 420) - settingData[iSetting].value = 42; // conversion of obsolete codes (OMG!) - else if (settingData[iSetting].value == 421) - settingData[iSetting].value = 4201; - else if (settingData[iSetting].value == 102) - settingData[iSetting].value = 1201; + if (sid.value == 420) + sid.value = 42; // conversion of obsolete codes (OMG!) + else if (sid.value == 421) + sid.value = 4201; + else if (sid.value == 102) + sid.value = 1201; } - int j, n = ListBoxAddStringUtf(hwndListEdit, "Unspecified"); - for (j = 0;; j++) - if (!list[j].text) { + if (list == timezonesField) { + tmi.prepareList(NULL, ppro->m_szModuleName, hwndListEdit, TZF_PLF_LB); + } + else { + int j, n = ListBoxAddStringUtf(hwndListEdit, "Unspecified"); + for (j = 0;; j++) + if (!list[j].text) { + SendMessage(hwndListEdit, LB_SETITEMDATA, n, j); + if ((sid.value == 0 && list[j].code == 0) || (si.dbType != DBVT_ASCIIZ && sid.value == list[j].code)) + SendMessage(hwndListEdit, LB_SETCURSEL, n, 0); + break; + } + + for (j = 0; list[j].text; j++) { + char str[MAX_PATH]; + n = ListBoxAddStringUtf(hwndListEdit, list[j].text); SendMessage(hwndListEdit, LB_SETITEMDATA, n, j); - if ((settingData[iSetting].value == 0 && list[j].code == 0) - || (setting[iSetting].dbType != DBVT_ASCIIZ && settingData[iSetting].value == list[j].code)) + if ((si.dbType == DBVT_ASCIIZ && (!strcmpnull((char*)sid.value, list[j].text)) + || (si.dbType == DBVT_ASCIIZ && (!strcmpnull((char*)sid.value, ICQTranslateUtfStatic(list[j].text, str, MAX_PATH)))) + || ((char*)sid.value == NULL && list[j].code == 0)) + || (si.dbType != DBVT_ASCIIZ && sid.value == list[j].code)) SendMessage(hwndListEdit, LB_SETCURSEL, n, 0); - break; } - - for (j = 0; list[j].text; j++) { - char str[MAX_PATH]; - n = ListBoxAddStringUtf(hwndListEdit, list[j].text); - SendMessage(hwndListEdit, LB_SETITEMDATA, n, j); - if ((setting[iSetting].dbType == DBVT_ASCIIZ && (!strcmpnull((char*)settingData[iSetting].value, list[j].text)) - || (setting[iSetting].dbType == DBVT_ASCIIZ && (!strcmpnull((char*)settingData[iSetting].value, ICQTranslateUtfStatic(list[j].text, str, MAX_PATH)))) - || ((char*)settingData[iSetting].value == NULL && list[j].code == 0)) - || (setting[iSetting].dbType != DBVT_ASCIIZ && settingData[iSetting].value == list[j].code)) - SendMessage(hwndListEdit, LB_SETCURSEL, n, 0); + SendMessage(hwndListEdit, LB_SETTOPINDEX, SendMessage(hwndListEdit, LB_GETCURSEL, 0, 0) - 3, 0); } - SendMessage(hwndListEdit, LB_SETTOPINDEX, SendMessage(hwndListEdit, LB_GETCURSEL, 0, 0) - 3, 0); + int listCount = SendMessage(hwndListEdit, LB_GETCOUNT, 0, 0); if (itemHeight * listCount < 150) SetWindowPos(hwndListEdit, 0, 0, 0, rc->right - rc->left, itemHeight * listCount + GetSystemMetrics(SM_CYBORDER) * 2, SWP_NOZORDER | SWP_NOMOVE); @@ -132,37 +140,45 @@ void ChangeInfoData::EndListEdit(int save) { if (hwndListEdit == NULL || iEditItem == -1 || this != dataListEdit) return; - + if (save) { + const SettingItem &si = setting[iEditItem]; + SettingItemData &sid = settingData[iEditItem]; + int iItem = SendMessage(hwndListEdit, LB_GETCURSEL, 0, 0); int i = SendMessage(hwndListEdit, LB_GETITEMDATA, iItem, 0); if (iItem != -1 && i != -1) { - FieldNamesItem &pItem = ((FieldNamesItem*)setting[iEditItem].pList)[i]; - - if (setting[iEditItem].dbType == DBVT_ASCIIZ) { - char *szNewValue = pItem.text; - if (pItem.code || (setting[iEditItem].displayType & LIF_ZEROISVALID)) { - settingData[iEditItem].changed = strcmpnull(szNewValue, (char*)settingData[iEditItem].value); - SAFE_FREE((void**)&settingData[iEditItem].value); - settingData[iEditItem].value = (LPARAM)null_strdup(szNewValue); + FieldNamesItem *list = (FieldNamesItem*)si.pList; + if (list == timezonesField) + tmi.storeListResults(NULL, ppro->m_szModuleName, hwndListEdit, TZF_PLF_LB); + else { + FieldNamesItem &pItem = list[i]; + + if (si.dbType == DBVT_ASCIIZ) { + char *szNewValue = pItem.text; + if (pItem.code || (si.displayType & LIF_ZEROISVALID)) { + sid.changed = strcmpnull(szNewValue, (char*)sid.value); + SAFE_FREE((void**)&sid.value); + sid.value = (LPARAM)null_strdup(szNewValue); + } + else { + sid.changed = (char*)sid.value != NULL; + SAFE_FREE((void**)&sid.value); + } } else { - settingData[iEditItem].changed = (char*)settingData[iEditItem].value != NULL; - SAFE_FREE((void**)&settingData[iEditItem].value); + sid.changed = pItem.code != sid.value; + sid.value = pItem.code; + } + + if (sid.changed) { + char buf[MAX_PATH]; + TCHAR tbuf[MAX_PATH]; + if (utf8_to_tchar_static(ICQTranslateUtfStatic(pItem.text, buf, SIZEOF(buf)), tbuf, SIZEOF(buf))) + ListView_SetItemText(hwndList, iEditItem, 1, tbuf); + + EnableDlgItem(GetParent(hwndList), IDC_SAVE, TRUE); } - } - else { - settingData[iEditItem].changed = pItem.code != settingData[iEditItem].value; - settingData[iEditItem].value = pItem.code; - } - - if (settingData[iEditItem].changed) { - char buf[MAX_PATH]; - TCHAR tbuf[MAX_PATH]; - if (utf8_to_tchar_static(ICQTranslateUtfStatic(pItem.text, buf, SIZEOF(buf)), tbuf, SIZEOF(buf))) - ListView_SetItemText(hwndList, iEditItem, 1, tbuf); - - EnableDlgItem(GetParent(hwndList), IDC_SAVE, TRUE); } } } @@ -173,7 +189,6 @@ void ChangeInfoData::EndListEdit(int save) hwndListEdit = NULL; } - int IsListEditWindow(HWND hwnd) { if (hwnd == hwndListEdit) return 1; diff --git a/protocols/IcqOscarJ/src/changeinfo/editstring.cpp b/protocols/IcqOscarJ/src/changeinfo/editstring.cpp index 4f1b33ba46..2f99e4731f 100644 --- a/protocols/IcqOscarJ/src/changeinfo/editstring.cpp +++ b/protocols/IcqOscarJ/src/changeinfo/editstring.cpp @@ -171,53 +171,50 @@ static LRESULT CALLBACK StringEditSubclassProc(HWND hwnd,UINT msg,WPARAM wParam, return mir_callNextSubclass(hwnd, StringEditSubclassProc, msg, wParam, lParam); } -static LRESULT CALLBACK ExpandButtonSubclassProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam) +static LRESULT CALLBACK ExpandButtonSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { - switch(msg) { + switch (msg) { case WM_LBUTTONUP: - if(GetCapture()==hwnd) - { + if (GetCapture() == hwnd) { //do expand - RECT rcStart,rcEnd; - DWORD selStart,selEnd; + RECT rcStart, rcEnd; + DWORD selStart, selEnd; WCHAR *text; - BOOL animEnabled=TRUE; + BOOL animEnabled = TRUE; - GetWindowRect(hwndEdit,&rcStart); - InflateRect(&rcStart,2,2); + GetWindowRect(hwndEdit, &rcStart); + InflateRect(&rcStart, 2, 2); text = GetWindowTextUcs(hwndEdit); - SendMessage(hwndEdit,EM_GETSEL,(WPARAM)&selStart,(LPARAM)&selEnd); + SendMessage(hwndEdit, EM_GETSEL, (WPARAM)&selStart, (LPARAM)&selEnd); DestroyWindow(hwndEdit); - EscapesToMultiline(text,&selStart,&selEnd); - hwndEdit=CreateWindowExA(WS_EX_TOOLWINDOW,"EDIT","",WS_POPUP|WS_BORDER|WS_VISIBLE|ES_WANTRETURN|ES_AUTOVSCROLL|WS_VSCROLL|ES_MULTILINE,rcStart.left,rcStart.top,rcStart.right-rcStart.left,rcStart.bottom-rcStart.top,NULL,NULL,hInst,NULL); + EscapesToMultiline(text, &selStart, &selEnd); + hwndEdit = CreateWindowExA(WS_EX_TOOLWINDOW, "EDIT", "", WS_POPUP | WS_BORDER | WS_VISIBLE | ES_WANTRETURN | ES_AUTOVSCROLL | WS_VSCROLL | ES_MULTILINE, rcStart.left, rcStart.top, rcStart.right - rcStart.left, rcStart.bottom - rcStart.top, NULL, NULL, hInst, NULL); SetWindowTextUcs(hwndEdit, text); mir_subclassWindow(hwndEdit, StringEditSubclassProc); - SendMessage(hwndEdit,WM_SETFONT,(WPARAM)dataStringEdit->hListFont,0); - SendMessage(hwndEdit,EM_SETSEL,selStart,selEnd); + SendMessage(hwndEdit, WM_SETFONT, (WPARAM)dataStringEdit->hListFont, 0); + SendMessage(hwndEdit, EM_SETSEL, selStart, selEnd); SetFocus(hwndEdit); - rcEnd.left=rcStart.left; rcEnd.top=rcStart.top; - rcEnd.right=rcEnd.left+350; - rcEnd.bottom=rcEnd.top+150; - if (LOBYTE(LOWORD(GetVersion()))>4 || HIBYTE(LOWORD(GetVersion()))>0) - SystemParametersInfo(SPI_GETCOMBOBOXANIMATION,0,&animEnabled,FALSE); - if(animEnabled) - { - DWORD startTime,timeNow; - startTime=GetTickCount(); - for (;;) - { + rcEnd.left = rcStart.left; rcEnd.top = rcStart.top; + rcEnd.right = rcEnd.left + 350; + rcEnd.bottom = rcEnd.top + 150; + if (LOBYTE(LOWORD(GetVersion())) > 4 || HIBYTE(LOWORD(GetVersion())) > 0) + SystemParametersInfo(SPI_GETCOMBOBOXANIMATION, 0, &animEnabled, FALSE); + if (animEnabled) { + DWORD startTime, timeNow; + startTime = GetTickCount(); + for (;;) { UpdateWindow(hwndEdit); - timeNow=GetTickCount(); - if(timeNow>startTime+200) break; - SetWindowPos(hwndEdit,0,rcEnd.left,rcEnd.top,(rcEnd.right-rcStart.right)*(timeNow-startTime)/200+rcStart.right-rcEnd.left,(rcEnd.bottom-rcStart.bottom)*(timeNow-startTime)/200+rcStart.bottom-rcEnd.top,SWP_NOZORDER); + timeNow = GetTickCount(); + if (timeNow > startTime + 200) break; + SetWindowPos(hwndEdit, 0, rcEnd.left, rcEnd.top, (rcEnd.right - rcStart.right)*(timeNow - startTime) / 200 + rcStart.right - rcEnd.left, (rcEnd.bottom - rcStart.bottom)*(timeNow - startTime) / 200 + rcStart.bottom - rcEnd.top, SWP_NOZORDER); } } - SetWindowPos(hwndEdit,0,rcEnd.left,rcEnd.top,rcEnd.right-rcEnd.left,rcEnd.bottom-rcEnd.top,SWP_NOZORDER); + SetWindowPos(hwndEdit, 0, rcEnd.left, rcEnd.top, rcEnd.right - rcEnd.left, rcEnd.bottom - rcEnd.top, SWP_NOZORDER); DestroyWindow(hwnd); - hwndExpandButton=NULL; + hwndExpandButton = NULL; SAFE_FREE((void**)&text); } @@ -230,57 +227,57 @@ void ChangeInfoData::BeginStringEdit(int iItem, RECT *rc, int i, WORD wVKey) { char *szValue; char str[80]; - int alloced=0; + int alloced = 0; EndStringEdit(0); - InflateRect(rc,-2,-2); - rc->left-=2; - if (setting[i].displayType & LIF_PASSWORD && !settingData[i].changed) + InflateRect(rc, -2, -2); + rc->left -= 2; + + const SettingItem &si = setting[i]; + SettingItemData &sid = settingData[i]; + + if (si.displayType & LIF_PASSWORD && !sid.changed) szValue = " "; - else if ((setting[i].displayType & LIM_TYPE) == LI_NUMBER) - { + else if ((si.displayType & LIM_TYPE) == LI_NUMBER) { szValue = str; - mir_snprintf(str, sizeof(str), "%d", settingData[i].value ); + mir_snprintf(str, sizeof(str), "%d", sid.value); } - else if (settingData[i].value) - { - szValue = BinaryToEscapes((char*)settingData[i].value); + else if (sid.value) { + szValue = BinaryToEscapes((char*)sid.value); alloced = 1; } else szValue = ""; iEditItem = iItem; - if ((setting[i].displayType & LIM_TYPE)==LI_LONGSTRING) - { - rc->right-=rc->bottom-rc->top; - hwndExpandButton=CreateWindowA("BUTTON","",WS_VISIBLE|WS_CHILD|BS_PUSHBUTTON|BS_ICON,rc->right,rc->top,rc->bottom-rc->top,rc->bottom-rc->top,hwndList,NULL,hInst,NULL); - SendMessage(hwndExpandButton,BM_SETIMAGE,IMAGE_ICON,(LPARAM)LoadImage(hInst,MAKEINTRESOURCE(IDI_EXPANDSTRINGEDIT),IMAGE_ICON,0,0,LR_SHARED)); + if ((si.displayType & LIM_TYPE) == LI_LONGSTRING) { + rc->right -= rc->bottom - rc->top; + hwndExpandButton = CreateWindowA("BUTTON", "", WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON | BS_ICON, rc->right, rc->top, rc->bottom - rc->top, rc->bottom - rc->top, hwndList, NULL, hInst, NULL); + SendMessage(hwndExpandButton, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadImage(hInst, MAKEINTRESOURCE(IDI_EXPANDSTRINGEDIT), IMAGE_ICON, 0, 0, LR_SHARED)); mir_subclassWindow(hwndExpandButton, ExpandButtonSubclassProc); } dataStringEdit = this; - hwndEdit = CreateWindow(_T("EDIT"),_T(""),WS_VISIBLE|WS_CHILD|ES_AUTOHSCROLL|((setting[i].displayType&LIM_TYPE)==LI_NUMBER?ES_NUMBER:0)|(setting[i].displayType&LIF_PASSWORD?ES_PASSWORD:0),rc->left,rc->top,rc->right-rc->left,rc->bottom-rc->top,hwndList,NULL,hInst,NULL); + hwndEdit = CreateWindow(_T("EDIT"), _T(""), WS_VISIBLE | WS_CHILD | ES_AUTOHSCROLL | ((si.displayType&LIM_TYPE) == LI_NUMBER ? ES_NUMBER : 0) | (si.displayType&LIF_PASSWORD ? ES_PASSWORD : 0), rc->left, rc->top, rc->right - rc->left, rc->bottom - rc->top, hwndList, NULL, hInst, NULL); SetWindowTextUtf(hwndEdit, szValue); if (alloced) SAFE_FREE(&szValue); mir_subclassWindow(hwndEdit, StringEditSubclassProc); - SendMessage(hwndEdit,WM_SETFONT,(WPARAM)hListFont,0); - if ((setting[i].displayType & LIM_TYPE) == LI_NUMBER) - { - int *range= (int*)setting[i].pList; + SendMessage(hwndEdit, WM_SETFONT, (WPARAM)hListFont, 0); + if ((si.displayType & LIM_TYPE) == LI_NUMBER) { + int *range = (int*)si.pList; RECT rcUpDown; - hwndUpDown=CreateWindow(UPDOWN_CLASS,_T(""),WS_VISIBLE|WS_CHILD|UDS_AUTOBUDDY|UDS_ALIGNRIGHT|UDS_HOTTRACK|UDS_NOTHOUSANDS|UDS_SETBUDDYINT,0,0,0,0,hwndList,NULL,hInst,NULL); + hwndUpDown = CreateWindow(UPDOWN_CLASS, _T(""), WS_VISIBLE | WS_CHILD | UDS_AUTOBUDDY | UDS_ALIGNRIGHT | UDS_HOTTRACK | UDS_NOTHOUSANDS | UDS_SETBUDDYINT, 0, 0, 0, 0, hwndList, NULL, hInst, NULL); SendMessage(hwndUpDown, UDM_SETRANGE32, range[0], range[1]); - SendMessage(hwndUpDown, UDM_SETPOS32, 0, settingData[i].value); - if (!(setting[i].displayType & LIF_ZEROISVALID) && settingData[i].value==0) + SendMessage(hwndUpDown, UDM_SETPOS32, 0, sid.value); + if (!(si.displayType & LIF_ZEROISVALID) && sid.value == 0) SetWindowTextA(hwndEdit, ""); GetClientRect(hwndUpDown, &rcUpDown); rc->right -= rcUpDown.right; - SetWindowPos(hwndEdit,0,0,0,rc->right-rc->left,rc->bottom-rc->top,SWP_NOZORDER|SWP_NOMOVE); + SetWindowPos(hwndEdit, 0, 0, 0, rc->right - rc->left, rc->bottom - rc->top, SWP_NOZORDER | SWP_NOMOVE); } - SendMessage(hwndEdit,EM_SETSEL,0,(LPARAM)-1); + SendMessage(hwndEdit, EM_SETSEL, 0, (LPARAM)-1); SetFocus(hwndEdit); - PostMessage(hwndEdit,WM_KEYDOWN,wVKey,0); + PostMessage(hwndEdit, WM_KEYDOWN, wVKey, 0); } void ChangeInfoData::EndStringEdit(int save) @@ -289,45 +286,44 @@ void ChangeInfoData::EndStringEdit(int save) return; if (save) { - char *text = (char*)SAFE_MALLOC(GetWindowTextLength(hwndEdit)+1); + char *text = (char*)SAFE_MALLOC(GetWindowTextLength(hwndEdit) + 1); + const SettingItem &si = setting[iEditItem]; + SettingItemData &sid = settingData[iEditItem]; - GetWindowTextA(hwndEdit,(char*)text,GetWindowTextLength(hwndEdit)+1); + GetWindowTextA(hwndEdit, (char*)text, GetWindowTextLength(hwndEdit) + 1); EscapesToBinary(text); - if ((setting[iEditItem].displayType&LIM_TYPE)==LI_NUMBER) - { + if ((si.displayType & LIM_TYPE) == LI_NUMBER) { LPARAM newValue; - int *range=(int*)setting[iEditItem].pList; + int *range = (int*)si.pList; newValue = atoi(text); - if (newValue) - { - if (newValuerange[1]) newValue=range[1]; + if (newValue) { + if (newValuerange[1]) newValue = range[1]; } - settingData[iEditItem].changed = settingData[iEditItem].value != newValue; - settingData[iEditItem].value = newValue; + sid.changed = sid.value != newValue; + sid.value = newValue; SAFE_FREE(&text); } else { - if (!(setting[iEditItem].displayType & LIF_PASSWORD)) { + if (!(si.displayType & LIF_PASSWORD)) { SAFE_FREE(&text); text = GetWindowTextUtf(hwndEdit); EscapesToBinary(text); } - if ((setting[iEditItem].displayType & LIF_PASSWORD && strcmpnull(text," ")) || - (!(setting[iEditItem].displayType & LIF_PASSWORD) && strcmpnull(text, (char*)settingData[iEditItem].value) && (strlennull(text) + strlennull((char*)settingData[iEditItem].value)))) - { - SAFE_FREE((void**)&settingData[iEditItem].value); + if ((si.displayType & LIF_PASSWORD && strcmpnull(text, " ")) || + (!(si.displayType & LIF_PASSWORD) && strcmpnull(text, (char*)sid.value) && (strlennull(text) + strlennull((char*)sid.value)))) { + SAFE_FREE((void**)&sid.value); if (strlennull(text)) - settingData[iEditItem].value = (LPARAM)text; + sid.value = (LPARAM)text; else { - settingData[iEditItem].value = 0; + sid.value = 0; SAFE_FREE(&text); } - settingData[iEditItem].changed = 1; + sid.changed = 1; } } - if (settingData[iEditItem].changed) { + if (sid.changed) { TCHAR tbuf[MAX_PATH]; GetWindowText(hwndEdit, tbuf, SIZEOF(tbuf)); diff --git a/protocols/IcqOscarJ/src/icq_advsearch.cpp b/protocols/IcqOscarJ/src/icq_advsearch.cpp index d3bd412980..15eee0bc3d 100644 --- a/protocols/IcqOscarJ/src/icq_advsearch.cpp +++ b/protocols/IcqOscarJ/src/icq_advsearch.cpp @@ -31,32 +31,25 @@ static void InitComboBox(HWND hwndCombo, const FieldNamesItem *names) { - int iItem; - int i; + SendMessage(hwndCombo, CB_SETCURSEL, ComboBoxAddStringUtf(hwndCombo, NULL, 0), 0); - iItem = ComboBoxAddStringUtf(hwndCombo, NULL, 0); - SendMessage(hwndCombo, CB_SETCURSEL, iItem, 0); - - if (names){ - for (i = 0; names[i].text; i++) { - iItem = ComboBoxAddStringUtf(hwndCombo, names[i].text, names[i].code); - } + if (names) { + for (int i = 0; names[i].text; i++) + ComboBoxAddStringUtf(hwndCombo, names[i].text, names[i].code); } else { int ctryCount; struct CountryListEntry *countries; CallService(MS_UTILS_GETCOUNTRYLIST, (WPARAM)&ctryCount, (LPARAM)&countries); - for (i = 0; i < ctryCount; i++) { + for (int i = 0; i < ctryCount; i++) if (countries[i].id != 0xFFFF && countries[i].id != 0) - iItem = ComboBoxAddStringUtf(hwndCombo, LPGEN(countries[i].szName), countries[i].id); - } + ComboBoxAddStringUtf(hwndCombo, LPGEN(countries[i].szName), countries[i].id); } } INT_PTR CALLBACK AdvancedSearchDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam) { - switch(message) - { + switch(message) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); InitComboBox(GetDlgItem(hwndDlg, IDC_GENDER), genderField); @@ -68,10 +61,7 @@ INT_PTR CALLBACK AdvancedSearchDlgProc(HWND hwndDlg, UINT message, WPARAM wParam InitComboBox(GetDlgItem(hwndDlg, IDC_COUNTRY), countryField); InitComboBox(GetDlgItem(hwndDlg, IDC_INTERESTSCAT), interestsField); InitComboBox(GetDlgItem(hwndDlg, IDC_PASTCAT), pastField); - return TRUE; - default: - break; } return FALSE; @@ -122,10 +112,10 @@ static PBYTE createAdvancedSearchStructureTLV(HWND hwndDlg, int *length) BYTE b = (BYTE)getCurItemData(hwndDlg, IDC_GENDER); switch (b) { - case 'F': b = 1; break; - case 'M': b = 2; break; - default: b = 0; - }; + case 'F': b = 1; break; + case 'M': b = 2; break; + default: b = 0; + } ppackLETLVByte(&buf, &buflen, b, TLV_GENDER, 0); ppackLETLVByte(&buf, &buflen, (BYTE)getCurItemData(hwndDlg, IDC_MARITALSTATUS), TLV_MARITAL, 0); ppackLETLVWord(&buf, &buflen, (WORD)getCurItemData(hwndDlg, IDC_LANGUAGE), TLV_LANGUAGE, 0); diff --git a/protocols/IcqOscarJ/src/icq_db.cpp b/protocols/IcqOscarJ/src/icq_db.cpp index f605d7605d..8246b7ffa1 100644 --- a/protocols/IcqOscarJ/src/icq_db.cpp +++ b/protocols/IcqOscarJ/src/icq_db.cpp @@ -136,13 +136,13 @@ void CIcqProto::setStatusMsgVar(MCONTACT hContact, char* szStatusMsg, bool isAns { if (szStatusMsg && szStatusMsg[0]) { if (isAnsi) { - char* szStatusNote = getSettingStringUtf(hContact, DBSETTING_STATUS_NOTE, ""); - wchar_t* szStatusNoteW = make_unicode_string(szStatusNote); + char *szStatusNote = getSettingStringUtf(hContact, DBSETTING_STATUS_NOTE, ""); + wchar_t *szStatusNoteW = make_unicode_string(szStatusNote); int len = (int)wcslen(szStatusNoteW) * 3 + 1; - char* szStatusNoteAnsi = (char*)alloca(len); + char *szStatusNoteAnsi = (char*)alloca(len); WideCharToMultiByte(CP_ACP, WC_NO_BEST_FIT_CHARS, szStatusNoteW, -1, szStatusNoteAnsi, len, NULL, NULL); bool notmatch = false; - for (int i=0; ;++i) { + for (int i = 0;; ++i) { if (szStatusNoteAnsi[i] != szStatusMsg[i] && szStatusNoteAnsi[i] != '?' && szStatusMsg[i] != '?') { notmatch = true; break; @@ -156,7 +156,7 @@ void CIcqProto::setStatusMsgVar(MCONTACT hContact, char* szStatusMsg, bool isAns SAFE_FREE(&szStatusNote); } - char* oldStatusMsg = NULL; + char *oldStatusMsg = NULL; DBVARIANT dbv; if ( !db_get_ts(hContact, "CList", "StatusMsg", &dbv)) { oldStatusMsg = make_utf8_string(dbv.ptszVal); @@ -203,8 +203,7 @@ MCONTACT CIcqProto::FindFirstContact() MCONTACT CIcqProto::FindNextContact(MCONTACT hContact) { hContact = db_find_next(hContact, m_szModuleName); - while (hContact != NULL) - { + while (hContact != NULL) { if (IsICQContact(hContact)) return hContact; hContact = db_find_next(hContact, m_szModuleName); diff --git a/protocols/IcqOscarJ/src/icq_fieldnames.cpp b/protocols/IcqOscarJ/src/icq_fieldnames.cpp index 1e25a7bc40..a5aed0f8f9 100644 --- a/protocols/IcqOscarJ/src/icq_fieldnames.cpp +++ b/protocols/IcqOscarJ/src/icq_fieldnames.cpp @@ -27,539 +27,542 @@ // Describe me here please... // // ----------------------------------------------------------------------------- -#include "icqoscar.h" +#include "icqoscar.h" -const FieldNamesItem countryField[]={ - {9999, LPGEN("Other")}, - {93, LPGEN("Afghanistan")}, - {355, LPGEN("Albania")}, - {213, LPGEN("Algeria")}, - {376, LPGEN("Andorra")}, - {244, LPGEN("Angola")}, - {1264, LPGEN("Anguilla")}, - {1268, LPGEN("Antigua and Barbuda")}, -//{5902, LPGEN("Antilles")}, /* removed: it is not a country, it's a group of islands from diffrent countries (all are included in the list)*/ - {54, LPGEN("Argentina")}, - {374, LPGEN("Armenia")}, - {297, LPGEN("Aruba")}, - {247, LPGEN("Ascension Island")}, - {61, LPGEN("Australia")}, - {6720, LPGEN("Australia, Antarctic Territory")}, /* added country code 672(0)*/ - {614, LPGEN("Australia, Christmas Island")}, /* rename (from Christmas Island) and change to official county code 61(4) (from 672) */ - {61891, LPGEN("Australia, Cocos (Keeling) Islands")}, /* rename and change to official county code 61(891) (from 6102) */ - {6723 , LPGEN("Australia, Norfolk Island")}, /* rename (from Norfolk Island) and change to official county code 672(3) (from 6722) */ - {43, LPGEN("Austria")}, - {994, LPGEN("Azerbaijan")}, - {1242, LPGEN("Bahamas")}, - {973, LPGEN("Bahrain")}, - {880, LPGEN("Bangladesh")}, - {1246, LPGEN("Barbados")}, -//{120, LPGEN("Barbuda")}, /* removed: it is not a country and no special island, see Antigua and Barbuda*/ - {375, LPGEN("Belarus")}, - {32, LPGEN("Belgium")}, - {501, LPGEN("Belize")}, - {229, LPGEN("Benin")}, - {1441, LPGEN("Bermuda")}, - {975, LPGEN("Bhutan")}, - {591, LPGEN("Bolivia")}, - {387, LPGEN("Bosnia and Herzegovina")}, - {267, LPGEN("Botswana")}, - {55, LPGEN("Brazil")}, - {106, LPGEN("British Virgin Islands")}, - {673, LPGEN("Brunei")}, - {359, LPGEN("Bulgaria")}, - {226, LPGEN("Burkina Faso")}, - {257, LPGEN("Burundi")}, - {855, LPGEN("Cambodia")}, - {237, LPGEN("Cameroon")}, - {1002, LPGEN("Canada")}, - {178, LPGEN("Canary Islands")}, - {238, LPGEN("Cape Verde")}, - {1345, LPGEN("Cayman Islands")}, - {236, LPGEN("Central African Republic")}, - {235, LPGEN("Chad")}, - {56, LPGEN("Chile")}, - {86, LPGEN("China")}, -//{6101, LPGEN("Cocos (Keeling) Islands")}, /* removed (double): see Australia, Cocos (Keeling) Islands */ - {57, LPGEN("Colombia")}, - {269, LPGEN("Comoros")}, - {243, LPGEN("Congo, Democratic Republic of the")}, - {242, LPGEN("Congo, Republic of the")}, - {682, LPGEN("Cook Islands")}, - {506, LPGEN("Costa Rica")}, - {225, LPGEN("Cote d'Ivoire")}, - {385, LPGEN("Croatia")}, - {53, LPGEN("Cuba")}, - {357, LPGEN("Greek, Republic of South Cyprus")}, /* rename coz Turkey, Republic of Northern Cyprus */ - {420, LPGEN("Czech Republic")}, - {45, LPGEN("Denmark")}, - {246, LPGEN("Diego Garcia")}, - {253, LPGEN("Djibouti")}, - {1767, LPGEN("Dominica")}, - {1809, LPGEN("Dominican Republic")}, - {593, LPGEN("Ecuador")}, - {20, LPGEN("Egypt")}, - {503, LPGEN("El Salvador")}, - {240, LPGEN("Equatorial Guinea")}, - {291, LPGEN("Eritrea")}, - {372, LPGEN("Estonia")}, - {251, LPGEN("Ethiopia")}, - {3883,LPGEN("Europe")}, /* add county code +388 3 official European Telephony Numbering Space*/ - {298, LPGEN("Faroe Islands")}, - {500, LPGEN("Falkland Islands")}, - {679, LPGEN("Fiji")}, - {358, LPGEN("Finland")}, - {33, LPGEN("France")}, - {5901, LPGEN("French Antilles")}, - {594, LPGEN("French Guiana")}, - {689, LPGEN("French Polynesia")}, - {241, LPGEN("Gabon")}, - {220, LPGEN("Gambia")}, - {995, LPGEN("Georgia")}, - {49, LPGEN("Germany")}, - {233, LPGEN("Ghana")}, - {350, LPGEN("Gibraltar")}, - {30, LPGEN("Greece")}, - {299, LPGEN("Greenland")}, - {1473, LPGEN("Grenada")}, - {590, LPGEN("Guadeloupe")}, - {1671, LPGEN("Guam, US Territory of")}, - {502, LPGEN("Guatemala")}, - {224, LPGEN("Guinea")}, - {245, LPGEN("Guinea-Bissau")}, - {592, LPGEN("Guyana")}, - {509, LPGEN("Haiti")}, - {504, LPGEN("Honduras")}, - {852, LPGEN("Hong Kong")}, - {36, LPGEN("Hungary")}, - {354, LPGEN("Iceland")}, - {91, LPGEN("India")}, - {62, LPGEN("Indonesia")}, - {98, LPGEN("Iran")}, - {964, LPGEN("Iraq")}, - {353, LPGEN("Ireland")}, - {972, LPGEN("Israel")}, - {39, LPGEN("Italy")}, - {1876, LPGEN("Jamaica")}, - {81, LPGEN("Japan")}, - {962, LPGEN("Jordan")}, - {705, LPGEN("Kazakhstan")}, - {254, LPGEN("Kenya")}, - {686, LPGEN("Kiribati")}, - {850, LPGEN("Korea, North")}, - {82, LPGEN("Korea, South")}, - {965, LPGEN("Kuwait")}, - {996, LPGEN("Kyrgyzstan")}, - {856, LPGEN("Laos")}, - {371, LPGEN("Latvia")}, - {961, LPGEN("Lebanon")}, - {266, LPGEN("Lesotho")}, - {231, LPGEN("Liberia")}, - {218, LPGEN("Libya")}, - {423, LPGEN("Liechtenstein")}, - {370, LPGEN("Lithuania")}, - {352, LPGEN("Luxembourg")}, - {853, LPGEN("Macau")}, - {389, LPGEN("Macedonia, Republic of")}, - {261, LPGEN("Madagascar")}, - {265, LPGEN("Malawi")}, - {60, LPGEN("Malaysia")}, - {960, LPGEN("Maldives")}, - {223, LPGEN("Mali")}, - {356, LPGEN("Malta")}, - {692, LPGEN("Marshall Islands")}, - {596, LPGEN("Martinique")}, - {222, LPGEN("Mauritania")}, - {230, LPGEN("Mauritius")}, - {262, LPGEN("Mayotte")}, - {52, LPGEN("Mexico")}, - {691, LPGEN("Micronesia, Federated States of")}, - {373, LPGEN("Moldova")}, - {377, LPGEN("Monaco")}, - {976, LPGEN("Mongolia")}, - {1664, LPGEN("Montserrat")}, - {212, LPGEN("Morocco")}, - {258, LPGEN("Mozambique")}, - {95, LPGEN("Myanmar")}, - {264, LPGEN("Namibia")}, - {674, LPGEN("Nauru")}, - {977, LPGEN("Nepal")}, - {31, LPGEN("Netherlands")}, - {599, LPGEN("Netherlands Antilles")}, /* dissolved 2010 */ - {5995, LPGEN("St. Maarten")}, /* add new country in 2010 (from Netherlands Antilles) */ - {5999, LPGEN("Curacao")}, /* add new country in 2010 (from Netherlands Antilles) */ - {5997, LPGEN("Netherlands (Bonaire Island)")}, /* add new Part of Netherlands in 2010 (from Netherlands Antilles) */ - {59946, LPGEN("Netherlands (Saba Island)")}, /* add new Part of Netherlands in 2010 (from Netherlands Antilles) */ - {59938, LPGEN("Netherlands (St. Eustatius Island)")}, /* add new Part of Netherlands in 2010 (from Netherlands Antilles) */ -//{114, LPGEN("Nevis")}, /* removed: it is not a country, it's part of Saint Kitts and Nevis*/ - {687, LPGEN("New Caledonia")}, - {64, LPGEN("New Zealand")}, - {505, LPGEN("Nicaragua")}, - {227, LPGEN("Niger")}, - {234, LPGEN("Nigeria")}, - {683, LPGEN("Niue")}, - {1670, LPGEN("Northern Mariana Islands, US Territory of")}, /* added NANP */ - {47, LPGEN("Norway")}, - {968, LPGEN("Oman")}, - {92, LPGEN("Pakistan")}, - {680, LPGEN("Palau")}, - {507, LPGEN("Panama")}, - {675, LPGEN("Papua New Guinea")}, - {595, LPGEN("Paraguay")}, - {51, LPGEN("Peru")}, - {63, LPGEN("Philippines")}, - {48, LPGEN("Poland")}, - {351, LPGEN("Portugal")}, - {1939, LPGEN("Puerto Rico")}, - {974, LPGEN("Qatar")}, - {262, LPGEN("Reunion")}, - {40, LPGEN("Romania")}, -//{6701, LPGEN("Rota Island")}, /* removed: it is not a country it is part of Northern Mariana Islands, US Territory of */ - {7, LPGEN("Russia")}, - {250, LPGEN("Rwanda")}, - {1684, LPGEN("Samoa (USA)")}, /* rename (from American Samoa) change county code to NANP (from 684) */ - {685, LPGEN("Samoa, Western")}, /* rename (from Western Samoa) */ - {290, LPGEN("Saint Helena")}, -//{115, LPGEN("Saint Kitts")}, /* removed: it is not a country it is part of Saint Kitts and Nevis*/ - {1869, LPGEN("Saint Kitts and Nevis")}, - {1758, LPGEN("Saint Lucia")}, - {508, LPGEN("Saint Pierre and Miquelon")}, - {1784, LPGEN("Saint Vincent and the Grenadines")}, -//{670, LPGEN("Saipan Island")}, /* removed: it is not a country it is part of Northern Mariana Islands, US Territory of */ - {378, LPGEN("San Marino")}, - {239, LPGEN("Sao Tome and Principe")}, - {966, LPGEN("Saudi Arabia")}, - {442, LPGEN("Scotland")}, - {221, LPGEN("Senegal")}, - {248, LPGEN("Seychelles")}, - {232, LPGEN("Sierra Leone")}, - {65, LPGEN("Singapore")}, - {421, LPGEN("Slovakia")}, - {386, LPGEN("Slovenia")}, - {677, LPGEN("Solomon Islands")}, - {252, LPGEN("Somalia")}, - {27, LPGEN("South Africa")}, - {34, LPGEN("Spain")}, - {3492, LPGEN("Spain, Canary Islands")}, /*rename and change county code to 34(92) spain + canary code*/ - {94, LPGEN("Sri Lanka")}, - {249, LPGEN("Sudan")}, - {597, LPGEN("Suriname")}, - {268, LPGEN("Swaziland")}, - {46, LPGEN("Sweden")}, - {41, LPGEN("Switzerland")}, - {963, LPGEN("Syria")}, - {886, LPGEN("Taiwan")}, - {992, LPGEN("Tajikistan")}, - {255, LPGEN("Tanzania")}, - {66, LPGEN("Thailand")}, -//{6702, LPGEN("Tinian Island")}, /* removed: it is not a country it is part of Northern Mariana Islands, US Territory of */ - {670 , LPGEN("Timor, East")}, /* added (is part off Northern Mariana Islands but not US Territory*/ - {228, LPGEN("Togo")}, - {690, LPGEN("Tokelau")}, - {676, LPGEN("Tonga")}, - {1868, LPGEN("Trinidad and Tobago")}, - {216, LPGEN("Tunisia")}, - {90, LPGEN("Turkey")}, - {90392, LPGEN("Turkey, Republic of Northern Cyprus")}, /* added (is diffrent from Greek part)*/ - {993, LPGEN("Turkmenistan")}, - {1649, LPGEN("Turks and Caicos Islands")}, - {688, LPGEN("Tuvalu")}, - {256, LPGEN("Uganda")}, - {380, LPGEN("Ukraine")}, - {971, LPGEN("United Arab Emirates")}, - {44, LPGEN("United Kingdom")}, - {598, LPGEN("Uruguay")}, - {1, LPGEN("USA")}, - {998, LPGEN("Uzbekistan")}, - {678, LPGEN("Vanuatu")}, - {379, LPGEN("Vatican City")}, - {58, LPGEN("Venezuela")}, - {84, LPGEN("Vietnam")}, - {1284, LPGEN("Virgin Islands (UK)")}, /* change county code to NANP (from 105) - rename coz Virgin Islands (USA) */ - {1340, LPGEN("Virgin Islands (USA)")}, /* change county code to NANP (from 123) */ - {441, LPGEN("Wales")}, - {681, LPGEN("Wallis and Futuna")}, - {967, LPGEN("Yemen")}, - {38, LPGEN("Yugoslavia")}, - {381, LPGEN("Serbia")}, /* rename need (from Yugoslavia)*/ - {383, LPGEN("Kosovo, Republic of")}, /*change country code (from 3811), rename need (from Yugoslavia - Serbia) */ - {382, LPGEN("Montenegro")}, /* rename need (from Yugoslavia - Montenegro) */ - {260, LPGEN("Zambia")}, - {263, LPGEN("Zimbabwe")}, - {0, NULL} +const FieldNamesItem timezonesField[] = +{ + { -100, NULL } }; - -const FieldNamesItem interestsField[]={ - {137, LPGEN("50's")}, - {134, LPGEN("60's")}, - {135, LPGEN("70's")}, - {136, LPGEN("80's")}, - {100, LPGEN("Art")}, - {128, LPGEN("Astronomy")}, - {147, LPGEN("Audio and Visual")}, - {125, LPGEN("Business")}, - {146, LPGEN("Business Services")}, - {101, LPGEN("Cars")}, - {102, LPGEN("Celebrity Fans")}, - {130, LPGEN("Clothing")}, - {103, LPGEN("Collections")}, - {104, LPGEN("Computers")}, - {105, LPGEN("Culture")}, - {122, LPGEN("Ecology")}, - {139, LPGEN("Entertainment")}, - {138, LPGEN("Finance and Corporate")}, - {106, LPGEN("Fitness")}, - {142, LPGEN("Health and Beauty")}, - {108, LPGEN("Hobbies")}, - {150, LPGEN("Home Automation")}, - {144, LPGEN("Household Products")}, - {107, LPGEN("Games")}, - {124, LPGEN("Government")}, - {109, LPGEN("ICQ - Help")}, - {110, LPGEN("Internet")}, - {111, LPGEN("Lifestyle")}, - {145, LPGEN("Mail Order Catalog")}, - {143, LPGEN("Media")}, - {112, LPGEN("Movies and TV")}, - {113, LPGEN("Music")}, - {126, LPGEN("Mystics")}, - {123, LPGEN("News and Media")}, - {114, LPGEN("Outdoors")}, - {115, LPGEN("Parenting")}, - {131, LPGEN("Parties")}, - {116, LPGEN("Pets and Animals")}, - {149, LPGEN("Publishing")}, - {117, LPGEN("Religion")}, - {141, LPGEN("Retail Stores")}, - {118, LPGEN("Science")}, - {119, LPGEN("Skills")}, - {133, LPGEN("Social science")}, - {129, LPGEN("Space")}, - {148, LPGEN("Sporting and Athletic")}, - {120, LPGEN("Sports")}, - {127, LPGEN("Travel")}, - {121, LPGEN("Web Design")}, - {132, LPGEN("Women")}, - {-1, NULL} +const FieldNamesItem countryField[] = { + { 9999, LPGEN("Other") }, + { 93, LPGEN("Afghanistan") }, + { 355, LPGEN("Albania") }, + { 213, LPGEN("Algeria") }, + { 376, LPGEN("Andorra") }, + { 244, LPGEN("Angola") }, + { 1264, LPGEN("Anguilla") }, + { 1268, LPGEN("Antigua and Barbuda") }, + { 54, LPGEN("Argentina") }, + { 374, LPGEN("Armenia") }, + { 297, LPGEN("Aruba") }, + { 247, LPGEN("Ascension Island") }, + { 61, LPGEN("Australia") }, + { 6720, LPGEN("Australia, Antarctic Territory") }, /* added country code 672(0)*/ + { 614, LPGEN("Australia, Christmas Island") }, /* rename (from Christmas Island) and change to official county code 61(4) (from 672) */ + { 61891, LPGEN("Australia, Cocos (Keeling) Islands") }, /* rename and change to official county code 61(891) (from 6102) */ + { 6723, LPGEN("Australia, Norfolk Island") }, /* rename (from Norfolk Island) and change to official county code 672(3) (from 6722) */ + { 43, LPGEN("Austria") }, + { 994, LPGEN("Azerbaijan") }, + { 1242, LPGEN("Bahamas") }, + { 973, LPGEN("Bahrain") }, + { 880, LPGEN("Bangladesh") }, + { 1246, LPGEN("Barbados") }, + //{120, LPGEN("Barbuda")}, /* removed: it is not a country and no special island, see Antigua and Barbuda*/ + { 375, LPGEN("Belarus") }, + { 32, LPGEN("Belgium") }, + { 501, LPGEN("Belize") }, + { 229, LPGEN("Benin") }, + { 1441, LPGEN("Bermuda") }, + { 975, LPGEN("Bhutan") }, + { 591, LPGEN("Bolivia") }, + { 387, LPGEN("Bosnia and Herzegovina") }, + { 267, LPGEN("Botswana") }, + { 55, LPGEN("Brazil") }, + { 106, LPGEN("British Virgin Islands") }, + { 673, LPGEN("Brunei") }, + { 359, LPGEN("Bulgaria") }, + { 226, LPGEN("Burkina Faso") }, + { 257, LPGEN("Burundi") }, + { 855, LPGEN("Cambodia") }, + { 237, LPGEN("Cameroon") }, + { 1002, LPGEN("Canada") }, + { 178, LPGEN("Canary Islands") }, + { 238, LPGEN("Cape Verde") }, + { 1345, LPGEN("Cayman Islands") }, + { 236, LPGEN("Central African Republic") }, + { 235, LPGEN("Chad") }, + { 56, LPGEN("Chile") }, + { 86, LPGEN("China") }, + { 57, LPGEN("Colombia") }, + { 269, LPGEN("Comoros") }, + { 243, LPGEN("Congo, Democratic Republic of the") }, + { 242, LPGEN("Congo, Republic of the") }, + { 682, LPGEN("Cook Islands") }, + { 506, LPGEN("Costa Rica") }, + { 225, LPGEN("Cote d'Ivoire") }, + { 385, LPGEN("Croatia") }, + { 53, LPGEN("Cuba") }, + { 357, LPGEN("Greek, Republic of South Cyprus") }, /* rename coz Turkey, Republic of Northern Cyprus */ + { 420, LPGEN("Czech Republic") }, + { 45, LPGEN("Denmark") }, + { 246, LPGEN("Diego Garcia") }, + { 253, LPGEN("Djibouti") }, + { 1767, LPGEN("Dominica") }, + { 1809, LPGEN("Dominican Republic") }, + { 593, LPGEN("Ecuador") }, + { 20, LPGEN("Egypt") }, + { 503, LPGEN("El Salvador") }, + { 240, LPGEN("Equatorial Guinea") }, + { 291, LPGEN("Eritrea") }, + { 372, LPGEN("Estonia") }, + { 251, LPGEN("Ethiopia") }, + { 3883, LPGEN("Europe") }, /* add county code +388 3 official European Telephony Numbering Space*/ + { 298, LPGEN("Faroe Islands") }, + { 500, LPGEN("Falkland Islands") }, + { 679, LPGEN("Fiji") }, + { 358, LPGEN("Finland") }, + { 33, LPGEN("France") }, + { 5901, LPGEN("French Antilles") }, + { 594, LPGEN("French Guiana") }, + { 689, LPGEN("French Polynesia") }, + { 241, LPGEN("Gabon") }, + { 220, LPGEN("Gambia") }, + { 995, LPGEN("Georgia") }, + { 49, LPGEN("Germany") }, + { 233, LPGEN("Ghana") }, + { 350, LPGEN("Gibraltar") }, + { 30, LPGEN("Greece") }, + { 299, LPGEN("Greenland") }, + { 1473, LPGEN("Grenada") }, + { 590, LPGEN("Guadeloupe") }, + { 1671, LPGEN("Guam, US Territory of") }, + { 502, LPGEN("Guatemala") }, + { 224, LPGEN("Guinea") }, + { 245, LPGEN("Guinea-Bissau") }, + { 592, LPGEN("Guyana") }, + { 509, LPGEN("Haiti") }, + { 504, LPGEN("Honduras") }, + { 852, LPGEN("Hong Kong") }, + { 36, LPGEN("Hungary") }, + { 354, LPGEN("Iceland") }, + { 91, LPGEN("India") }, + { 62, LPGEN("Indonesia") }, + { 98, LPGEN("Iran") }, + { 964, LPGEN("Iraq") }, + { 353, LPGEN("Ireland") }, + { 972, LPGEN("Israel") }, + { 39, LPGEN("Italy") }, + { 1876, LPGEN("Jamaica") }, + { 81, LPGEN("Japan") }, + { 962, LPGEN("Jordan") }, + { 705, LPGEN("Kazakhstan") }, + { 254, LPGEN("Kenya") }, + { 686, LPGEN("Kiribati") }, + { 850, LPGEN("Korea, North") }, + { 82, LPGEN("Korea, South") }, + { 965, LPGEN("Kuwait") }, + { 996, LPGEN("Kyrgyzstan") }, + { 856, LPGEN("Laos") }, + { 371, LPGEN("Latvia") }, + { 961, LPGEN("Lebanon") }, + { 266, LPGEN("Lesotho") }, + { 231, LPGEN("Liberia") }, + { 218, LPGEN("Libya") }, + { 423, LPGEN("Liechtenstein") }, + { 370, LPGEN("Lithuania") }, + { 352, LPGEN("Luxembourg") }, + { 853, LPGEN("Macau") }, + { 389, LPGEN("Macedonia, Republic of") }, + { 261, LPGEN("Madagascar") }, + { 265, LPGEN("Malawi") }, + { 60, LPGEN("Malaysia") }, + { 960, LPGEN("Maldives") }, + { 223, LPGEN("Mali") }, + { 356, LPGEN("Malta") }, + { 692, LPGEN("Marshall Islands") }, + { 596, LPGEN("Martinique") }, + { 222, LPGEN("Mauritania") }, + { 230, LPGEN("Mauritius") }, + { 262, LPGEN("Mayotte") }, + { 52, LPGEN("Mexico") }, + { 691, LPGEN("Micronesia, Federated States of") }, + { 373, LPGEN("Moldova") }, + { 377, LPGEN("Monaco") }, + { 976, LPGEN("Mongolia") }, + { 1664, LPGEN("Montserrat") }, + { 212, LPGEN("Morocco") }, + { 258, LPGEN("Mozambique") }, + { 95, LPGEN("Myanmar") }, + { 264, LPGEN("Namibia") }, + { 674, LPGEN("Nauru") }, + { 977, LPGEN("Nepal") }, + { 31, LPGEN("Netherlands") }, + { 599, LPGEN("Netherlands Antilles") }, /* dissolved 2010 */ + { 5995, LPGEN("St. Maarten") }, /* add new country in 2010 (from Netherlands Antilles) */ + { 5999, LPGEN("Curacao") }, /* add new country in 2010 (from Netherlands Antilles) */ + { 5997, LPGEN("Netherlands (Bonaire Island)") }, /* add new Part of Netherlands in 2010 (from Netherlands Antilles) */ + { 59946, LPGEN("Netherlands (Saba Island)") }, /* add new Part of Netherlands in 2010 (from Netherlands Antilles) */ + { 59938, LPGEN("Netherlands (St. Eustatius Island)") }, /* add new Part of Netherlands in 2010 (from Netherlands Antilles) */ + { 687, LPGEN("New Caledonia") }, + { 64, LPGEN("New Zealand") }, + { 505, LPGEN("Nicaragua") }, + { 227, LPGEN("Niger") }, + { 234, LPGEN("Nigeria") }, + { 683, LPGEN("Niue") }, + { 1670, LPGEN("Northern Mariana Islands, US Territory of") }, /* added NANP */ + { 47, LPGEN("Norway") }, + { 968, LPGEN("Oman") }, + { 92, LPGEN("Pakistan") }, + { 680, LPGEN("Palau") }, + { 507, LPGEN("Panama") }, + { 675, LPGEN("Papua New Guinea") }, + { 595, LPGEN("Paraguay") }, + { 51, LPGEN("Peru") }, + { 63, LPGEN("Philippines") }, + { 48, LPGEN("Poland") }, + { 351, LPGEN("Portugal") }, + { 1939, LPGEN("Puerto Rico") }, + { 974, LPGEN("Qatar") }, + { 262, LPGEN("Reunion") }, + { 40, LPGEN("Romania") }, + { 7, LPGEN("Russia") }, + { 250, LPGEN("Rwanda") }, + { 1684, LPGEN("Samoa (USA)") }, /* rename (from American Samoa) change county code to NANP (from 684) */ + { 685, LPGEN("Samoa, Western") }, /* rename (from Western Samoa) */ + { 290, LPGEN("Saint Helena") }, + { 1869, LPGEN("Saint Kitts and Nevis") }, + { 1758, LPGEN("Saint Lucia") }, + { 508, LPGEN("Saint Pierre and Miquelon") }, + { 1784, LPGEN("Saint Vincent and the Grenadines") }, + { 378, LPGEN("San Marino") }, + { 239, LPGEN("Sao Tome and Principe") }, + { 966, LPGEN("Saudi Arabia") }, + { 442, LPGEN("Scotland") }, + { 221, LPGEN("Senegal") }, + { 248, LPGEN("Seychelles") }, + { 232, LPGEN("Sierra Leone") }, + { 65, LPGEN("Singapore") }, + { 421, LPGEN("Slovakia") }, + { 386, LPGEN("Slovenia") }, + { 677, LPGEN("Solomon Islands") }, + { 252, LPGEN("Somalia") }, + { 27, LPGEN("South Africa") }, + { 34, LPGEN("Spain") }, + { 3492, LPGEN("Spain, Canary Islands") }, /*rename and change county code to 34(92) spain + canary code*/ + { 94, LPGEN("Sri Lanka") }, + { 249, LPGEN("Sudan") }, + { 597, LPGEN("Suriname") }, + { 268, LPGEN("Swaziland") }, + { 46, LPGEN("Sweden") }, + { 41, LPGEN("Switzerland") }, + { 963, LPGEN("Syria") }, + { 886, LPGEN("Taiwan") }, + { 992, LPGEN("Tajikistan") }, + { 255, LPGEN("Tanzania") }, + { 66, LPGEN("Thailand") }, + //{6702, LPGEN("Tinian Island")}, /* removed: it is not a country it is part of Northern Mariana Islands, US Territory of */ + { 670, LPGEN("Timor, East") }, /* added (is part off Northern Mariana Islands but not US Territory*/ + { 228, LPGEN("Togo") }, + { 690, LPGEN("Tokelau") }, + { 676, LPGEN("Tonga") }, + { 1868, LPGEN("Trinidad and Tobago") }, + { 216, LPGEN("Tunisia") }, + { 90, LPGEN("Turkey") }, + { 90392, LPGEN("Turkey, Republic of Northern Cyprus") }, /* added (is diffrent from Greek part)*/ + { 993, LPGEN("Turkmenistan") }, + { 1649, LPGEN("Turks and Caicos Islands") }, + { 688, LPGEN("Tuvalu") }, + { 256, LPGEN("Uganda") }, + { 380, LPGEN("Ukraine") }, + { 971, LPGEN("United Arab Emirates") }, + { 44, LPGEN("United Kingdom") }, + { 598, LPGEN("Uruguay") }, + { 1, LPGEN("USA") }, + { 998, LPGEN("Uzbekistan") }, + { 678, LPGEN("Vanuatu") }, + { 379, LPGEN("Vatican City") }, + { 58, LPGEN("Venezuela") }, + { 84, LPGEN("Vietnam") }, + { 1284, LPGEN("Virgin Islands (UK)") }, /* change county code to NANP (from 105) - rename coz Virgin Islands (USA) */ + { 1340, LPGEN("Virgin Islands (USA)") }, /* change county code to NANP (from 123) */ + { 441, LPGEN("Wales") }, + { 681, LPGEN("Wallis and Futuna") }, + { 967, LPGEN("Yemen") }, + { 38, LPGEN("Yugoslavia") }, + { 381, LPGEN("Serbia") }, /* rename need (from Yugoslavia)*/ + { 383, LPGEN("Kosovo, Republic of") }, /*change country code (from 3811), rename need (from Yugoslavia - Serbia) */ + { 382, LPGEN("Montenegro") }, /* rename need (from Yugoslavia - Montenegro) */ + { 260, LPGEN("Zambia") }, + { 263, LPGEN("Zimbabwe") }, + { 0, NULL } }; - -const FieldNamesItem languageField[]={ - {55, LPGEN("Afrikaans")}, - {58, LPGEN("Albanian")}, - {1, LPGEN("Arabic")}, - {59, LPGEN("Armenian")}, - {68, LPGEN("Azerbaijani")}, - {72, LPGEN("Belorussian")}, - {2, LPGEN("Bhojpuri")}, - {56, LPGEN("Bosnian")}, - {3, LPGEN("Bulgarian")}, - {4, LPGEN("Burmese")}, - {5, LPGEN("Cantonese")}, - {6, LPGEN("Catalan")}, - {61, LPGEN("Chamorro")}, - {7, LPGEN("Chinese")}, - {8, LPGEN("Croatian")}, - {9, LPGEN("Czech")}, - {10, LPGEN("Danish")}, - {11, LPGEN("Dutch")}, - {12, LPGEN("English")}, - {13, LPGEN("Esperanto")}, - {14, LPGEN("Estonian")}, - {15, LPGEN("Farsi")}, - {16, LPGEN("Finnish")}, - {17, LPGEN("French")}, - {18, LPGEN("Gaelic")}, - {19, LPGEN("German")}, - {20, LPGEN("Greek")}, - {70, LPGEN("Gujarati")}, - {21, LPGEN("Hebrew")}, - {22, LPGEN("Hindi")}, - {23, LPGEN("Hungarian")}, - {24, LPGEN("Icelandic")}, - {25, LPGEN("Indonesian")}, - {26, LPGEN("Italian")}, - {27, LPGEN("Japanese")}, - {28, LPGEN("Khmer")}, - {29, LPGEN("Korean")}, - {69, LPGEN("Kurdish")}, - {30, LPGEN("Lao")}, - {31, LPGEN("Latvian")}, - {32, LPGEN("Lithuanian")}, - {65, LPGEN("Macedonian")}, - {33, LPGEN("Malay")}, - {63, LPGEN("Mandarin")}, - {62, LPGEN("Mongolian")}, - {34, LPGEN("Norwegian")}, - {57, LPGEN("Persian")}, - {35, LPGEN("Polish")}, - {36, LPGEN("Portuguese")}, - {60, LPGEN("Punjabi")}, - {37, LPGEN("Romanian")}, - {38, LPGEN("Russian")}, - {39, LPGEN("Serbian")}, - {66, LPGEN("Sindhi")}, - {40, LPGEN("Slovak")}, - {41, LPGEN("Slovenian")}, - {42, LPGEN("Somali")}, - {43, LPGEN("Spanish")}, - {44, LPGEN("Swahili")}, - {45, LPGEN("Swedish")}, - {46, LPGEN("Tagalog")}, - {64, LPGEN("Taiwanese")}, - {71, LPGEN("Tamil")}, - {47, LPGEN("Tatar")}, - {48, LPGEN("Thai")}, - {49, LPGEN("Turkish")}, - {50, LPGEN("Ukrainian")}, - {51, LPGEN("Urdu")}, - {52, LPGEN("Vietnamese")}, - {67, LPGEN("Welsh")}, - {53, LPGEN("Yiddish")}, - {54, LPGEN("Yoruba")}, - {0, NULL} +const FieldNamesItem interestsField[] = +{ + { 137, LPGEN("50's") }, + { 134, LPGEN("60's") }, + { 135, LPGEN("70's") }, + { 136, LPGEN("80's") }, + { 100, LPGEN("Art") }, + { 128, LPGEN("Astronomy") }, + { 147, LPGEN("Audio and Visual") }, + { 125, LPGEN("Business") }, + { 146, LPGEN("Business Services") }, + { 101, LPGEN("Cars") }, + { 102, LPGEN("Celebrity Fans") }, + { 130, LPGEN("Clothing") }, + { 103, LPGEN("Collections") }, + { 104, LPGEN("Computers") }, + { 105, LPGEN("Culture") }, + { 122, LPGEN("Ecology") }, + { 139, LPGEN("Entertainment") }, + { 138, LPGEN("Finance and Corporate") }, + { 106, LPGEN("Fitness") }, + { 142, LPGEN("Health and Beauty") }, + { 108, LPGEN("Hobbies") }, + { 150, LPGEN("Home Automation") }, + { 144, LPGEN("Household Products") }, + { 107, LPGEN("Games") }, + { 124, LPGEN("Government") }, + { 109, LPGEN("ICQ - Help") }, + { 110, LPGEN("Internet") }, + { 111, LPGEN("Lifestyle") }, + { 145, LPGEN("Mail Order Catalog") }, + { 143, LPGEN("Media") }, + { 112, LPGEN("Movies and TV") }, + { 113, LPGEN("Music") }, + { 126, LPGEN("Mystics") }, + { 123, LPGEN("News and Media") }, + { 114, LPGEN("Outdoors") }, + { 115, LPGEN("Parenting") }, + { 131, LPGEN("Parties") }, + { 116, LPGEN("Pets and Animals") }, + { 149, LPGEN("Publishing") }, + { 117, LPGEN("Religion") }, + { 141, LPGEN("Retail Stores") }, + { 118, LPGEN("Science") }, + { 119, LPGEN("Skills") }, + { 133, LPGEN("Social science") }, + { 129, LPGEN("Space") }, + { 148, LPGEN("Sporting and Athletic") }, + { 120, LPGEN("Sports") }, + { 127, LPGEN("Travel") }, + { 121, LPGEN("Web Design") }, + { 132, LPGEN("Women") }, + { -1, NULL } }; - -const FieldNamesItem pastField[]={ - {300, LPGEN("Elementary School")}, - {301, LPGEN("High School")}, - {302, LPGEN("College")}, - {303, LPGEN("University")}, - {304, LPGEN("Military")}, - {305, LPGEN("Past Work Place")}, - {306, LPGEN("Past Organization")}, - {399, LPGEN("Other")}, - {0, NULL} +const FieldNamesItem languageField[] = +{ + { 55, LPGEN("Afrikaans") }, + { 58, LPGEN("Albanian") }, + { 1, LPGEN("Arabic") }, + { 59, LPGEN("Armenian") }, + { 68, LPGEN("Azerbaijani") }, + { 72, LPGEN("Belorussian") }, + { 2, LPGEN("Bhojpuri") }, + { 56, LPGEN("Bosnian") }, + { 3, LPGEN("Bulgarian") }, + { 4, LPGEN("Burmese") }, + { 5, LPGEN("Cantonese") }, + { 6, LPGEN("Catalan") }, + { 61, LPGEN("Chamorro") }, + { 7, LPGEN("Chinese") }, + { 8, LPGEN("Croatian") }, + { 9, LPGEN("Czech") }, + { 10, LPGEN("Danish") }, + { 11, LPGEN("Dutch") }, + { 12, LPGEN("English") }, + { 13, LPGEN("Esperanto") }, + { 14, LPGEN("Estonian") }, + { 15, LPGEN("Farsi") }, + { 16, LPGEN("Finnish") }, + { 17, LPGEN("French") }, + { 18, LPGEN("Gaelic") }, + { 19, LPGEN("German") }, + { 20, LPGEN("Greek") }, + { 70, LPGEN("Gujarati") }, + { 21, LPGEN("Hebrew") }, + { 22, LPGEN("Hindi") }, + { 23, LPGEN("Hungarian") }, + { 24, LPGEN("Icelandic") }, + { 25, LPGEN("Indonesian") }, + { 26, LPGEN("Italian") }, + { 27, LPGEN("Japanese") }, + { 28, LPGEN("Khmer") }, + { 29, LPGEN("Korean") }, + { 69, LPGEN("Kurdish") }, + { 30, LPGEN("Lao") }, + { 31, LPGEN("Latvian") }, + { 32, LPGEN("Lithuanian") }, + { 65, LPGEN("Macedonian") }, + { 33, LPGEN("Malay") }, + { 63, LPGEN("Mandarin") }, + { 62, LPGEN("Mongolian") }, + { 34, LPGEN("Norwegian") }, + { 57, LPGEN("Persian") }, + { 35, LPGEN("Polish") }, + { 36, LPGEN("Portuguese") }, + { 60, LPGEN("Punjabi") }, + { 37, LPGEN("Romanian") }, + { 38, LPGEN("Russian") }, + { 39, LPGEN("Serbian") }, + { 66, LPGEN("Sindhi") }, + { 40, LPGEN("Slovak") }, + { 41, LPGEN("Slovenian") }, + { 42, LPGEN("Somali") }, + { 43, LPGEN("Spanish") }, + { 44, LPGEN("Swahili") }, + { 45, LPGEN("Swedish") }, + { 46, LPGEN("Tagalog") }, + { 64, LPGEN("Taiwanese") }, + { 71, LPGEN("Tamil") }, + { 47, LPGEN("Tatar") }, + { 48, LPGEN("Thai") }, + { 49, LPGEN("Turkish") }, + { 50, LPGEN("Ukrainian") }, + { 51, LPGEN("Urdu") }, + { 52, LPGEN("Vietnamese") }, + { 67, LPGEN("Welsh") }, + { 53, LPGEN("Yiddish") }, + { 54, LPGEN("Yoruba") }, + { 0, NULL } }; - -const FieldNamesItem genderField[]={ - {'F', LPGEN("Female")}, - {'M', LPGEN("Male")}, - {0, NULL} +const FieldNamesItem pastField[] = +{ + { 300, LPGEN("Elementary School") }, + { 301, LPGEN("High School") }, + { 302, LPGEN("College") }, + { 303, LPGEN("University") }, + { 304, LPGEN("Military") }, + { 305, LPGEN("Past Work Place") }, + { 306, LPGEN("Past Organization") }, + { 399, LPGEN("Other") }, + { 0, NULL } }; - -const FieldNamesItem studyLevelField[]={ - {4, LPGEN("Associated degree")}, - {5, LPGEN("Bachelor's degree")}, - {1, LPGEN("Elementary")}, - {2, LPGEN("High-school")}, - {6, LPGEN("Master's degree")}, - {7, LPGEN("PhD")}, - {8, LPGEN("Postdoctoral")}, - {3, LPGEN("University / College")}, - {0, NULL} +const FieldNamesItem genderField[] = +{ + { 'F', LPGEN("Female") }, + { 'M', LPGEN("Male") }, + { 0, NULL } }; +const FieldNamesItem studyLevelField[] = +{ + { 4, LPGEN("Associated degree") }, + { 5, LPGEN("Bachelor's degree") }, + { 1, LPGEN("Elementary") }, + { 2, LPGEN("High-school") }, + { 6, LPGEN("Master's degree") }, + { 7, LPGEN("PhD") }, + { 8, LPGEN("Postdoctoral") }, + { 3, LPGEN("University / College") }, + { 0, NULL } +}; -const FieldNamesItem industryField[]={ - {2, LPGEN("Agriculture")}, - {3, LPGEN("Arts")}, - {4, LPGEN("Construction")}, - {5, LPGEN("Consumer Goods")}, - {6, LPGEN("Corporate Services")}, - {7, LPGEN("Education")}, - {8, LPGEN("Finance")}, - {9, LPGEN("Government")}, - {10, LPGEN("High Tech")}, - {11, LPGEN("Legal")}, - {12, LPGEN("Manufacturing")}, - {13, LPGEN("Media")}, - {14, LPGEN("Medical & Health Care")}, - {15, LPGEN("Non-Profit Organization Management")}, - {19, LPGEN("Other")}, - {16, LPGEN("Recreation, Travel & Entertainment")}, - {17, LPGEN("Service Industry")}, - {18, LPGEN("Transportation")}, - {0, NULL} +const FieldNamesItem industryField[] = +{ + { 2, LPGEN("Agriculture") }, + { 3, LPGEN("Arts") }, + { 4, LPGEN("Construction") }, + { 5, LPGEN("Consumer Goods") }, + { 6, LPGEN("Corporate Services") }, + { 7, LPGEN("Education") }, + { 8, LPGEN("Finance") }, + { 9, LPGEN("Government") }, + { 10, LPGEN("High Tech") }, + { 11, LPGEN("Legal") }, + { 12, LPGEN("Manufacturing") }, + { 13, LPGEN("Media") }, + { 14, LPGEN("Medical & Health Care") }, + { 15, LPGEN("Non-Profit Organization Management") }, + { 19, LPGEN("Other") }, + { 16, LPGEN("Recreation, Travel & Entertainment") }, + { 17, LPGEN("Service Industry") }, + { 18, LPGEN("Transportation") }, + { 0, NULL } }; -const FieldNamesItem occupationField[]={ - {1, LPGEN("Academic")}, - {2, LPGEN("Administrative")}, - {3, LPGEN("Art/Entertainment")}, - {4, LPGEN("College Student")}, - {5, LPGEN("Computers")}, - {6, LPGEN("Community & Social")}, - {7, LPGEN("Education")}, - {8, LPGEN("Engineering")}, - {9, LPGEN("Financial Services")}, - {10, LPGEN("Government")}, - {11, LPGEN("High School Student")}, - {12, LPGEN("Home")}, - {13, LPGEN("ICQ - Providing Help")}, - {14, LPGEN("Law")}, - {15, LPGEN("Managerial")}, - {16, LPGEN("Manufacturing")}, - {17, LPGEN("Medical/Health")}, - {18, LPGEN("Military")}, - {19, LPGEN("Non-Government Organization")}, - {20, LPGEN("Professional")}, - {21, LPGEN("Retail")}, - {22, LPGEN("Retired")}, - {23, LPGEN("Science & Research")}, - {24, LPGEN("Sports")}, - {25, LPGEN("Technical")}, - {26, LPGEN("University Student")}, - {27, LPGEN("Web Building")}, - {99, LPGEN("Other Services")}, - {0, NULL} +const FieldNamesItem occupationField[] = +{ + { 1, LPGEN("Academic") }, + { 2, LPGEN("Administrative") }, + { 3, LPGEN("Art/Entertainment") }, + { 4, LPGEN("College Student") }, + { 5, LPGEN("Computers") }, + { 6, LPGEN("Community & Social") }, + { 7, LPGEN("Education") }, + { 8, LPGEN("Engineering") }, + { 9, LPGEN("Financial Services") }, + { 10, LPGEN("Government") }, + { 11, LPGEN("High School Student") }, + { 12, LPGEN("Home") }, + { 13, LPGEN("ICQ - Providing Help") }, + { 14, LPGEN("Law") }, + { 15, LPGEN("Managerial") }, + { 16, LPGEN("Manufacturing") }, + { 17, LPGEN("Medical/Health") }, + { 18, LPGEN("Military") }, + { 19, LPGEN("Non-Government Organization") }, + { 20, LPGEN("Professional") }, + { 21, LPGEN("Retail") }, + { 22, LPGEN("Retired") }, + { 23, LPGEN("Science & Research") }, + { 24, LPGEN("Sports") }, + { 25, LPGEN("Technical") }, + { 26, LPGEN("University Student") }, + { 27, LPGEN("Web Building") }, + { 99, LPGEN("Other Services") }, + { 0, NULL } }; -const FieldNamesItem affiliationField[]={ - {200, LPGEN("Alumni Org.")}, - {201, LPGEN("Charity Org.")}, - {202, LPGEN("Club/Social Org.")}, - {203, LPGEN("Community Org.")}, - {204, LPGEN("Cultural Org.")}, - {205, LPGEN("Fan Clubs")}, - {206, LPGEN("Fraternity/Sorority")}, - {207, LPGEN("Hobbyists Org.")}, - {208, LPGEN("International Org.")}, - {209, LPGEN("Nature and Environment Org.")}, - {210, LPGEN("Professional Org.")}, - {211, LPGEN("Scientific/Technical Org.")}, - {212, LPGEN("Self Improvement Group")}, - {213, LPGEN("Spiritual/Religious Org.")}, - {214, LPGEN("Sports Org.")}, - {215, LPGEN("Support Org.")}, - {216, LPGEN("Trade and Business Org.")}, - {217, LPGEN("Union")}, - {218, LPGEN("Volunteer Org.")}, - {299, LPGEN("Other")}, - {0, NULL} +const FieldNamesItem affiliationField[] = +{ + { 200, LPGEN("Alumni Org.") }, + { 201, LPGEN("Charity Org.") }, + { 202, LPGEN("Club/Social Org.") }, + { 203, LPGEN("Community Org.") }, + { 204, LPGEN("Cultural Org.") }, + { 205, LPGEN("Fan Clubs") }, + { 206, LPGEN("Fraternity/Sorority") }, + { 207, LPGEN("Hobbyists Org.") }, + { 208, LPGEN("International Org.") }, + { 209, LPGEN("Nature and Environment Org.") }, + { 210, LPGEN("Professional Org.") }, + { 211, LPGEN("Scientific/Technical Org.") }, + { 212, LPGEN("Self Improvement Group") }, + { 213, LPGEN("Spiritual/Religious Org.") }, + { 214, LPGEN("Sports Org.") }, + { 215, LPGEN("Support Org.") }, + { 216, LPGEN("Trade and Business Org.") }, + { 217, LPGEN("Union") }, + { 218, LPGEN("Volunteer Org.") }, + { 299, LPGEN("Other") }, + { 0, NULL } }; -const FieldNamesItem agesField[]={ - {0x0011000D, LPGEN("13-17")}, - {0x00160012, LPGEN("18-22")}, - {0x001D0017, LPGEN("23-29")}, - {0x0027001E, LPGEN("30-39")}, - {0x00310028, LPGEN("40-49")}, - {0x003B0032, LPGEN("50-59")}, - {0x2710003C, LPGEN("60-above")}, - {-1, NULL} +const FieldNamesItem agesField[] = +{ + { 0x0011000D, LPGEN("13-17") }, + { 0x00160012, LPGEN("18-22") }, + { 0x001D0017, LPGEN("23-29") }, + { 0x0027001E, LPGEN("30-39") }, + { 0x00310028, LPGEN("40-49") }, + { 0x003B0032, LPGEN("50-59") }, + { 0x2710003C, LPGEN("60-above") }, + { -1, NULL } }; -const FieldNamesItem maritalField[]={ - {10, LPGEN("Single")}, - {11, LPGEN("Close relationships")}, - {12, LPGEN("Engaged")}, - {20, LPGEN("Married")}, - {30, LPGEN("Divorced")}, - {31, LPGEN("Separated")}, - {40, LPGEN("Widowed")}, - {50, LPGEN("Open relationship")}, - {255, LPGEN("Other")}, - {0, NULL} +const FieldNamesItem maritalField[] = +{ + { 10, LPGEN("Single") }, + { 11, LPGEN("Close relationships") }, + { 12, LPGEN("Engaged") }, + { 20, LPGEN("Married") }, + { 30, LPGEN("Divorced") }, + { 31, LPGEN("Separated") }, + { 40, LPGEN("Widowed") }, + { 50, LPGEN("Open relationship") }, + { 255, LPGEN("Other") }, + { 0, NULL } }; diff --git a/protocols/IcqOscarJ/src/icq_fieldnames.h b/protocols/IcqOscarJ/src/icq_fieldnames.h index cf15475299..de11bbe961 100644 --- a/protocols/IcqOscarJ/src/icq_fieldnames.h +++ b/protocols/IcqOscarJ/src/icq_fieldnames.h @@ -33,6 +33,7 @@ struct FieldNamesItem char *text; }; +extern const FieldNamesItem timezonesField[]; extern const FieldNamesItem countryField[]; extern const FieldNamesItem interestsField[]; extern const FieldNamesItem languageField[]; diff --git a/protocols/IcqOscarJ/src/icq_opts.cpp b/protocols/IcqOscarJ/src/icq_opts.cpp index ded5f25990..4458f5cffd 100644 --- a/protocols/IcqOscarJ/src/icq_opts.cpp +++ b/protocols/IcqOscarJ/src/icq_opts.cpp @@ -61,14 +61,14 @@ static void OptDlgChanged(HWND hwndDlg) static INT_PTR CALLBACK DlgProcIcqOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { - CIcqProto* ppro = (CIcqProto*)GetWindowLongPtr( hwndDlg, GWLP_USERDATA ); + CIcqProto *ppro = (CIcqProto*)GetWindowLongPtr( hwndDlg, GWLP_USERDATA ); switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); ppro = (CIcqProto*)lParam; - SetWindowLongPtr( hwndDlg, GWLP_USERDATA, lParam ); + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam); { DWORD dwUin = ppro->getContactUin(NULL); if (dwUin) @@ -96,15 +96,15 @@ static INT_PTR CALLBACK DlgProcIcqOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP SetDlgItemInt(hwndDlg, IDC_ICQPORT, ppro->getWord("OscarPort", IsDlgButtonChecked(hwndDlg, IDC_SSL) ? DEFAULT_SERVER_PORT_SSL : DEFAULT_SERVER_PORT), FALSE); LoadDBCheckState(ppro, hwndDlg, IDC_KEEPALIVE, "KeepAlive", DEFAULT_KEEPALIVE_ENABLED); SendDlgItemMessage(hwndDlg, IDC_LOGLEVEL, TBM_SETRANGE, FALSE, MAKELONG(0, 4)); - SendDlgItemMessage(hwndDlg, IDC_LOGLEVEL, TBM_SETPOS, TRUE, 4-ppro->getByte("ShowLogLevel", LOG_WARNING)); - SetDlgItemText(hwndDlg, IDC_LEVELDESCR, TranslateTS(szLogLevelDescr[4-SendDlgItemMessage(hwndDlg, IDC_LOGLEVEL, TBM_GETPOS, 0, 0)])); + SendDlgItemMessage(hwndDlg, IDC_LOGLEVEL, TBM_SETPOS, TRUE, 4 - ppro->getByte("ShowLogLevel", LOG_WARNING)); + SetDlgItemText(hwndDlg, IDC_LEVELDESCR, TranslateTS(szLogLevelDescr[4 - SendDlgItemMessage(hwndDlg, IDC_LOGLEVEL, TBM_GETPOS, 0, 0)])); ShowDlgItem(hwndDlg, IDC_RECONNECTREQD, SW_HIDE); LoadDBCheckState(ppro, hwndDlg, IDC_NOERRMULTI, "IgnoreMultiErrorBox", 0); } return TRUE; case WM_HSCROLL: - SetDlgItemText(hwndDlg, IDC_LEVELDESCR, TranslateTS(szLogLevelDescr[4-SendDlgItemMessage(hwndDlg, IDC_LOGLEVEL,TBM_GETPOS, 0, 0)])); + SetDlgItemText(hwndDlg, IDC_LEVELDESCR, TranslateTS(szLogLevelDescr[4 - SendDlgItemMessage(hwndDlg, IDC_LOGLEVEL, TBM_GETPOS, 0, 0)])); OptDlgChanged(hwndDlg); break; @@ -136,9 +136,8 @@ static INT_PTR CALLBACK DlgProcIcqOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP ShowDlgItem(hwndDlg, IDC_RECONNECTREQD, SW_SHOW); } - if ((LOWORD(wParam)==IDC_ICQNUM || LOWORD(wParam)==IDC_PASSWORD || LOWORD(wParam)==IDC_ICQSERVER || LOWORD(wParam)==IDC_ICQPORT) && - (HIWORD(wParam)!=EN_CHANGE || (HWND)lParam!=GetFocus())) - { + if ((LOWORD(wParam) == IDC_ICQNUM || LOWORD(wParam) == IDC_PASSWORD || LOWORD(wParam) == IDC_ICQSERVER || LOWORD(wParam) == IDC_ICQPORT) && + (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())) { return 0; } @@ -159,7 +158,7 @@ static INT_PTR CALLBACK DlgProcIcqOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP else ppro->m_bRememberPwd = ppro->getByte("RememberPass", 0); ppro->setString("Password", str); - GetDlgItemTextA(hwndDlg,IDC_ICQSERVER, str, sizeof(str)); + GetDlgItemTextA(hwndDlg, IDC_ICQSERVER, str, sizeof(str)); ppro->setString("OscarServer", str); ppro->setWord("OscarPort", (WORD)GetDlgItemInt(hwndDlg, IDC_ICQPORT, NULL, FALSE)); @@ -169,7 +168,7 @@ static INT_PTR CALLBACK DlgProcIcqOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP StoreDBCheckState(ppro, hwndDlg, IDC_MD5LOGIN, "SecureLogin"); StoreDBCheckState(ppro, hwndDlg, IDC_LEGACY, "LegacyFix"); StoreDBCheckState(ppro, hwndDlg, IDC_NOERRMULTI, "IgnoreMultiErrorBox"); - ppro->setByte("ShowLogLevel", (BYTE)(4-SendDlgItemMessage(hwndDlg, IDC_LOGLEVEL, TBM_GETPOS, 0, 0))); + ppro->setByte("ShowLogLevel", (BYTE)(4 - SendDlgItemMessage(hwndDlg, IDC_LOGLEVEL, TBM_GETPOS, 0, 0))); return TRUE; } break; @@ -199,13 +198,11 @@ static INT_PTR CALLBACK DlgProcIcqPrivacyOpts(HWND hwndDlg, UINT msg, WPARAM wPa int nDcType = ppro->getByte("DCType", 0); int nAddAuth = ppro->getByte("Auth", 1); - if (!ppro->icqOnline()) - { + if (!ppro->icqOnline()) { icq_EnableMultipleControls(hwndDlg, icqPrivacyControls, SIZEOF(icqPrivacyControls), FALSE); ShowDlgItem(hwndDlg, IDC_STATIC_NOTONLINE, SW_SHOW); } - else - ShowDlgItem(hwndDlg, IDC_STATIC_NOTONLINE, SW_HIDE); + else ShowDlgItem(hwndDlg, IDC_STATIC_NOTONLINE, SW_HIDE); CheckDlgButton(hwndDlg, IDC_DCALLOW_ANY, (nDcType == 0)); CheckDlgButton(hwndDlg, IDC_DCALLOW_CLIST, (nDcType == 1)); @@ -234,13 +231,11 @@ 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); } @@ -266,10 +261,9 @@ static INT_PTR CALLBACK DlgProcIcqPrivacyOpts(HWND hwndDlg, UINT msg, WPARAM wPa ppro->setByte("DCType", 0); StoreDBCheckState(ppro, hwndDlg, IDC_ADD_AUTH, "Auth"); - if (ppro->icqOnline()) - { - PBYTE buf=NULL; - int buflen=0; + if (ppro->icqOnline()) { + PBYTE buf = NULL; + int buflen = 0; ppackTLVWord(&buf, &buflen, 0x19A, !ppro->getByte("Auth", 1)); ppackTLVByte(&buf, &buflen, 0x212, ppro->getByte("WebAware", 0)); @@ -283,14 +277,12 @@ static INT_PTR CALLBACK DlgProcIcqPrivacyOpts(HWND hwndDlg, UINT msg, WPARAM wPa { WORD wStatus = MirandaStatusToIcq(ppro->m_iStatus); - if (ppro->m_iStatus == ID_STATUS_INVISIBLE) - { + if (ppro->m_iStatus == ID_STATUS_INVISIBLE) { if (ppro->m_bSsiEnabled) ppro->updateServVisibilityCode(3); ppro->icq_setstatus(wStatus, NULL); } - else - { + else { ppro->icq_setstatus(wStatus, NULL); if (ppro->m_bSsiEnabled) ppro->updateServVisibilityCode(4); @@ -315,22 +307,22 @@ struct CPTABLE { }; struct CPTABLE cpTable[] = { - { 874, LPGEN("Thai") }, - { 932, LPGEN("Japanese") }, - { 936, LPGEN("Simplified Chinese") }, - { 949, LPGEN("Korean") }, - { 950, LPGEN("Traditional Chinese") }, - { 1250, LPGEN("Central European") }, - { 1251, LPGEN("Cyrillic") }, - { 1252, LPGEN("Latin I") }, - { 1253, LPGEN("Greek") }, - { 1254, LPGEN("Turkish") }, - { 1255, LPGEN("Hebrew") }, - { 1256, LPGEN("Arabic") }, - { 1257, LPGEN("Baltic") }, - { 1258, LPGEN("Vietnamese") }, - { 1361, LPGEN("Korean (Johab)") }, - { -1, NULL} + { 874, LPGEN("Thai") }, + { 932, LPGEN("Japanese") }, + { 936, LPGEN("Simplified Chinese") }, + { 949, LPGEN("Korean") }, + { 950, LPGEN("Traditional Chinese") }, + { 1250, LPGEN("Central European") }, + { 1251, LPGEN("Cyrillic") }, + { 1252, LPGEN("Latin I") }, + { 1253, LPGEN("Greek") }, + { 1254, LPGEN("Turkish") }, + { 1255, LPGEN("Hebrew") }, + { 1256, LPGEN("Arabic") }, + { 1257, LPGEN("Baltic") }, + { 1258, LPGEN("Vietnamese") }, + { 1361, LPGEN("Korean (Johab)") }, + { -1, NULL } }; static BOOL CALLBACK FillCpCombo(LPSTR str) @@ -339,7 +331,7 @@ static BOOL CALLBACK FillCpCombo(LPSTR str) UINT cp; cp = atoi(str); - for (i=0; cpTable[i].cpName != NULL && cpTable[i].cpId!=cp; i++); + for (i = 0; cpTable[i].cpName != NULL && cpTable[i].cpId != cp; i++); if (cpTable[i].cpName) ComboBoxAddStringUtf(hCpCombo, cpTable[i].cpName, cpTable[i].cpId); @@ -348,34 +340,34 @@ static BOOL CALLBACK FillCpCombo(LPSTR str) ///////////////////////////////////////////////////////////////////////////////////////// -static const UINT icqUnicodeControls[] = {IDC_UTFALL,IDC_UTFSTATIC,IDC_UTFCODEPAGE}; -static const UINT icqDCMsgControls[] = {IDC_DCPASSIVE}; -static const UINT icqXStatusControls[] = {IDC_XSTATUSAUTO}; -static const UINT icqCustomStatusControls[] = {IDC_XSTATUSRESET}; -static const UINT icqAimControls[] = {IDC_AIMENABLE}; +static const UINT icqUnicodeControls[] = { IDC_UTFALL, IDC_UTFSTATIC, IDC_UTFCODEPAGE }; +static const UINT icqDCMsgControls[] = { IDC_DCPASSIVE }; +static const UINT icqXStatusControls[] = { IDC_XSTATUSAUTO }; +static const UINT icqCustomStatusControls[] = { IDC_XSTATUSRESET }; +static const UINT icqAimControls[] = { IDC_AIMENABLE }; static INT_PTR CALLBACK DlgProcIcqFeaturesOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { - CIcqProto* ppro = (CIcqProto*)GetWindowLongPtr( hwndDlg, GWLP_USERDATA ); + CIcqProto* ppro = (CIcqProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); ppro = (CIcqProto*)lParam; - SetWindowLongPtr( hwndDlg, GWLP_USERDATA, lParam ); + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam); { BYTE byData = ppro->getByte("UtfEnabled", DEFAULT_UTF_ENABLED); - CheckDlgButton(hwndDlg, IDC_UTFENABLE, byData?TRUE:FALSE); - CheckDlgButton(hwndDlg, IDC_UTFALL, byData==2?TRUE:FALSE); - icq_EnableMultipleControls(hwndDlg, icqUnicodeControls, SIZEOF(icqUnicodeControls), byData?TRUE:FALSE); - LoadDBCheckState(ppro, hwndDlg, IDC_TEMPVISIBLE, "TempVisListEnabled",DEFAULT_TEMPVIS_ENABLED); + CheckDlgButton(hwndDlg, IDC_UTFENABLE, byData ? TRUE : FALSE); + CheckDlgButton(hwndDlg, IDC_UTFALL, byData == 2 ? TRUE : FALSE); + icq_EnableMultipleControls(hwndDlg, icqUnicodeControls, SIZEOF(icqUnicodeControls), byData ? TRUE : FALSE); + LoadDBCheckState(ppro, hwndDlg, IDC_TEMPVISIBLE, "TempVisListEnabled", DEFAULT_TEMPVIS_ENABLED); LoadDBCheckState(ppro, hwndDlg, IDC_SLOWSEND, "SlowSend", DEFAULT_SLOWSEND); LoadDBCheckState(ppro, hwndDlg, IDC_ONLYSERVERACKS, "OnlyServerAcks", DEFAULT_ONLYSERVERACKS); byData = ppro->getByte("DirectMessaging", DEFAULT_DCMSG_ENABLED); - CheckDlgButton(hwndDlg, IDC_DCENABLE, byData?TRUE:FALSE); - CheckDlgButton(hwndDlg, IDC_DCPASSIVE, byData==1?TRUE:FALSE); - icq_EnableMultipleControls(hwndDlg, icqDCMsgControls, SIZEOF(icqDCMsgControls), byData?TRUE:FALSE); + CheckDlgButton(hwndDlg, IDC_DCENABLE, byData ? TRUE : FALSE); + CheckDlgButton(hwndDlg, IDC_DCPASSIVE, byData == 1 ? TRUE : FALSE); + icq_EnableMultipleControls(hwndDlg, icqDCMsgControls, SIZEOF(icqDCMsgControls), byData ? TRUE : FALSE); BYTE byXStatusEnabled = ppro->getByte("XStatusEnabled", DEFAULT_XSTATUS_ENABLED); CheckDlgButton(hwndDlg, IDC_XSTATUSENABLE, byXStatusEnabled); BYTE byMoodsEnabled = ppro->getByte("MoodsEnabled", DEFAULT_MOODS_ENABLED); @@ -386,20 +378,17 @@ static INT_PTR CALLBACK DlgProcIcqFeaturesOpts(HWND hwndDlg, UINT msg, WPARAM wP LoadDBCheckState(ppro, hwndDlg, IDC_XSTATUSRESET, "XStatusReset", DEFAULT_XSTATUS_RESET); LoadDBCheckState(ppro, hwndDlg, IDC_KILLSPAMBOTS, "KillSpambots", DEFAULT_KILLSPAM_ENABLED); LoadDBCheckState(ppro, hwndDlg, IDC_AIMENABLE, "AimEnabled", DEFAULT_AIM_ENABLED); - icq_EnableMultipleControls(hwndDlg, icqAimControls, SIZEOF(icqAimControls), ppro->icqOnline()?FALSE:TRUE); + icq_EnableMultipleControls(hwndDlg, icqAimControls, SIZEOF(icqAimControls), ppro->icqOnline() ? FALSE : TRUE); hCpCombo = GetDlgItem(hwndDlg, IDC_UTFCODEPAGE); int sCodePage = ppro->getWord("AnsiCodePage", CP_ACP); ComboBoxAddStringUtf(GetDlgItem(hwndDlg, IDC_UTFCODEPAGE), LPGEN("System default codepage"), 0); EnumSystemCodePagesA(FillCpCombo, CP_INSTALLED); - if(sCodePage == 0) + if (sCodePage == 0) SendDlgItemMessage(hwndDlg, IDC_UTFCODEPAGE, CB_SETCURSEL, 0, 0); - else - { - 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) - { + else { + 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) { SendDlgItemMessage(hwndDlg, IDC_UTFCODEPAGE, CB_SETCURSEL, (WPARAM)i, 0); break; } @@ -415,7 +404,7 @@ static INT_PTR CALLBACK DlgProcIcqFeaturesOpts(HWND hwndDlg, UINT msg, WPARAM wP OptDlgChanged(hwndDlg); break; case IDC_UTFCODEPAGE: - if(HIWORD(wParam)==CBN_SELCHANGE) + if (HIWORD(wParam) == CBN_SELCHANGE) OptDlgChanged(hwndDlg); break; case IDC_DCENABLE: @@ -425,7 +414,7 @@ static INT_PTR CALLBACK DlgProcIcqFeaturesOpts(HWND hwndDlg, UINT msg, WPARAM wP 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)); + icq_EnableMultipleControls(hwndDlg, icqCustomStatusControls, SIZEOF(icqCustomStatusControls), IsDlgButtonChecked(hwndDlg, IDC_XSTATUSENABLE) || IsDlgButtonChecked(hwndDlg, IDC_MOODSENABLE)); default: OptDlgChanged(hwndDlg); break; @@ -436,7 +425,7 @@ static INT_PTR CALLBACK DlgProcIcqFeaturesOpts(HWND hwndDlg, UINT msg, WPARAM wP switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: if (IsDlgButtonChecked(hwndDlg, IDC_UTFENABLE)) - ppro->m_bUtfEnabled = IsDlgButtonChecked(hwndDlg, IDC_UTFALL)?2:1; + ppro->m_bUtfEnabled = IsDlgButtonChecked(hwndDlg, IDC_UTFALL) ? 2 : 1; else ppro->m_bUtfEnabled = 0; { @@ -450,7 +439,7 @@ static INT_PTR CALLBACK DlgProcIcqFeaturesOpts(HWND hwndDlg, UINT msg, WPARAM wP StoreDBCheckState(ppro, hwndDlg, IDC_SLOWSEND, "SlowSend"); StoreDBCheckState(ppro, hwndDlg, IDC_ONLYSERVERACKS, "OnlyServerAcks"); if (IsDlgButtonChecked(hwndDlg, IDC_DCENABLE)) - ppro->m_bDCMsgEnabled = IsDlgButtonChecked(hwndDlg, IDC_DCPASSIVE)?1:2; + ppro->m_bDCMsgEnabled = IsDlgButtonChecked(hwndDlg, IDC_DCPASSIVE) ? 1 : 2; else ppro->m_bDCMsgEnabled = 0; ppro->setByte("DirectMessaging", ppro->m_bDCMsgEnabled); @@ -460,7 +449,7 @@ static INT_PTR CALLBACK DlgProcIcqFeaturesOpts(HWND hwndDlg, UINT msg, WPARAM wP ppro->setByte("MoodsEnabled", ppro->m_bMoodsEnabled); StoreDBCheckState(ppro, hwndDlg, IDC_XSTATUSAUTO, "XStatusAuto"); StoreDBCheckState(ppro, hwndDlg, IDC_XSTATUSRESET, "XStatusReset"); - StoreDBCheckState(ppro, hwndDlg, IDC_KILLSPAMBOTS , "KillSpambots"); + StoreDBCheckState(ppro, hwndDlg, IDC_KILLSPAMBOTS, "KillSpambots"); StoreDBCheckState(ppro, hwndDlg, IDC_AIMENABLE, "AimEnabled"); return TRUE; } @@ -469,19 +458,19 @@ static INT_PTR CALLBACK DlgProcIcqFeaturesOpts(HWND hwndDlg, UINT msg, WPARAM wP return FALSE; } -static const UINT icqContactsControls[] = {IDC_ADDSERVER,IDC_LOADFROMSERVER,IDC_SAVETOSERVER,IDC_UPLOADNOW}; -static const UINT icqAvatarControls[] = {IDC_AUTOLOADAVATARS,IDC_STRICTAVATARCHECK}; +static const UINT icqContactsControls[] = { IDC_ADDSERVER, IDC_LOADFROMSERVER, IDC_SAVETOSERVER, IDC_UPLOADNOW }; +static const UINT icqAvatarControls[] = { IDC_AUTOLOADAVATARS, IDC_STRICTAVATARCHECK }; static INT_PTR CALLBACK DlgProcIcqContactsOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { - CIcqProto* ppro = (CIcqProto*)GetWindowLongPtr( hwndDlg, GWLP_USERDATA ); + CIcqProto* ppro = (CIcqProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); ppro = (CIcqProto*)lParam; - SetWindowLongPtr( hwndDlg, GWLP_USERDATA, lParam ); + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam); LoadDBCheckState(ppro, hwndDlg, IDC_ENABLE, "UseServerCList", DEFAULT_SS_ENABLED); LoadDBCheckState(ppro, hwndDlg, IDC_ADDSERVER, "ServerAddRemove", DEFAULT_SS_ADDSERVER); @@ -491,11 +480,10 @@ 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), ppro->getByte("UseServerCList", DEFAULT_SS_ENABLED)?TRUE:FALSE); - icq_EnableMultipleControls(hwndDlg, icqAvatarControls, SIZEOF(icqAvatarControls), ppro->getByte("AvatarsEnabled", DEFAULT_AVATARS_ENABLED)?TRUE:FALSE); + icq_EnableMultipleControls(hwndDlg, icqContactsControls, SIZEOF(icqContactsControls), ppro->getByte("UseServerCList", DEFAULT_SS_ENABLED) ? TRUE : FALSE); + icq_EnableMultipleControls(hwndDlg, icqAvatarControls, SIZEOF(icqAvatarControls), ppro->getByte("AvatarsEnabled", DEFAULT_AVATARS_ENABLED) ? TRUE : FALSE); - if (ppro->icqOnline()) - { + if (ppro->icqOnline()) { ShowDlgItem(hwndDlg, IDC_OFFLINETOENABLE, SW_SHOW); EnableDlgItem(hwndDlg, IDC_ENABLE, FALSE); EnableDlgItem(hwndDlg, IDC_ENABLEAVATARS, FALSE); @@ -525,8 +513,7 @@ static INT_PTR CALLBACK DlgProcIcqContactsOpts(HWND hwndDlg, UINT msg, WPARAM wP break; case WM_NOTIFY: - if (((LPNMHDR)lParam)->code == PSN_APPLY ) - { + if (((LPNMHDR)lParam)->code == PSN_APPLY) { StoreDBCheckState(ppro, hwndDlg, IDC_ENABLE, "UseServerCList"); StoreDBCheckState(ppro, hwndDlg, IDC_ADDSERVER, "ServerAddRemove"); StoreDBCheckState(ppro, hwndDlg, IDC_LOADFROMSERVER, "LoadServerDetails"); diff --git a/protocols/IcqOscarJ/src/icqoscar.h b/protocols/IcqOscarJ/src/icqoscar.h index 059f016a20..eb64c0ab2c 100644 --- a/protocols/IcqOscarJ/src/icqoscar.h +++ b/protocols/IcqOscarJ/src/icqoscar.h @@ -84,6 +84,7 @@ #include #include #include +#include #include // Project resources diff --git a/protocols/IcqOscarJ/src/init.cpp b/protocols/IcqOscarJ/src/init.cpp index 938d7ab41b..1aa4c37c28 100644 --- a/protocols/IcqOscarJ/src/init.cpp +++ b/protocols/IcqOscarJ/src/init.cpp @@ -34,10 +34,12 @@ HINSTANCE hInst; int hLangpack; +TIME_API tmi; CLIST_INTERFACE *pcli; + BOOL bPopupService = FALSE; -HANDLE hExtraXStatus; +HANDLE hExtraXStatus; PLUGININFOEX pluginInfo = { sizeof(PLUGININFOEX), @@ -49,7 +51,7 @@ PLUGININFOEX pluginInfo = { __COPYRIGHT, __AUTHORWEB, UNICODE_AWARE, //doesn't replace anything built-in - {0x73a9615c, 0x7d4e, 0x4555, {0xba, 0xdb, 0xee, 0x5, 0xdc, 0x92, 0x8e, 0xff}} // {73A9615C-7D4E-4555-BADB-EE05DC928EFF} + { 0x73a9615c, 0x7d4e, 0x4555, { 0xba, 0xdb, 0xee, 0x5, 0xdc, 0x92, 0x8e, 0xff } } // {73A9615C-7D4E-4555-BADB-EE05DC928EFF} }; extern "C" PLUGININFOEX __declspec(dllexport) *MirandaPluginInfoEx(DWORD mirandaVersion) @@ -57,9 +59,9 @@ extern "C" PLUGININFOEX __declspec(dllexport) *MirandaPluginInfoEx(DWORD miranda return &pluginInfo; } -extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_PROTOCOL, MIID_LAST}; +extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST }; -extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved) +extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { hInst = hinstDLL; return TRUE; @@ -67,17 +69,17 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvRese ///////////////////////////////////////////////////////////////////////////////////////// -static PROTO_INTERFACE* icqProtoInit( const char* pszProtoName, const TCHAR* tszUserName ) +static PROTO_INTERFACE* icqProtoInit(const char* pszProtoName, const TCHAR* tszUserName) { CIcqProto *ppro = new CIcqProto(pszProtoName, tszUserName); g_Instances.insert(ppro); return ppro; } -static int icqProtoUninit( PROTO_INTERFACE* ppro ) +static int icqProtoUninit(PROTO_INTERFACE* ppro) { - g_Instances.remove(( CIcqProto* )ppro); - delete ( CIcqProto* )ppro; + g_Instances.remove((CIcqProto*)ppro); + delete (CIcqProto*)ppro; return 0; } @@ -89,17 +91,18 @@ int ModuleLoad(WPARAM wParam, LPARAM lParam) extern "C" int __declspec(dllexport) Load(void) { - mir_getLP( &pluginInfo ); + mir_getLP(&pluginInfo); mir_getCLI(); + mir_getTMI(&tmi); srand(time(NULL)); _tzset(); // Register the module PROTOCOLDESCRIPTOR pd = { sizeof(pd) }; - pd.szName = ICQ_PROTOCOL_NAME; - pd.type = PROTOTYPE_PROTOCOL; - pd.fnInit = icqProtoInit; + pd.szName = ICQ_PROTOCOL_NAME; + pd.type = PROTOTYPE_PROTOCOL; + pd.fnInit = icqProtoInit; pd.fnUninit = icqProtoUninit; CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd); @@ -122,7 +125,6 @@ extern "C" int __declspec(dllexport) Load(void) return 0; } - extern "C" int __declspec(dllexport) Unload(void) { // destroying contact menu diff --git a/protocols/IcqOscarJ/src/utilities.cpp b/protocols/IcqOscarJ/src/utilities.cpp index 521a64f4fe..29e88eb9e2 100644 --- a/protocols/IcqOscarJ/src/utilities.cpp +++ b/protocols/IcqOscarJ/src/utilities.cpp @@ -122,47 +122,47 @@ WORD MirandaStatusToIcq(int nMirandaStatus) WORD nIcqStatus; switch (nMirandaStatus) { -case ID_STATUS_ONLINE: - nIcqStatus = ICQ_STATUS_ONLINE; - break; - -case ID_STATUS_AWAY: - nIcqStatus = ICQ_STATUS_AWAY; - break; - -case ID_STATUS_OUTTOLUNCH: -case ID_STATUS_NA: - nIcqStatus = ICQ_STATUS_NA; - break; - -case ID_STATUS_ONTHEPHONE: -case ID_STATUS_OCCUPIED: - nIcqStatus = ICQ_STATUS_OCCUPIED; - break; - -case ID_STATUS_DND: - nIcqStatus = ICQ_STATUS_DND; - break; - -case ID_STATUS_INVISIBLE: - nIcqStatus = ICQ_STATUS_INVISIBLE; - break; - -case ID_STATUS_FREECHAT: - nIcqStatus = ICQ_STATUS_FFC; - break; - -case ID_STATUS_OFFLINE: - // Oscar doesnt have anything that maps to this status. This should never happen. - _ASSERTE(nMirandaStatus != ID_STATUS_OFFLINE); - nIcqStatus = 0; - break; - -default: - // Online seems to be a good default. - // Since it cant be offline, it must be a new type of online status. - nIcqStatus = ICQ_STATUS_ONLINE; - break; + case ID_STATUS_ONLINE: + nIcqStatus = ICQ_STATUS_ONLINE; + break; + + case ID_STATUS_AWAY: + nIcqStatus = ICQ_STATUS_AWAY; + break; + + case ID_STATUS_OUTTOLUNCH: + case ID_STATUS_NA: + nIcqStatus = ICQ_STATUS_NA; + break; + + case ID_STATUS_ONTHEPHONE: + case ID_STATUS_OCCUPIED: + nIcqStatus = ICQ_STATUS_OCCUPIED; + break; + + case ID_STATUS_DND: + nIcqStatus = ICQ_STATUS_DND; + break; + + case ID_STATUS_INVISIBLE: + nIcqStatus = ICQ_STATUS_INVISIBLE; + break; + + case ID_STATUS_FREECHAT: + nIcqStatus = ICQ_STATUS_FFC; + break; + + case ID_STATUS_OFFLINE: + // Oscar doesnt have anything that maps to this status. This should never happen. + _ASSERTE(nMirandaStatus != ID_STATUS_OFFLINE); + nIcqStatus = 0; + break; + + default: + // Online seems to be a good default. + // Since it cant be offline, it must be a new type of online status. + nIcqStatus = ICQ_STATUS_ONLINE; + break; } return nIcqStatus; @@ -175,36 +175,36 @@ int MirandaStatusToSupported(int nMirandaStatus) switch (nMirandaStatus) { // These status mode does not need any mapping -case ID_STATUS_ONLINE: -case ID_STATUS_AWAY: -case ID_STATUS_NA: -case ID_STATUS_OCCUPIED: -case ID_STATUS_DND: -case ID_STATUS_INVISIBLE: -case ID_STATUS_OFFLINE: - nSupportedStatus = nMirandaStatus; - break; - -case ID_STATUS_FREECHAT: - nSupportedStatus = ID_STATUS_ONLINE; - break; - - // This mode is not support and must be mapped to something else -case ID_STATUS_OUTTOLUNCH: - nSupportedStatus = ID_STATUS_NA; - break; - - // This mode is not support and must be mapped to something else -case ID_STATUS_ONTHEPHONE: - nSupportedStatus = ID_STATUS_OCCUPIED; - break; - - // This is not supposed to happen. -default: - _ASSERTE(0); - // Online seems to be a good default. - nSupportedStatus = ID_STATUS_ONLINE; - break; + case ID_STATUS_ONLINE: + case ID_STATUS_AWAY: + case ID_STATUS_NA: + case ID_STATUS_OCCUPIED: + case ID_STATUS_DND: + case ID_STATUS_INVISIBLE: + case ID_STATUS_OFFLINE: + nSupportedStatus = nMirandaStatus; + break; + + case ID_STATUS_FREECHAT: + nSupportedStatus = ID_STATUS_ONLINE; + break; + + // This mode is not support and must be mapped to something else + case ID_STATUS_OUTTOLUNCH: + nSupportedStatus = ID_STATUS_NA; + break; + + // This mode is not support and must be mapped to something else + case ID_STATUS_ONTHEPHONE: + nSupportedStatus = ID_STATUS_OCCUPIED; + break; + + // This is not supposed to happen. + default: + _ASSERTE(0); + // Online seems to be a good default. + nSupportedStatus = ID_STATUS_ONLINE; + break; } return nSupportedStatus; @@ -212,7 +212,7 @@ default: char* MirandaStatusToStringUtf(int mirandaStatus) { // return miranda status description in utf-8, use unicode service is possible - return tchar_to_utf8( pcli->pfnGetStatusModeDescription(mirandaStatus, 0)); + return tchar_to_utf8(pcli->pfnGetStatusModeDescription(mirandaStatus, 0)); } char** CIcqProto::MirandaStatusToAwayMsg(int nStatus) diff --git a/protocols/IcqOscarJ/src/version.h b/protocols/IcqOscarJ/src/version.h index 7038a62cee..315857efd6 100644 --- a/protocols/IcqOscarJ/src/version.h +++ b/protocols/IcqOscarJ/src/version.h @@ -1,6 +1,6 @@ #define __MAJOR_VERSION 0 #define __MINOR_VERSION 11 -#define __RELEASE_NUM 1 +#define __RELEASE_NUM 2 #define __BUILD_NUM 0 #include -- cgit v1.2.3