diff options
Diffstat (limited to 'icqj_mod/changeinfo')
-rw-r--r-- | icqj_mod/changeinfo/changeinfo.h | 116 | ||||
-rw-r--r-- | icqj_mod/changeinfo/constants.c | 658 | ||||
-rw-r--r-- | icqj_mod/changeinfo/db.c | 226 | ||||
-rw-r--r-- | icqj_mod/changeinfo/dlgproc.c | 560 | ||||
-rw-r--r-- | icqj_mod/changeinfo/editlist.c | 173 | ||||
-rw-r--r-- | icqj_mod/changeinfo/editstring.c | 362 | ||||
-rw-r--r-- | icqj_mod/changeinfo/expandst.ico | bin | 0 -> 318 bytes | |||
-rw-r--r-- | icqj_mod/changeinfo/main.c | 54 | ||||
-rw-r--r-- | icqj_mod/changeinfo/upload.c | 204 |
9 files changed, 2353 insertions, 0 deletions
diff --git a/icqj_mod/changeinfo/changeinfo.h b/icqj_mod/changeinfo/changeinfo.h new file mode 100644 index 0000000..37398a5 --- /dev/null +++ b/icqj_mod/changeinfo/changeinfo.h @@ -0,0 +1,116 @@ +// ---------------------------------------------------------------------------80
+// ICQ plugin for Miranda Instant Messenger
+// ________________________________________
+//
+// Copyright 2001,2002,2003,2004 Richard Hughes, Martin berg
+// Copyright 2004,2005,2006 Joe Kucera, Bio
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+// -----------------------------------------------------------------------------
+//
+// File name : $Source: /cvsroot/miranda/miranda/protocols/IcqOscarJ/changeinfo/changeinfo.h,v $
+// Revision : $Revision: 2991 $
+// Last change on : $Date: 2006-05-30 21:55:48 +0400 $
+// Last change by : $Author: jokusoftware $
+//
+// DESCRIPTION:
+//
+// ChangeInfo Plugin stuff
+//
+// -----------------------------------------------------------------------------
+
+
+#ifndef __CHANGEINFO_H
+#define __CHANGEINFO_H
+
+
+#ifndef AW_SLIDE
+#define SPI_GETCOMBOBOXANIMATION 0x1004
+#define AW_SLIDE 0x40000
+#define AW_ACTIVATE 0x20000
+#define AW_VER_POSITIVE 0x4
+#define UDM_SETPOS32 (WM_USER+113)
+#define UDM_GETPOS32 (WM_USER+114)
+#endif
+
+
+#define LI_DIVIDER 0
+#define LI_STRING 1
+#define LI_LIST 2
+#define LI_LONGSTRING 3
+#define LI_NUMBER 4
+#define LIM_TYPE 0x0000FFFF
+#define LIF_ZEROISVALID 0x80000000
+#define LIF_SIGNED 0x40000000
+#define LIF_PASSWORD 0x20000000
+#define LIF_CHANGEONLY 0x10000000
+
+char Password[10];
+HANDLE hUpload[2];
+HWND hwndList;
+HFONT hListFont;
+int iEditItem;
+
+typedef struct {
+ char *szDescription;
+ unsigned displayType; //LI_ constant
+ int dbType; //DBVT_ constant
+ char *szDbSetting;
+ void *pList;
+ int listCount;
+ LPARAM value;
+ int changed;
+} SettingItem;
+
+typedef struct {
+ int id;
+ char *szValue;
+} ListTypeDataItem;
+
+// contants.c
+extern SettingItem setting[];
+extern const int settingCount;
+
+//main.c
+int InitChangeDetails(WPARAM wParam,LPARAM lParam);
+
+//dlgproc.c
+BOOL CALLBACK ChangeInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
+
+//db.c
+void LoadSettingsFromDb(int keepChanged);
+void FreeStoredDbSettings(void);
+void ClearChangeFlags(void);
+int ChangesMade(void);
+int SaveSettingsToDb(HWND hwndDlg);
+
+//editstring.c
+void BeginStringEdit(int iItem,RECT *rc,int i,WORD wVKey);
+void EndStringEdit(int save);
+int IsStringEditWindow(HWND hwnd);
+char *BinaryToEscapes(char *str);
+
+//editlist.c
+void BeginListEdit(int iItem,RECT *rc,int i,WORD wVKey);
+void EndListEdit(int save);
+int IsListEditWindow(HWND hwnd);
+
+//upload.c
+int StringToListItemId(const char *szSetting,int def);
+int UploadSettings(HWND hwndParent);
+
+
+#endif /* __CHANGEINFO_H */
diff --git a/icqj_mod/changeinfo/constants.c b/icqj_mod/changeinfo/constants.c new file mode 100644 index 0000000..990f3ab --- /dev/null +++ b/icqj_mod/changeinfo/constants.c @@ -0,0 +1,658 @@ +// ---------------------------------------------------------------------------80
+// ICQ plugin for Miranda Instant Messenger
+// ________________________________________
+//
+// Copyright 2001,2002,2003,2004 Richard Hughes, Martin berg
+// Copyright 2004,2005,2006 Joe Kucera, Bio
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+// -----------------------------------------------------------------------------
+//
+// File name : $Source: /cvsroot/miranda/miranda/protocols/IcqOscarJ/changeinfo/constants.c,v $
+// Revision : $Revision: 3292 $
+// Last change on : $Date: 2006-07-09 17:27:51 +0400 (Вс, 09 июл 2006) $
+// Last change by : $Author: ghazan $
+//
+// DESCRIPTION:
+//
+// ChangeInfo Plugin stuff
+//
+// -----------------------------------------------------------------------------
+
+#include "icqoscar.h"
+
+static ListTypeDataItem countries[]={
+ {0 ,"Unspecified"},
+ {9999,"Other"},
+ {93 ,"Afghanistan"},
+ {355 ,"Albania"},
+ {213 ,"Algeria"},
+ {684 ,"American Samoa"},
+ {376 ,"Andorra"},
+ {244 ,"Angola"},
+ {101 ,"Anguilla"},
+ {102 ,"Antigua and Barbuda"},
+ {5902,"Antilles"},
+ {54 ,"Argentina"},
+ {374 ,"Armenia"},
+ {297 ,"Aruba"},
+ {247 ,"Ascension Island"},
+ {61 ,"Australia"},
+ {43 ,"Austria"},
+ {994 ,"Azerbaijan"},
+ {103 ,"Bahamas"},
+ {973 ,"Bahrain"},
+ {880 ,"Bangladesh"},
+ {104 ,"Barbados"},
+ {120 ,"Barbuda"},
+ {375 ,"Belarus"},
+ {32 ,"Belgium"},
+ {501 ,"Belize"},
+ {229 ,"Benin"},
+ {105 ,"Bermuda"},
+ {975 ,"Bhutan"},
+ {591 ,"Bolivia"},
+ {387 ,"Bosnia and Herzegovina"},
+ {267 ,"Botswana"},
+ {55 ,"Brazil"},
+ {106 ,"British Virgin Islands"},
+ {673 ,"Brunei"},
+ {359 ,"Bulgaria"},
+ {226 ,"Burkina Faso"},
+ {257 ,"Burundi"},
+ {855 ,"Cambodia"},
+ {237 ,"Cameroon"},
+ {107 ,"Canada"},
+ {178 ,"Canary Islands"},
+ {238 ,"Cape Verde Islands"},
+ {108 ,"Cayman Islands"},
+ {236 ,"Central African Republic"},
+ {235 ,"Chad"},
+ {56 ,"Chile, Republic of"},
+ {86 ,"China"},
+ {672 ,"Christmas Island"},
+ {6101,"Cocos-Keeling Islands"},
+ {6102,"Cocos (Keeling) Islands"},
+ {57 ,"Colombia"},
+ {2691,"Comoros"},
+ {243 ,"Congo, Democratic Republic of (Zaire)"},
+ {242 ,"Congo, Republic of the"},
+ {682 ,"Cook Islands"},
+ {506 ,"Costa Rica"},
+ {225 ,"Cote d'Ivoire (Ivory Coast)"},
+ {385 ,"Croatia"},
+ {53 ,"Cuba"},
+ {357 ,"Cyprus"},
+ {420 ,"Czech Republic"},
+ {45 ,"Denmark"},
+ {246 ,"Diego Garcia"},
+ {253 ,"Djibouti"},
+ {109 ,"Dominica"},
+ {110 ,"Dominican Republic"},
+ {593 ,"Ecuador"},
+ {20 ,"Egypt"},
+ {503 ,"El Salvador"},
+ {240 ,"Equatorial Guinea"},
+ {291 ,"Eritrea"},
+ {372 ,"Estonia"},
+ {251 ,"Ethiopia"},
+ {298 ,"Faeroe Islands"},
+ {500 ,"Falkland Islands"},
+ {679 ,"Fiji"},
+ {358 ,"Finland"},
+ {33 ,"France"},
+ {5901,"French Antilles"},
+ {594 ,"French Guiana"},
+ {689 ,"French Polynesia"},
+ {241 ,"Gabon"},
+ {220 ,"Gambia"},
+ {995 ,"Georgia"},
+ {49 ,"Germany"},
+ {233 ,"Ghana"},
+ {350 ,"Gibraltar"},
+ {30 ,"Greece"},
+ {299 ,"Greenland"},
+ {111 ,"Grenada"},
+ {590 ,"Guadeloupe"},
+ {671 ,"Guam, US Territory of"},
+ {502 ,"Guatemala"},
+ {224 ,"Guinea"},
+ {245 ,"Guinea-Bissau"},
+ {592 ,"Guyana"},
+ {509 ,"Haiti"},
+ {504 ,"Honduras"},
+ {852 ,"Hong Kong"},
+ {36 ,"Hungary"},
+ {354 ,"Iceland"},
+ {91 ,"India"},
+ {62 ,"Indonesia"},
+ {98 ,"Iran (Islamic Republic of)"},
+ {964 ,"Iraq"},
+ {353 ,"Ireland"},
+ {972 ,"Israel"},
+ {39 ,"Italy"},
+ {112 ,"Jamaica"},
+ {81 ,"Japan"},
+ {962 ,"Jordan"},
+ {705 ,"Kazakhstan"},
+ {254 ,"Kenya"},
+ {686 ,"Kiribati"},
+ {850 ,"Korea, North"},
+ {82 ,"Korea, South"},
+ {965 ,"Kuwait"},
+ {706 ,"Kyrgyzstan"},
+ {856 ,"Laos"},
+ {371 ,"Latvia"},
+ {961 ,"Lebanon"},
+ {266 ,"Lesotho"},
+ {231 ,"Liberia"},
+ {218 ,"Libyan Arab Jamahiriya"},
+ {4101,"Liechtenstein"},
+ {370 ,"Lithuania"},
+ {352 ,"Luxembourg"},
+ {853 ,"Macau"},
+ {389 ,"Macedonia (F.Y.R.O.M.)"},
+ {261 ,"Madagascar"},
+ {265 ,"Malawi"},
+ {60 ,"Malaysia"},
+ {960 ,"Maldives"},
+ {223 ,"Mali"},
+ {356 ,"Malta"},
+ {692 ,"Marshall Islands"},
+ {596 ,"Martinique"},
+ {222 ,"Mauritania"},
+ {230 ,"Mauritius"},
+ {269 ,"Mayotte Island"},
+ {52 ,"Mexico"},
+ {691 ,"Micronesia, Federated States of"},
+ {373 ,"Moldova, Republic of"},
+ {377 ,"Monaco"},
+ {976 ,"Mongolia"},
+ {113 ,"Montserrat"},
+ {212 ,"Morocco"},
+ {258 ,"Mozambique"},
+ {95 ,"Myanmar"},
+ {264 ,"Namibia"},
+ {674 ,"Nauru"},
+ {977 ,"Nepal"},
+ {31 ,"Netherlands"},
+ {599 ,"Netherlands Antilles"},
+ {114 ,"Nevis"},
+ {687 ,"New Caledonia"},
+ {64 ,"New Zealand"},
+ {505 ,"Nicaragua"},
+ {227 ,"Niger"},
+ {234 ,"Nigeria"},
+ {683 ,"Niue"},
+ {6722,"Norfolk Island"},
+ {47 ,"Norway"},
+ {968 ,"Oman"},
+ {92 ,"Pakistan"},
+ {680 ,"Palau"},
+ {507 ,"Panama"},
+ {675 ,"Papua New Guinea"},
+ {595 ,"Paraguay"},
+ {51 ,"Peru"},
+ {63 ,"Philippines"},
+ {48 ,"Poland"},
+ {351 ,"Portugal"},
+ {121 ,"Puerto Rico"},
+ {974 ,"Qatar"},
+ {262 ,"Reunion Island"},
+ {40 ,"Romania"},
+ {6701,"Rota Island"},
+ {7 ,"Russia"},
+ {250 ,"Rwanda"},
+ {290 ,"Saint Helena"},
+ {115 ,"Saint Kitts"},
+ {1141,"Saint Kitts and Nevis"},
+ {122 ,"Saint Lucia"},
+ {508 ,"Saint Pierre and Miquelon"},
+ {116 ,"Saint Vincent and the Grenadines"},
+ {670 ,"Saipan Island"},
+ {378 ,"San Marino"},
+ {239 ,"Sao Tome and Principe"},
+ {966 ,"Saudi Arabia"},
+ {442 ,"Scotland"},
+ {221 ,"Senegal"},
+ {248 ,"Seychelles"},
+ {232 ,"Sierra Leone"},
+ {65 ,"Singapore"},
+ {421 ,"Slovakia"},
+ {386 ,"Slovenia"},
+ {677 ,"Solomon Islands"},
+ {252 ,"Somalia"},
+ {27 ,"South Africa"},
+ {34 ,"Spain"},
+ {94 ,"Sri Lanka"},
+ {249 ,"Sudan"},
+ {597 ,"Suriname"},
+ {268 ,"Swaziland"},
+ {46 ,"Sweden"},
+ {41 ,"Switzerland"},
+ {963 ,"Syrian Arab Republic"},
+ {886 ,"Taiwan"},
+ {708 ,"Tajikistan"},
+ {255 ,"Tanzania"},
+ {66 ,"Thailand"},
+ {6702,"Tinian Island"},
+ {228 ,"Togo"},
+ {690 ,"Tokelau"},
+ {676 ,"Tonga"},
+ {117 ,"Trinidad and Tobago"},
+ {216 ,"Tunisia"},
+ {90 ,"Turkey"},
+ {709 ,"Turkmenistan"},
+ {118 ,"Turks and Caicos Islands"},
+ {688 ,"Tuvalu"},
+ {256 ,"Uganda"},
+ {380 ,"Ukraine"},
+ {971 ,"United Arab Emirates"},
+ {44 ,"United Kingdom"},
+ {598 ,"Uruguay"},
+ {1 ,"USA"},
+ {711 ,"Uzbekistan"},
+ {678 ,"Vanuatu"},
+ {379 ,"Vatican City"},
+ {58 ,"Venezuela"},
+ {84 ,"Vietnam"},
+ {123 ,"Virgin Islands (USA)"},
+ {441 ,"Wales"},
+ {681 ,"Wallis and Futuna Islands"},
+ {685 ,"Western Samoa"},
+ {967 ,"Yemen"},
+ {381 ,"Yugoslavia"},
+ {3811,"Yugoslavia - Serbia"},
+ {382 ,"Yugoslavia - Montenegro"},
+ {260 ,"Zambia"},
+ {263 ,"Zimbabwe"},
+};
+
+static ListTypeDataItem timezones[]={
+ {-100,"Unspecified"},
+ {24 ,"GMT-12:00 Eniwetok; Kwajalein"},
+ {23 ,"GMT-11:30"},
+ {22 ,"GMT-11:00 Midway Island; Samoa"},
+ {21 ,"GMT-10:30"},
+ {20 ,"GMT-10:00 Hawaii"},
+ {19 ,"GMT-9:30"},
+ {18 ,"GMT-9:00 Alaska"},
+ {17 ,"GMT-8:30"},
+ {16 ,"GMT-8:00 Pacific Time; Tijuana"},
+ {15 ,"GMT-7:30"},
+ {14 ,"GMT-7:00 Arizona; Mountain Time"},
+ {13 ,"GMT-6:30"},
+ {12 ,"GMT-6:00 Central Time; Central America; Saskatchewan"},
+ {11 ,"GMT-5:30"},
+ {10 ,"GMT-5:00 Eastern Time; Bogota; Lima; Quito"},
+ {9 ,"GMT-4:30"},
+ {8 ,"GMT-4:00 Atlantic Time; Santiago; Caracas; La Paz"},
+ {7 ,"GMT-3:30 Newfoundland"},
+ {6 ,"GMT-3:00 Greenland; Buenos Aires; Georgetown"},
+ {5 ,"GMT-2:30"},
+ {4 ,"GMT-2:00 Mid-Atlantic"},
+ {3 ,"GMT-1:30"},
+ {2 ,"GMT-1:00 Cape Verde Islands; Azores"},
+ {1 ,"GMT-0:30"},
+ {0 ,"GMT+0:00 London; Dublin; Edinburgh; Lisbon; Casablanca"},
+ {-1 ,"GMT+0:30"},
+ {-2 ,"GMT+1:00 Central European Time; West Central Africa; Warsaw"},
+ {-3 ,"GMT+1:30"},
+ {-4 ,"GMT+2:00 Jerusalem; Helsinki; Harare; Cairo; Bucharest; Athens"},
+ {-5 ,"GMT+2:30"},
+ {-6 ,"GMT+3:00 Moscow; St. Petersburg; Nairobi; Kuwait; Baghdad"},
+ {-7 ,"GMT+3:30 Tehran"},
+ {-8 ,"GMT+4:00 Baku; Tbilisi; Yerevan; Abu Dhabi; Muscat"},
+ {-9 ,"GMT+4:30 Kabul"},
+ {-10 ,"GMT+5:00 Calcutta; Chennai; Mumbai; New Delhi; Ekaterinburg"},
+ {-11 ,"GMT+5:30"},
+ {-12 ,"GMT+6:00 Astana; Dhaka; Almaty; Novosibirsk; Sri Jayawardenepura"},
+ {-13 ,"GMT+6:30 Rangoon"},
+ {-14 ,"GMT+7:00 Bankok; Hanoi; Jakarta; Krasnoyarsk"},
+ {-15 ,"GMT+7:30"},
+ {-16 ,"GMT+8:00 Perth; Taipei; Singapore; Hong Kong; Beijing"},
+ {-17 ,"GMT+8:30"},
+ {-18 ,"GMT+9:00 Tokyo; Osaka; Seoul; Sapporo; Yakutsk"},
+ {-19 ,"GMT+9:30 Darwin; Adelaide"},
+ {-20 ,"GMT+10:00 East Australia; Guam; Vladivostok"},
+ {-21 ,"GMT+10:30"},
+ {-22 ,"GMT+11:00 Magadan; Solomon Is.; New Caledonia"},
+ {-23 ,"GMT+11:30"},
+ {-24 ,"GMT+12:00 Auckland; Wellington; Fiji; Kamchatka; Marshall Is."},
+};
+
+static ListTypeDataItem occupations[] = {
+ {0, "Unspecified"},
+ {1, "Academic"},
+ {2, "Administrative"},
+ {3, "Art/Entertainment"},
+ {4, "College Student"},
+ {5, "Computers"},
+ {6, "Community & Social"},
+ {7, "Education"},
+ {8, "Engineering"},
+ {9, "Financial Services"},
+ {10, "Government"},
+ {11, "High School Student"},
+ {12, "Home"},
+ {13, "ICQ - Providing Help"},
+ {14, "Law"},
+ {15, "Managerial"},
+ {16, "Manufacturing"},
+ {17, "Medical/Health"},
+ {18, "Military"},
+ {19, "Non-Government Organization"},
+ {20, "Professional"},
+ {21, "Retail"},
+ {22, "Retired"},
+ {23, "Science & Research"},
+ {24, "Sports"},
+ {25, "Technical"},
+ {26, "University Student"},
+ {27, "Web Building"},
+ {99, "Other Services"}
+};
+
+static ListTypeDataItem genders[]={
+ {0,"Unspecified"},
+ {'M',"Male"},
+ {'F',"Female"},
+};
+
+static ListTypeDataItem months[]={
+ {0, "Unspecified"},
+ {1, "January"},
+ {2, "February"},
+ {3, "March"},
+ {4, "April"},
+ {5, "May"},
+ {6, "June"},
+ {7, "July"},
+ {8, "August"},
+ {9, "September"},
+ {10,"October"},
+ {11,"November"},
+ {12,"December"},
+};
+
+static ListTypeDataItem languages[]={
+ {0, "None"},
+ {55,"Afrikaans"},
+ {58,"Albanian"},
+ {1, "Arabic"},
+ {59,"Armenian"},
+ {68,"Azerbaijani"},
+ {72,"Belorussian"},
+ {2, "Bhojpuri"},
+ {56,"Bosnian"},
+ {3, "Bulgarian"},
+ {4, "Burmese"},
+ {5, "Cantonese"},
+ {6, "Catalan"},
+ {61,"Chamorro"},
+ {7, "Chinese"},
+ {8, "Croatian"},
+ {9, "Czech"},
+ {10,"Danish"},
+ {11,"Dutch"},
+ {12,"English"},
+ {13,"Esperanto"},
+ {14,"Estonian"},
+ {15,"Farci"},
+ {16,"Finnish"},
+ {17,"French"},
+ {18,"Gaelic"},
+ {19,"German"},
+ {20,"Greek"},
+ {70,"Gujarati"},
+ {21,"Hebrew"},
+ {22,"Hindi"},
+ {23,"Hungarian"},
+ {24,"Icelandic"},
+ {25,"Indonesian"},
+ {26,"Italian"},
+ {27,"Japanese"},
+ {28,"Khmer"},
+ {29,"Korean"},
+ {69,"Kurdish"},
+ {30,"Lao"},
+ {31,"Latvian"},
+ {32,"Lithuanian"},
+ {65,"Macedonian"},
+ {33,"Malay"},
+ {63,"Mandarin"},
+ {62,"Mongolian"},
+ {34,"Norwegian"},
+ {57,"Persian"},
+ {35,"Polish"},
+ {36,"Portuguese"},
+ {60,"Punjabi"},
+ {37,"Romanian"},
+ {38,"Russian"},
+ {39,"Serbo-Croatian"},
+ {66,"Sindhi"},
+ {40,"Slovak"},
+ {41,"Slovenian"},
+ {42,"Somali"},
+ {43,"Spanish"},
+ {44,"Swahili"},
+ {45,"Swedish"},
+ {46,"Tagalog"},
+ {64,"Taiwaness"},
+ {71,"Tamil"},
+ {47,"Tatar"},
+ {48,"Thai"},
+ {49,"Turkish"},
+ {50,"Ukrainian"},
+ {51,"Urdu"},
+ {52,"Vietnamese"},
+ {67,"Welsh"},
+ {53,"Yiddish"},
+ {54,"Yoruba"},
+};
+
+static ListTypeDataItem interests[]={
+ {0, "Unspecified"},
+ {100, "Art"},
+ {101, "Cars"},
+ {102, "Celebrity Fans"},
+ {103, "Collections"},
+ {104, "Computers"},
+ {105, "Culture & Literature"},
+ {106, "Fitness"},
+ {107, "Games"},
+ {108, "Hobbies"},
+ {109, "ICQ - Providing Help"},
+ {110, "Internet"},
+ {111, "Lifestyle"},
+ {112, "Movies/TV"},
+ {113, "Music"},
+ {114, "Outdoor Activities"},
+ {115, "Parenting"},
+ {116, "Pets/Animals"},
+ {117, "Religion"},
+ {118, "Science/Technology"},
+ {119, "Skills"},
+ {120, "Sports"},
+ {121, "Web Design"},
+ {122, "Nature and Environment"},
+ {123, "News & Media"},
+ {124, "Government"},
+ {125, "Business & Economy"},
+ {126, "Mystics"},
+ {127, "Travel"},
+ {128, "Astronomy"},
+ {129, "Space"},
+ {130, "Clothing"},
+ {131, "Parties"},
+ {132, "Women"},
+ {133, "Social science"},
+ {134, "60's"},
+ {135, "70's"},
+ {136, "80's"},
+ {137, "50's"},
+ {138, "Finance and corporate"},
+ {139, "Entertainment"},
+ {140, "Consumer electronics"},
+ {141, "Retail stores"},
+ {142, "Health and beauty"},
+ {143, "Media"},
+ {144, "Household products"},
+ {145, "Mail order catalog"},
+ {146, "Business services"},
+ {147, "Audio and visual"},
+ {148, "Sporting and athletic"},
+ {149, "Publishing"},
+ {150, "Home automation"}
+};
+
+static ListTypeDataItem pastbackground[]={
+ {0, "Unspecified"},
+ {300, "Elementary School"},
+ {301, "High School"},
+ {302, "College"},
+ {303, "University"},
+ {304, "Military"},
+ {305, "Past Work Place"},
+ {306, "Past Organization"},
+ {399, "Other"}
+};
+
+static ListTypeDataItem affiliation[]={
+ {0, "Unspecified"},
+ {200, "Alumni Org."},
+ {201, "Charity Org."},
+ {202, "Club/Social Org."},
+ {203, "Community Org."},
+ {204, "Cultural Org."},
+ {205, "Fan Clubs"},
+ {206, "Fraternity/Sorority"},
+ {207, "Hobbyists Org."},
+ {208, "International Org."},
+ {209, "Nature and Environment Org."},
+ {210, "Professional Org."},
+ {211, "Scientific/Technical Org."},
+ {212, "Self Improvement Group"},
+ {213, "Spiritual/Religious Org."},
+ {214, "Sports Org."},
+ {215, "Support Org."},
+ {216, "Trade and Business Org."},
+ {217, "Union"},
+ {218, "Volunteer Org."},
+ {299, "Other"},
+};
+
+static ListTypeDataItem maritalstatuses[]={
+ {0, "Unspecified"},
+ {10, "Single"},
+ {11, "Close relationships"},
+ {12, "Engaged"},
+ {20, "Married"},
+ {30, "Divorced"},
+ {31, "Separated"},
+ {40, "Widowed"}
+};
+
+
+const int ageRange[]={13,0x7FFF}; // 14, 130
+const int yearRange[]={1753,0x7FFF}; // 1880, 2000
+const int dayRange[]={1,31};
+
+
+SettingItem setting[]={
+ //personal
+ {"Personal", LI_DIVIDER},
+ {"Nickname", LI_STRING, DBVT_ASCIIZ, "Nick"},
+ {"First name", LI_STRING, DBVT_ASCIIZ, "FirstName"},
+ {"Last name", LI_STRING, DBVT_ASCIIZ, "LastName"},
+ {"Age", LI_NUMBER, DBVT_WORD, "Age", (void*)ageRange},
+ {"Gender", LI_LIST, DBVT_BYTE, "Gender", genders, sizeof(genders)/sizeof(genders[0])},
+ {"About", LI_LONGSTRING, DBVT_ASCIIZ, "About"},
+ //password
+ {"Password", LI_DIVIDER},
+ {"Password", LI_STRING|LIF_PASSWORD,DBVT_ASCIIZ, "Password"},
+ //contact
+ {"Contact", LI_DIVIDER},
+ {"Primary e-mail", LI_STRING, DBVT_ASCIIZ, "e-mail"},
+ {"Secondary e-mail", LI_STRING, DBVT_ASCIIZ, "e-mail0"},
+ {"Tertiary e-mail", LI_STRING, DBVT_ASCIIZ, "e-mail1"},
+ {"Homepage", LI_STRING, DBVT_ASCIIZ, "Homepage"},
+ {"Street", LI_STRING, DBVT_ASCIIZ, "Street"},
+ {"City", LI_STRING, DBVT_ASCIIZ, "City"},
+ {"State", LI_STRING, DBVT_ASCIIZ, "State"},
+ {"ZIP/postcode", LI_STRING, DBVT_ASCIIZ, "ZIP"},
+ {"Country", LI_LIST, DBVT_WORD, "Country", countries, sizeof(countries)/sizeof(countries[0])},
+ {"Phone number", LI_STRING, DBVT_ASCIIZ, "Phone"},
+ {"Fax number", LI_STRING, DBVT_ASCIIZ, "Fax"},
+ {"Cellular number",LI_STRING, DBVT_ASCIIZ, "Cellular"},
+ //more
+ {"Personal Detail",LI_DIVIDER},
+ {"Timezone", LI_LIST|LIF_ZEROISVALID|LIF_SIGNED,DBVT_BYTE, "Timezone", timezones, sizeof(timezones)/sizeof(timezones[0])},
+ {"Year of birth", LI_NUMBER, DBVT_WORD, "BirthYear", (void*)yearRange},
+ {"Month of birth", LI_LIST, DBVT_BYTE, "BirthMonth", months, sizeof(months)/sizeof(months[0])},
+ {"Day of birth", LI_NUMBER, DBVT_BYTE, "BirthDay", (void*)dayRange},
+ {"Marital Status", LI_LIST, DBVT_BYTE, "MaritalStatus", maritalstatuses, sizeof(maritalstatuses)/sizeof(maritalstatuses[0])},
+ {"Spoken language 1", LI_LIST, DBVT_ASCIIZ, "Language1", languages, sizeof(languages)/sizeof(languages[0])},
+ {"Spoken language 2", LI_LIST, DBVT_ASCIIZ, "Language2", languages, sizeof(languages)/sizeof(languages[0])},
+ {"Spoken language 3", LI_LIST, DBVT_ASCIIZ, "Language3", languages, sizeof(languages)/sizeof(languages[0])},
+ //more
+ {"Originally from",LI_DIVIDER},
+ {"City", LI_STRING, DBVT_ASCIIZ, "OriginCity"},
+ {"State", LI_STRING, DBVT_ASCIIZ, "OriginState"},
+ {"Country", LI_LIST, DBVT_WORD, "OriginCountry", countries, sizeof(countries)/sizeof(countries[0])},
+ //work
+ {"Work", LI_DIVIDER},
+ {"Company name", LI_STRING, DBVT_ASCIIZ, "Company"},
+ {"Company homepage",LI_STRING, DBVT_ASCIIZ, "CompanyHomepage"},
+ {"Company street", LI_STRING, DBVT_ASCIIZ, "CompanyStreet"},
+ {"Company city", LI_STRING, DBVT_ASCIIZ, "CompanyCity"},
+ {"Company state", LI_STRING, DBVT_ASCIIZ, "CompanyState"},
+ {"Company phone", LI_STRING, DBVT_ASCIIZ, "CompanyPhone"},
+ {"Company fax", LI_STRING, DBVT_ASCIIZ, "CompanyFax"},
+ {"Company ZIP/postcode",LI_STRING,DBVT_ASCIIZ, "CompanyZIP"},
+ {"Company country",LI_LIST, DBVT_WORD, "CompanyCountry",countries, sizeof(countries)/sizeof(countries[0])},
+ {"Company department",LI_STRING, DBVT_ASCIIZ, "CompanyDepartment"},
+ {"Company position",LI_STRING, DBVT_ASCIIZ, "CompanyPosition"},
+ {"Company occupation",LI_LIST, DBVT_WORD, "CompanyOccupation", occupations, sizeof(occupations)/sizeof(occupations[0])},
+ //interests
+ {"Personal Interests", LI_DIVIDER},
+ {"Interest category 1",LI_LIST, DBVT_ASCIIZ, "Interest0Cat", interests, sizeof(interests)/sizeof(interests[0])},
+ {"Interest areas 1",LI_STRING, DBVT_ASCIIZ, "Interest0Text"},
+ {"Interest category 2",LI_LIST, DBVT_ASCIIZ, "Interest1Cat", interests, sizeof(interests)/sizeof(interests[0])},
+ {"Interest areas 2",LI_STRING, DBVT_ASCIIZ, "Interest1Text"},
+ {"Interest category 3",LI_LIST, DBVT_ASCIIZ, "Interest2Cat", interests, sizeof(interests)/sizeof(interests[0])},
+ {"Interest areas 3",LI_STRING, DBVT_ASCIIZ, "Interest2Text"},
+ {"Interest category 4",LI_LIST, DBVT_ASCIIZ, "Interest3Cat", interests, sizeof(interests)/sizeof(interests[0])},
+ {"Interest areas 4",LI_STRING, DBVT_ASCIIZ, "Interest3Text"},
+ //pastbackground
+ {"Past Background", LI_DIVIDER},
+ {"Category 1",LI_LIST, DBVT_ASCIIZ, "Past0", pastbackground, sizeof(pastbackground)/sizeof(pastbackground[0])},
+ {"Past Background 1",LI_STRING, DBVT_ASCIIZ, "Past0Text"},
+ {"Category 2",LI_LIST, DBVT_ASCIIZ, "Past1", pastbackground, sizeof(pastbackground)/sizeof(pastbackground[0])},
+ {"Past Background 2",LI_STRING, DBVT_ASCIIZ, "Past1Text"},
+ {"Category 3",LI_LIST, DBVT_ASCIIZ, "Past2", pastbackground, sizeof(pastbackground)/sizeof(pastbackground[0])},
+ {"Past Background 3",LI_STRING, DBVT_ASCIIZ, "Past2Text"},
+ //affiliation
+ {"Affiliations", LI_DIVIDER},
+ {"Affiliation category 1",LI_LIST,DBVT_ASCIIZ, "Affiliation0", affiliation, sizeof(affiliation)/sizeof(affiliation[0])},
+ {"Affiliation 1",LI_STRING, DBVT_ASCIIZ, "Affiliation0Text"},
+ {"Affiliation category 2",LI_LIST,DBVT_ASCIIZ, "Affiliation1", affiliation, sizeof(affiliation)/sizeof(affiliation[0])},
+ {"Affiliation 2",LI_STRING, DBVT_ASCIIZ, "Affiliation1Text"},
+ {"Affiliation category 3",LI_LIST,DBVT_ASCIIZ, "Affiliation2", affiliation, sizeof(affiliation)/sizeof(affiliation[0])},
+ {"Affiliation 3",LI_STRING, DBVT_ASCIIZ, "Affiliation2Text"}
+};
+
+const int settingCount=sizeof(setting)/sizeof(setting[0]);
diff --git a/icqj_mod/changeinfo/db.c b/icqj_mod/changeinfo/db.c new file mode 100644 index 0000000..2e0ba46 --- /dev/null +++ b/icqj_mod/changeinfo/db.c @@ -0,0 +1,226 @@ +// ---------------------------------------------------------------------------80
+// ICQ plugin for Miranda Instant Messenger
+// ________________________________________
+//
+// Copyright 2001,2002,2003,2004 Richard Hughes, Martin berg
+// Copyright 2004,2005,2006 Joe Kucera, Bio
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+// -----------------------------------------------------------------------------
+//
+// File name : $Source: /cvsroot/miranda/miranda/protocols/IcqOscarJ/changeinfo/db.c,v $
+// Revision : $Revision: 2874 $
+// Last change on : $Date: 2006-05-17 01:38:00 +0400 $
+// Last change by : $Author: ghazan $
+//
+// DESCRIPTION:
+//
+// ChangeInfo Plugin stuff
+//
+// -----------------------------------------------------------------------------
+
+#include "icqoscar.h"
+
+
+void LoadSettingsFromDb(int keepChanged)
+{
+ int i;
+ DBVARIANT dbv;
+
+ for(i=0;i<settingCount;i++)
+ {
+ if (setting[i].displayType==LI_DIVIDER) continue;
+ if (keepChanged && setting[i].changed) continue;
+ if (setting[i].dbType==DBVT_ASCIIZ)
+ {
+ SAFE_FREE((char**)&setting[i].value);
+ }
+ else if (!keepChanged)
+ setting[i].value = 0;
+
+ setting[i].changed=0;
+
+ if (setting[i].displayType&LIF_PASSWORD) continue;
+
+ if (!ICQGetContactSetting(NULL,setting[i].szDbSetting,&dbv))
+ {
+#ifdef _DEBUG
+ if(dbv.type!=setting[i].dbType)
+ MessageBoxA(NULL,"That's not supposed to happen","Huh?",MB_OK);
+#endif
+ switch(dbv.type)
+ {
+ case DBVT_ASCIIZ:
+ setting[i].value=(LPARAM)ICQGetContactSettingUtf(NULL,setting[i].szDbSetting, NULL);
+ break;
+ case DBVT_WORD:
+ if(setting[i].displayType&LIF_SIGNED)
+ setting[i].value=dbv.sVal;
+ else
+ setting[i].value=dbv.wVal;
+ break;
+ case DBVT_BYTE:
+ if(setting[i].displayType&LIF_SIGNED)
+ setting[i].value=dbv.cVal;
+ else
+ setting[i].value=dbv.bVal;
+ break;
+#ifdef _DEBUG
+ default:
+ MessageBoxA(NULL,"That's not supposed to happen either","Huh?",MB_OK);
+ break;
+#endif
+ }
+ ICQFreeVariant(&dbv);
+ }
+ }
+}
+
+
+
+void FreeStoredDbSettings(void)
+{
+ int i;
+
+ for(i=0;i<settingCount;i++)
+ if(setting[i].dbType==DBVT_ASCIIZ)
+ SAFE_FREE((char**)&setting[i].value);
+}
+
+
+
+int ChangesMade(void)
+{
+ int i;
+
+ for(i=0;i<settingCount;i++)
+ if(setting[i].changed) return 1;
+ return 0;
+}
+
+
+
+void ClearChangeFlags(void)
+{
+ int i;
+
+ for(i=0;i<settingCount;i++)
+ setting[i].changed=0;
+}
+
+
+
+static BOOL CALLBACK PwConfirmDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ static char *Pass;
+
+ switch(msg)
+ {
+ case WM_INITDIALOG:
+ ICQTranslateDialog(hwndDlg);
+ Pass = (char*)lParam;
+ SendDlgItemMessage(hwndDlg,IDC_PASSWORD,EM_LIMITTEXT,15,0);
+ return TRUE;
+
+ case WM_COMMAND:
+ switch(LOWORD(wParam))
+ {
+ case IDOK:
+ {
+ char szTest[16], str[1024], cap[MAX_PATH];
+
+ GetDlgItemTextA(hwndDlg,IDC_OLDPASS,szTest,sizeof(szTest));
+
+ if (strcmpnull(szTest, GetUserPassword(TRUE)))
+ {
+ MessageBoxUtf(hwndDlg,ICQTranslateUtfStatic("The password does not match your current password. Check Caps Lock and try again.", str), ICQTranslateUtfStatic("Change ICQ Details", cap), MB_OK);
+ 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, Pass))
+ {
+ MessageBoxUtf(hwndDlg,ICQTranslateUtfStatic("The password does not match the password you originally entered. Check Caps Lock and try again.", str), ICQTranslateUtfStatic("Change ICQ Details", cap), MB_OK);
+ SendDlgItemMessage(hwndDlg,IDC_PASSWORD,EM_SETSEL,0,(LPARAM)-1);
+ SetFocus(GetDlgItem(hwndDlg,IDC_PASSWORD));
+ break;
+ }
+ }
+ case IDCANCEL:
+ EndDialog(hwndDlg,wParam);
+ break;
+ }
+ break;
+ }
+ return FALSE;
+}
+
+
+
+int SaveSettingsToDb(HWND hwndDlg)
+{
+ int i,ret=1;
+
+ for(i=0;i<settingCount;i++)
+ {
+ if(!setting[i].changed) continue;
+ if(!(setting[i].displayType&LIF_ZEROISVALID) && setting[i].value==0)
+ {
+ ICQDeleteContactSetting(NULL,setting[i].szDbSetting);
+ continue;
+ }
+ switch(setting[i].dbType)
+ {
+ case DBVT_ASCIIZ:
+ if(setting[i].displayType&LIF_PASSWORD)
+ {
+ int nSettingLen = strlennull((char*)setting[i].value);
+
+ if (nSettingLen>8 || nSettingLen<1)
+ {
+ char str[1024], cap[MAX_PATH];
+
+ MessageBoxUtf(hwndDlg, ICQTranslateUtfStatic("The ICQ server does not support passwords longer than 8 characters. Please use a shorter password.", str), ICQTranslateUtfStatic("Change ICQ Details", cap), MB_OK);
+ ret=0;
+ break;
+ }
+ if (IDOK!=DialogBoxParam(hInst,MAKEINTRESOURCE(IDD_PWCONFIRM),hwndDlg,PwConfirmDlgProc,(LPARAM)setting[i].value))
+ {
+ ret=0;
+ break;
+ }
+ strcpy(gpszPassword, (char*)setting[i].value);
+ }
+ else
+ {
+ if(*(char*)setting[i].value)
+ ICQWriteContactSettingUtf(NULL,setting[i].szDbSetting,(char*)setting[i].value);
+ else
+ ICQDeleteContactSetting(NULL,setting[i].szDbSetting);
+ }
+ break;
+ case DBVT_WORD:
+ ICQWriteContactSettingWord(NULL,setting[i].szDbSetting,(WORD)setting[i].value);
+ break;
+ case DBVT_BYTE:
+ ICQWriteContactSettingByte(NULL,setting[i].szDbSetting,(BYTE)setting[i].value);
+ break;
+ }
+ }
+ return ret;
+}
diff --git a/icqj_mod/changeinfo/dlgproc.c b/icqj_mod/changeinfo/dlgproc.c new file mode 100644 index 0000000..23bae32 --- /dev/null +++ b/icqj_mod/changeinfo/dlgproc.c @@ -0,0 +1,560 @@ +// ---------------------------------------------------------------------------80
+// ICQ plugin for Miranda Instant Messenger
+// ________________________________________
+//
+// Copyright 2001,2002,2003,2004 Richard Hughes, Martin berg
+// Copyright 2004,2005,2006 Joe Kucera, Bio
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+// -----------------------------------------------------------------------------
+//
+// File name : $Source: /cvsroot/miranda/miranda/protocols/IcqOscarJ/changeinfo/dlgproc.c,v $
+// Revision : $Revision: 3183 $
+// Last change on : $Date: 2006-06-20 13:50:04 +0400 $
+// Last change by : $Author: jokusoftware $
+//
+// DESCRIPTION:
+//
+// ChangeInfo Plugin stuff
+//
+// -----------------------------------------------------------------------------
+
+#include "icqoscar.h"
+
+
+static int editTopIndex;
+static HANDLE hAckHook = NULL;
+static HFONT hMyFont = NULL;
+
+#define DM_PROTOACK (WM_USER+10)
+
+static int DrawTextUtf(HDC hDC, char* text, LPRECT lpRect, UINT uFormat, LPSIZE lpSize)
+{
+ int res;
+
+ if (gbUnicodeAPI)
+ {
+ wchar_t *tmp = make_unicode_string(text);
+
+ res = DrawTextW(hDC, tmp, -1, lpRect, uFormat);
+ if (lpSize)
+ GetTextExtentPoint32W(hDC, tmp, wcslen(tmp), lpSize);
+ SAFE_FREE(&tmp);
+ }
+ else
+ {
+ // caution, here we change text's contents
+ utf8_decode_static(text, text, strlennull(text)+1);
+ res = DrawTextA(hDC, text, -1, lpRect, uFormat);
+ if (lpSize)
+ GetTextExtentPoint32A(hDC, text, strlennull(text), lpSize);
+ }
+ return res;
+}
+
+
+
+static void PaintItemSetting(HDC hdc,RECT *rc,int i,UINT itemState)
+{
+ char *text;
+ int alloced=0;
+ char str[MAX_PATH];
+
+ if (setting[i].value==0 && !(setting[i].displayType&LIF_ZEROISVALID))
+ {
+ SetTextColor(hdc, GetSysColor(COLOR_GRAYTEXT));
+
+ if (setting[i].displayType & LIF_CHANGEONLY)
+ text = ICQTranslateUtfStatic("<unremovable once applied>", str);
+ else
+ text = ICQTranslateUtfStatic("<empty>", str);
+ }
+ else
+ {
+ switch (setting[i].displayType & LIM_TYPE)
+ {
+ case LI_STRING:
+ case LI_LONGSTRING:
+ {
+ text = BinaryToEscapes((char*)setting[i].value);
+ alloced = 1;
+ break;
+ }
+
+ case LI_NUMBER:
+ text = str;
+ itoa(setting[i].value, text, 10);
+ break;
+
+ case LI_LIST:
+ if (setting[i].dbType == DBVT_ASCIIZ)
+ {
+ text = ICQTranslateUtfStatic((char*)setting[i].value, str);
+ }
+ else
+ {
+ int j;
+
+ text = ICQTranslateUtfStatic("Unknown value", str);
+
+ for(j=0; j < setting[i].listCount; j++)
+ if (((ListTypeDataItem*)setting[i].pList)[j].id == setting[i].value)
+ {
+ text = ICQTranslateUtfStatic(((ListTypeDataItem*)setting[i].pList)[j].szValue, str);
+ break;
+ }
+ }
+ break;
+ }
+ }
+ if (setting[i].displayType & LIF_PASSWORD)
+ {
+ if (setting[i].changed)
+ {
+ int i;
+ for (i=0; text[i]; i++) text[i] = '*';
+ }
+ else
+ {
+ if (alloced)
+ {
+ SAFE_FREE(&text);
+ alloced=0;
+ }
+ text = "********";
+ }
+ }
+ if ((setting[i].displayType & LIM_TYPE) == LI_LIST && (itemState & CDIS_SELECTED || iEditItem == i))
+ {
+ RECT rcBtn;
+
+ rcBtn = *rc;
+ rcBtn.left = rcBtn.right - rc->bottom + rc->top;
+ InflateRect(&rcBtn,-2,-2);
+ rc->right = rcBtn.left;
+ 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);
+
+ if (alloced) SAFE_FREE(&text);
+}
+
+
+static int InfoDlg_Resize(HWND hwndDlg,LPARAM lParam,UTILRESIZECONTROL *urc)
+{
+ switch (urc->wId)
+ {
+ case IDC_LIST:
+ return RD_ANCHORX_WIDTH | RD_ANCHORY_HEIGHT;
+ break;
+ case IDC_SAVE:
+ return RD_ANCHORX_RIGHT | RD_ANCHORY_BOTTOM;
+ break;
+ case IDC_UPLOADING:
+ return RD_ANCHORX_WIDTH | RD_ANCHORY_BOTTOM;
+ break;
+ }
+ return RD_ANCHORX_LEFT | RD_ANCHORY_TOP; // default
+}
+
+
+
+BOOL CALLBACK ChangeInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ switch(msg)
+ {
+ case WM_INITDIALOG:
+ ICQTranslateDialog(hwndDlg);
+ hwndList=GetDlgItem(hwndDlg,IDC_LIST);
+ LoadSettingsFromDb(0);
+ ListView_SetExtendedListViewStyle(hwndList,LVS_EX_FULLROWSELECT);
+ iEditItem=-1;
+ {
+ LOGFONT lf;
+
+ hListFont=(HFONT)SendMessage(hwndList,WM_GETFONT,0,0);
+ GetObject(hListFont,sizeof(lf),&lf);
+ lf.lfHeight-=5;
+ hMyFont=CreateFontIndirect(&lf);
+ SendMessage(hwndList,WM_SETFONT,(WPARAM)hMyFont,0);
+ }
+ {
+ LV_COLUMN lvc={0};
+ RECT rc;
+
+ GetClientRect(hwndList,&rc);
+ rc.right-=GetSystemMetrics(SM_CXVSCROLL);
+ lvc.mask = LVCF_WIDTH;
+ lvc.cx = rc.right/3;
+ ListView_InsertColumn(hwndList, 0, &lvc);
+ lvc.cx = rc.right-lvc.cx;
+ ListView_InsertColumn(hwndList, 1, &lvc);
+ }
+ {
+ LV_ITEM lvi={0};
+ lvi.mask = LVIF_PARAM;
+
+ for (lvi.iItem=0;lvi.iItem<settingCount;lvi.iItem++)
+ {
+ lvi.lParam=lvi.iItem;
+ ListView_InsertItem(hwndList, &lvi);
+ }
+ }
+ {
+ char *pwd = GetUserPassword(TRUE);
+
+ if (pwd)
+ strcpy(Password, pwd);
+ else
+ strcpy(Password, "");
+ }
+
+ SendMessage(GetParent(hwndDlg),PSM_CHANGED,0,0);
+ return TRUE;
+
+ case WM_NOTIFY:
+ switch (((LPNMHDR)lParam)->idFrom)
+ {
+ case 0:
+ switch (((LPNMHDR)lParam)->code)
+ {
+ case PSN_INFOCHANGED:
+ LoadSettingsFromDb(1);
+ break;
+
+ case PSN_KILLACTIVE:
+ EndStringEdit(1);
+ EndListEdit(1);
+ break;
+
+ case PSN_APPLY:
+ if(ChangesMade())
+ {
+ char str[1024], cap[MAX_PATH];
+
+ if (IDYES!=MessageBoxUtf(hwndDlg, ICQTranslateUtfStatic("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?", str), ICQTranslateUtfStatic("Change ICQ Details", cap), MB_YESNOCANCEL))
+ {
+ SetWindowLongUtf(hwndDlg,DWL_MSGRESULT,PSNRET_INVALID_NOCHANGEPAGE);
+ return TRUE;
+ }
+ }
+ PostMessage(hwndList,WM_SETFONT,(WPARAM)hListFont,0);
+ break;
+ }
+ break;
+
+ case IDC_LIST:
+ switch (((LPNMHDR)lParam)->code)
+ {
+ case LVN_GETDISPINFOW:
+ case LVN_GETDISPINFO:
+ if (iEditItem != -1)
+ {
+ if (editTopIndex != ListView_GetTopIndex(hwndList))
+ {
+ EndStringEdit(1);
+ EndListEdit(1);
+ }
+ }
+ break;
+
+ case NM_CUSTOMDRAW:
+ {
+ LPNMLVCUSTOMDRAW cd=(LPNMLVCUSTOMDRAW)lParam;
+
+ switch(cd->nmcd.dwDrawStage)
+ {
+ case CDDS_PREPAINT:
+ SetWindowLongUtf(hwndDlg,DWL_MSGRESULT,CDRF_NOTIFYSUBITEMDRAW);
+ return TRUE;
+
+ case CDDS_ITEMPREPAINT:
+ {
+ RECT rc;
+
+ ListView_GetItemRect(hwndList, cd->nmcd.dwItemSpec, &rc, LVIR_BOUNDS);
+
+ if (GetWindowLong(hwndList, GWL_STYLE) & WS_DISABLED)
+ { // Disabled List
+ SetTextColor(cd->nmcd.hdc, cd->clrText);
+ FillRect(cd->nmcd.hdc, &rc, GetSysColorBrush(COLOR_3DFACE));
+ }
+ else if ((cd->nmcd.uItemState & CDIS_SELECTED || iEditItem == (int)cd->nmcd.dwItemSpec)
+ && setting[cd->nmcd.lItemlParam].displayType != LI_DIVIDER)
+ { // Selected item
+ SetTextColor(cd->nmcd.hdc, GetSysColor(COLOR_HIGHLIGHTTEXT));
+ FillRect(cd->nmcd.hdc, &rc, GetSysColorBrush(COLOR_HIGHLIGHT));
+ }
+ else
+ { // Unselected item
+ SetTextColor(cd->nmcd.hdc, GetSysColor(COLOR_WINDOWTEXT));
+ FillRect(cd->nmcd.hdc, &rc, GetSysColorBrush(COLOR_WINDOW));
+ }
+
+ 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);
+ HFONT hoFont;
+
+ hoFont = (HFONT)SelectObject(cd->nmcd.hdc, hListFont);
+ SetTextColor(cd->nmcd.hdc, GetSysColor(COLOR_3DSHADOW));
+ ListView_GetItemRect(hwndList, cd->nmcd.dwItemSpec, &rc, LVIR_BOUNDS);
+ DrawTextUtf(cd->nmcd.hdc, szText, &rc, DT_CENTER|DT_NOCLIP|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER, &textSize);
+ rcLine.top = (rc.top + rc.bottom)/2-1;
+ rcLine.bottom = rcLine.top+2;
+ rcLine.left = rc.left + 3;
+ rcLine.right = (rc.left+rc.right-textSize.cx)/2-3;
+ DrawEdge(cd->nmcd.hdc, &rcLine, BDR_SUNKENOUTER, BF_RECT);
+ rcLine.left = (rc.left + rc.right + textSize.cx)/2 + 3;
+ rcLine.right = rc.right-3;
+ DrawEdge(cd->nmcd.hdc, &rcLine, BDR_SUNKENOUTER, BF_RECT);
+ SetWindowLongUtf(hwndDlg, DWL_MSGRESULT, CDRF_SKIPDEFAULT);
+ }
+ else
+ {
+ SetWindowLongUtf(hwndDlg, DWL_MSGRESULT, CDRF_NOTIFYSUBITEMDRAW|CDRF_NOTIFYPOSTPAINT);
+ }
+
+ return TRUE;
+ }
+
+ case CDDS_SUBITEM|CDDS_ITEMPREPAINT:
+ {
+ RECT rc;
+ HFONT hoFont;
+
+ hoFont=(HFONT)SelectObject(cd->nmcd.hdc,hListFont);
+ ListView_GetSubItemRect(hwndList,cd->nmcd.dwItemSpec,cd->iSubItem,LVIR_BOUNDS,&rc);
+
+ if (cd->iSubItem==0)
+ {
+ RECT rc2;
+ char str[MAX_PATH];
+
+ ListView_GetSubItemRect(hwndList,cd->nmcd.dwItemSpec,1,LVIR_BOUNDS,&rc2);
+ rc.right=rc2.left;
+ rc.left+=2;
+ DrawTextUtf(cd->nmcd.hdc, ICQTranslateUtfStatic(setting[cd->nmcd.lItemlParam].szDescription, str), &rc, DT_END_ELLIPSIS|DT_LEFT|DT_NOCLIP|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER, NULL);
+ }
+ else
+ PaintItemSetting(cd->nmcd.hdc, &rc, cd->nmcd.lItemlParam, cd->nmcd.uItemState);
+ SetWindowLongUtf(hwndDlg,DWL_MSGRESULT,CDRF_SKIPDEFAULT);
+
+ return TRUE;
+ }
+/*
+ case CDDS_ITEMPOSTPAINT:
+ { RECT rc;
+ ListView_GetItemRect(hwndList,cd->nmcd.dwItemSpec,&rc,LVIR_BOUNDS);
+ if(cd->nmcd.uItemState&CDIS_FOCUS) {
+ HDC hdc2
+ hdc2=GetDC(hwndList); //I don't know what the listview's done to its DC, but I can't figure out how to undo it
+ DrawFocusRect(hdc2,&rc);
+ ReleaseDC(hwndList,hdc2);
+ }
+ break;
+ }
+*/
+
+ }
+ break;
+ }
+ case NM_CLICK:
+ {
+ LPNMLISTVIEW nm=(LPNMLISTVIEW)lParam;
+ LV_ITEM lvi;
+ RECT rc;
+
+ EndStringEdit(1);
+ EndListEdit(1);
+ if (nm->iSubItem != 1) break;
+ lvi.mask = LVIF_PARAM|LVIF_STATE;
+ lvi.stateMask = 0xFFFFFFFF;
+ lvi.iItem = nm->iItem; lvi.iSubItem = nm->iSubItem;
+ ListView_GetItem(hwndList, &lvi);
+ if (!(lvi.state & LVIS_SELECTED)) break;
+ ListView_EnsureVisible(hwndList, lvi.iItem, FALSE);
+ ListView_GetSubItemRect(hwndList, lvi.iItem, lvi.iSubItem, LVIR_BOUNDS, &rc);
+ editTopIndex = ListView_GetTopIndex(hwndList);
+ switch (setting[lvi.lParam].displayType & LIM_TYPE)
+ {
+ case LI_STRING:
+ case LI_LONGSTRING:
+ case LI_NUMBER:
+ BeginStringEdit(nm->iItem, &rc, lvi. lParam, 0);
+ break;
+ case LI_LIST:
+ BeginListEdit(nm->iItem, &rc, lvi. lParam, 0);
+ break;
+ }
+ break;
+ }
+ case LVN_KEYDOWN:
+ {
+ LPNMLVKEYDOWN nm=(LPNMLVKEYDOWN)lParam;
+ LV_ITEM lvi;
+ RECT rc;
+
+ EndStringEdit(1);
+ EndListEdit(1);
+ if(nm->wVKey==VK_SPACE || nm->wVKey==VK_RETURN) 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(hwndList,-1,LVNI_ALL|LVNI_SELECTED);
+ if(lvi.iItem==-1) break;
+ lvi.iSubItem=1;
+ ListView_GetItem(hwndList,&lvi);
+ ListView_EnsureVisible(hwndList,lvi.iItem,FALSE);
+ ListView_GetSubItemRect(hwndList,lvi.iItem,lvi.iSubItem,LVIR_BOUNDS,&rc);
+ editTopIndex=ListView_GetTopIndex(hwndList);
+ switch(setting[lvi.lParam].displayType&LIM_TYPE)
+ {
+ case LI_STRING:
+ case LI_LONGSTRING:
+ case LI_NUMBER:
+ BeginStringEdit(lvi.iItem,&rc,lvi.lParam,nm->wVKey);
+ break;
+ case LI_LIST:
+ BeginListEdit(lvi.iItem,&rc,lvi.lParam,nm->wVKey);
+ break;
+ }
+ SetWindowLongUtf(hwndDlg,DWL_MSGRESULT,TRUE);
+ return TRUE;
+ }
+ case NM_KILLFOCUS:
+ if(!IsStringEditWindow(GetFocus())) EndStringEdit(1);
+ if(!IsListEditWindow(GetFocus())) EndListEdit(1);
+ break;
+ }
+ break;
+ }
+ break;
+ case WM_KILLFOCUS:
+ EndStringEdit(1);
+ EndListEdit(1);
+ break;
+ case WM_COMMAND:
+ switch(LOWORD(wParam))
+ {
+ case IDCANCEL:
+ SendMessage(GetParent(hwndDlg), msg, wParam, lParam);
+ break;
+
+ case IDC_SAVE:
+ if (!SaveSettingsToDb(hwndDlg)) break;
+ EnableDlgItem(hwndDlg, IDC_SAVE, FALSE);
+ EnableDlgItem(hwndDlg, IDC_LIST, FALSE);
+ {
+ char str[MAX_PATH];
+
+ SetDlgItemTextUtf(hwndDlg, IDC_UPLOADING, ICQTranslateUtfStatic("Upload in progress...", str));
+ }
+ EnableDlgItem(hwndDlg, IDC_UPLOADING, TRUE);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_UPLOADING), SW_SHOW);
+ hAckHook = HookEventMessage(ME_PROTO_ACK, hwndDlg, DM_PROTOACK);
+
+ if (!UploadSettings(hwndDlg))
+ {
+ EnableDlgItem(hwndDlg, IDC_SAVE, TRUE);
+ EnableDlgItem(hwndDlg, IDC_LIST, TRUE);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_UPLOADING), SW_HIDE);
+ UnhookEvent(hAckHook);
+ hAckHook = NULL;
+ }
+ break;
+ }
+ break;
+
+ case WM_SIZE:
+ { // make the dlg resizeable
+ UTILRESIZEDIALOG urd = {0};
+
+ if (IsIconic(hwndDlg)) break;
+ urd.cbSize = sizeof(urd);
+ urd.hInstance = hInst;
+ urd.hwndDlg = hwndDlg;
+ urd.lParam = 0; // user-defined
+ urd.lpTemplate = MAKEINTRESOURCEA(IDD_INFO_CHANGEINFO);
+ urd.pfnResizer = InfoDlg_Resize;
+ CallService(MS_UTILS_RESIZEDIALOG, 0, (LPARAM) &urd);
+
+ { // update listview column widths
+ RECT rc;
+
+ GetClientRect(hwndList,&rc);
+ rc.right-=GetSystemMetrics(SM_CXVSCROLL);
+ ListView_SetColumnWidth(hwndList, 0, rc.right/3);
+ ListView_SetColumnWidth(hwndList, 1, rc.right - rc.right/3);
+ }
+ break;
+ }
+
+ case DM_PROTOACK:
+ {
+ ACKDATA *ack=(ACKDATA*)lParam;
+ int i,done;
+ char str[MAX_PATH];
+
+ if (ack->type != ACKTYPE_SETINFO) break;
+ if (ack->result == ACKRESULT_SUCCESS)
+ {
+ for (i=0; i<sizeof(hUpload)/sizeof(hUpload[0]); i++)
+ if (hUpload[i] && ack->hProcess == hUpload[i]) break;
+
+ if (i == sizeof(hUpload)/sizeof(hUpload[0])) break;
+ hUpload[i] = NULL;
+ for (done = 0, i = 0; i < sizeof(hUpload)/sizeof(hUpload[0]); i++)
+ done += hUpload[i] == NULL;
+ wsprintf(str,"%s%d%%", ICQTranslateUtfStatic("Upload in progress...", str), 100*done/(sizeof(hUpload)/sizeof(hUpload[0])));
+ SetDlgItemTextUtf(hwndDlg, IDC_UPLOADING, str);
+ if (done < sizeof(hUpload)/sizeof(hUpload[0])) break;
+
+ ClearChangeFlags();
+ UnhookEvent(hAckHook); hAckHook = NULL;
+ EnableDlgItem(hwndDlg, IDC_LIST, TRUE);
+ EnableDlgItem(hwndDlg, IDC_UPLOADING, FALSE);
+ SetDlgItemTextUtf(hwndDlg, IDC_UPLOADING, ICQTranslateUtfStatic("Upload complete", str));
+ SendMessage(GetParent(hwndDlg),PSM_FORCECHANGED,0,0);
+ }
+ else if (ack->result==ACKRESULT_FAILED)
+ {
+ UnhookEvent(hAckHook);
+ hAckHook = NULL;
+ EnableDlgItem(hwndDlg, IDC_LIST, TRUE);
+ EnableDlgItem(hwndDlg, IDC_UPLOADING, FALSE);
+ SetDlgItemTextUtf(hwndDlg, IDC_UPLOADING, ICQTranslateUtfStatic("Upload FAILED", str));
+ SendMessage(GetParent(hwndDlg), PSM_FORCECHANGED, 0, 0);
+ }
+ break;
+ }
+ case WM_DESTROY:
+ if(hAckHook)
+ {
+ UnhookEvent(hAckHook);
+ hAckHook=NULL;
+ }
+ //SendMessage(hwndList,WM_GETFONT,0,0);
+ DeleteObject(hMyFont);
+ FreeStoredDbSettings();
+ break;
+ }
+ return FALSE;
+}
diff --git a/icqj_mod/changeinfo/editlist.c b/icqj_mod/changeinfo/editlist.c new file mode 100644 index 0000000..47dba03 --- /dev/null +++ b/icqj_mod/changeinfo/editlist.c @@ -0,0 +1,173 @@ +// ---------------------------------------------------------------------------80
+// ICQ plugin for Miranda Instant Messenger
+// ________________________________________
+//
+// Copyright 2001,2002,2003,2004 Richard Hughes, Martin berg
+// Copyright 2004,2005,2006 Joe Kucera, Bio
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+// -----------------------------------------------------------------------------
+//
+// File name : $Source: /cvsroot/miranda/miranda/protocols/IcqOscarJ/changeinfo/editlist.c,v $
+// Revision : $Revision: 2874 $
+// Last change on : $Date: 2006-05-17 01:38:00 +0400 $
+// Last change by : $Author: ghazan $
+//
+// DESCRIPTION:
+//
+// ChangeInfo Plugin stuff
+//
+// -----------------------------------------------------------------------------
+
+#include "icqoscar.h"
+
+
+static HWND hwndListEdit=NULL;
+static BOOL (WINAPI *MyAnimateWindow)(HWND,DWORD,DWORD);
+static WNDPROC OldListEditProc;
+
+static LRESULT CALLBACK ListEditSubclassProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
+{
+ switch(msg)
+ {
+ case WM_LBUTTONUP:
+ CallWindowProcUtf(OldListEditProc,hwnd,msg,wParam,lParam);
+ {
+ POINT pt;
+
+ pt.x=(short)LOWORD(lParam);
+ pt.y=(short)HIWORD(lParam);
+ ClientToScreen(hwnd,&pt);
+ if(SendMessage(hwnd,WM_NCHITTEST,0,MAKELPARAM(pt.x,pt.y))==HTVSCROLL) break;
+ }
+ {
+ int i;
+
+ i=SendMessage(hwnd,LB_GETCURSEL,0,0);
+ EndListEdit(i!=LB_ERR);
+ }
+ return 0;
+ case WM_CHAR:
+ if(wParam!='\r') break;
+ {
+ int i;
+
+ i=SendMessage(hwnd,LB_GETCURSEL,0,0);
+ EndListEdit(i!=LB_ERR);
+ }
+ return 0;
+ case WM_KILLFOCUS:
+ EndListEdit(1);
+ return 0;
+ }
+ return CallWindowProcUtf(OldListEditProc,hwnd,msg,wParam,lParam);
+}
+
+
+
+void BeginListEdit(int iItem,RECT *rc,int i,WORD wVKey)
+{
+ int j,n;
+ POINT pt;
+ int itemHeight;
+ char str[MAX_PATH];
+
+ EndListEdit(0);
+ pt.x=pt.y=0;
+ ClientToScreen(hwndList,&pt);
+ OffsetRect(rc,pt.x,pt.y);
+ InflateRect(rc,-2,-2);
+ rc->left-=2;
+ iEditItem=iItem;
+ ListView_RedrawItems(hwndList,iEditItem,iEditItem);
+ UpdateWindow(hwndList);
+
+ hwndListEdit=CreateWindowEx(WS_EX_TOOLWINDOW|WS_EX_TOPMOST,"LISTBOX","",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);
+ itemHeight=SendMessage(hwndListEdit,LB_GETITEMHEIGHT,0,0);
+ for(j=0;j<setting[i].listCount;j++)
+ {
+ n = ListBoxAddStringUtf(hwndListEdit, ((ListTypeDataItem*)setting[i].pList)[j].szValue);
+ SendMessage(hwndListEdit,LB_SETITEMDATA,n,((ListTypeDataItem*)setting[i].pList)[j].id);
+ if ((setting[i].dbType==DBVT_ASCIIZ && (!strcmpnull((char*)setting[i].value,((ListTypeDataItem*)setting[i].pList)[j].szValue))
+ || (setting[i].dbType==DBVT_ASCIIZ && (!strcmpnull((char*)setting[i].value,ICQTranslateUtfStatic(((ListTypeDataItem*)setting[i].pList)[j].szValue, str))))
+ || ((char*)setting[i].value==NULL && ((ListTypeDataItem*)setting[i].pList)[j].id==0))
+ || (setting[i].dbType!=DBVT_ASCIIZ && setting[i].value==((ListTypeDataItem*)setting[i].pList)[j].id))
+ SendMessage(hwndListEdit,LB_SETCURSEL,n,0);
+ }
+ SendMessage(hwndListEdit,LB_SETTOPINDEX,SendMessage(hwndListEdit,LB_GETCURSEL,0,0)-3,0);
+ if(itemHeight*setting[i].listCount<150)
+ SetWindowPos(hwndListEdit,0,0,0,rc->right-rc->left,itemHeight*setting[i].listCount+GetSystemMetrics(SM_CYBORDER)*2,SWP_NOZORDER|SWP_NOMOVE);
+ OldListEditProc=(WNDPROC)SetWindowLongUtf(hwndListEdit,GWL_WNDPROC,(LONG)ListEditSubclassProc);
+ if (MyAnimateWindow=(BOOL (WINAPI*)(HWND,DWORD,DWORD))GetProcAddress(GetModuleHandle("user32"),"AnimateWindow"))
+ {
+ BOOL enabled;
+
+ SystemParametersInfo(SPI_GETCOMBOBOXANIMATION,0,&enabled,FALSE);
+ if(enabled) MyAnimateWindow(hwndListEdit,200,AW_SLIDE|AW_ACTIVATE|AW_VER_POSITIVE);
+ }
+ ShowWindow(hwndListEdit,SW_SHOW);
+ SetFocus(hwndListEdit);
+ if(wVKey)
+ PostMessage(hwndListEdit,WM_KEYDOWN,wVKey,0);
+}
+
+
+
+void EndListEdit(int save)
+{
+ if(hwndListEdit==NULL || iEditItem==-1) return;
+ if(save)
+ {
+ int i;
+ LPARAM newValue;
+ i=SendMessage(hwndListEdit,LB_GETCURSEL,0,0);
+ newValue=SendMessage(hwndListEdit,LB_GETITEMDATA,i,0);
+ if (setting[iEditItem].dbType==DBVT_ASCIIZ)
+ {
+ char *szNewValue = (((ListTypeDataItem*)setting[iEditItem].pList)[i].szValue);
+ if(newValue || setting[iEditItem].displayType&LIF_ZEROISVALID)
+ {
+ setting[iEditItem].changed=strcmpnull(szNewValue,(char*)setting[iEditItem].value);
+ SAFE_FREE((char**)&setting[iEditItem].value);
+ setting[iEditItem].value=(LPARAM)null_strdup(szNewValue);
+ }
+ else
+ {
+ setting[iEditItem].changed=(char*)setting[iEditItem].value!=NULL;
+ SAFE_FREE((char**)&setting[iEditItem].value);
+ }
+ }
+ else
+ {
+ setting[iEditItem].changed=newValue!=setting[iEditItem].value;
+ setting[iEditItem].value=newValue;
+ }
+ if (setting[iEditItem].changed) EnableDlgItem(GetParent(hwndList), IDC_SAVE, TRUE);
+ }
+ ListView_RedrawItems(hwndList, iEditItem, iEditItem);
+ iEditItem = -1;
+ DestroyWindow(hwndListEdit);
+ hwndListEdit = NULL;
+}
+
+
+
+int IsListEditWindow(HWND hwnd)
+{
+ if (hwnd == hwndListEdit) return 1;
+ return 0;
+}
diff --git a/icqj_mod/changeinfo/editstring.c b/icqj_mod/changeinfo/editstring.c new file mode 100644 index 0000000..0cb2438 --- /dev/null +++ b/icqj_mod/changeinfo/editstring.c @@ -0,0 +1,362 @@ +// ---------------------------------------------------------------------------80
+// ICQ plugin for Miranda Instant Messenger
+// ________________________________________
+//
+// Copyright 2001,2002,2003,2004 Richard Hughes, Martin berg
+// Copyright 2004,2005,2006 Joe Kucera, Bio
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+// -----------------------------------------------------------------------------
+//
+// File name : $Source: /cvsroot/miranda/miranda/protocols/IcqOscarJ/changeinfo/editstring.c,v $
+// Revision : $Revision: 3177 $
+// Last change on : $Date: 2006-06-20 03:48:02 +0400 $
+// Last change by : $Author: jokusoftware $
+//
+// DESCRIPTION:
+//
+// ChangeInfo Plugin stuff
+//
+// -----------------------------------------------------------------------------
+
+#include "icqoscar.h"
+
+
+static WNDPROC OldStringEditProc,OldExpandButtonProc;
+static HWND hwndEdit=NULL,hwndExpandButton=NULL,hwndUpDown=NULL;
+
+static const char escapes[]={'a','\a',
+ 'b','\b',
+ 'e',27,
+ 'f','\f',
+ 'r','\r',
+ 't','\t',
+ 'v','\v',
+ '\\','\\'};
+
+static void EscapesToMultiline(wchar_t *str,PDWORD selStart,PDWORD selEnd)
+{ //converts "\\n" and "\\t" to "\r\n" and "\t" because a multi-line edit box can show them properly
+ DWORD i;
+
+ for(i=0; *str; str++, i++)
+ {
+ if (*str != '\\') continue;
+ if (str[1] == 'n')
+ {
+ *str++ = '\r';
+ i++;
+ *str = '\n';
+ }
+ else if (str[1] == 't')
+ {
+ *str = '\t';
+ memmove(str+1, str+2, sizeof(wchar_t)*(wcslen(str)-1));
+
+ if (*selStart>i) --*selStart;
+ if (*selEnd>i) --*selEnd;
+ }
+ }
+}
+
+
+
+static void EscapesToBinary(char *str)
+{
+ int i;
+
+ for(;*str;str++)
+ {
+ if(*str!='\\') continue;
+ if(str[1]=='n') {*str++='\r'; i++; *str='\n'; continue;}
+ if(str[1]=='0')
+ {
+ char *codeend;
+ *str=(char)strtol(str+1,&codeend,8);
+ if(*str==0) {*str='\\'; continue;}
+ memmove(str+1,codeend,strlennull(codeend)+1);
+ continue;
+ }
+ for(i=0;i<sizeof(escapes)/sizeof(escapes[0]);i+=2)
+ if(str[1]==escapes[i])
+ {
+ *str=escapes[i+1];
+ memmove(str+1,str+2,strlennull(str)-1);
+ break;
+ }
+ }
+}
+
+
+
+char *BinaryToEscapes(char *str)
+{
+ int extra=10,len=strlennull(str)+11,i;
+ char *out,*pout;
+
+ out=pout=(char*)SAFE_MALLOC(len);
+ for(;*str;str++)
+ {
+ if((unsigned char)*str>=' ')
+ {
+ *pout++=*str;
+ continue;
+ }
+ if(str[0]=='\r' && str[1]=='\n')
+ {
+ *pout++='\\';
+ *pout++='n';
+ str++;
+ continue;
+ }
+ if(extra<3)
+ {
+ extra+=8; len+=8;
+ pout=out=(char*)realloc(out,len);
+ }
+ *pout++='\\';
+ for(i=0;i<sizeof(escapes)/sizeof(escapes[0]);i+=2)
+ if(*str==escapes[i+1])
+ {
+ *pout++=escapes[i];
+ extra--;
+ break;
+ }
+ if(i<sizeof(escapes)/sizeof(escapes[0])) continue;
+ *pout++='0'; extra--;
+ if(*str>=8)
+ {
+ *pout++=(*str>>3)+'0';
+ extra--;
+ }
+ *pout++=(*str&7)+'0'; extra--;
+ }
+ *pout='\0';
+ return out;
+}
+
+
+
+static LRESULT CALLBACK StringEditSubclassProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
+{
+ switch(msg)
+ {
+ case WM_KEYDOWN:
+ if(wParam==VK_ESCAPE)
+ {
+ EndStringEdit(0);
+ return 0;
+ }
+ if(wParam==VK_RETURN)
+ {
+ if(GetWindowLong(hwnd,GWL_STYLE)&ES_MULTILINE && !(GetKeyState(VK_CONTROL)&0x8000)) break;
+ EndStringEdit(1);
+ return 0;
+ }
+ break;
+ case WM_GETDLGCODE:
+ return DLGC_WANTALLKEYS|CallWindowProcUtf(OldStringEditProc,hwnd,msg,wParam,lParam);
+ case WM_KILLFOCUS:
+ if((HWND)wParam==hwndExpandButton) break;
+ EndStringEdit(1);
+ return 0;
+ }
+ return CallWindowProcUtf(OldStringEditProc,hwnd,msg,wParam,lParam);
+}
+
+
+
+static LRESULT CALLBACK ExpandButtonSubclassProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
+{
+ switch(msg)
+ {
+ case WM_LBUTTONUP:
+ if(GetCapture()==hwnd)
+ {
+ //do expand
+ RECT rcStart,rcEnd;
+ DWORD selStart,selEnd;
+ wchar_t *text;
+ BOOL animEnabled=TRUE;
+
+ GetWindowRect(hwndEdit,&rcStart);
+ InflateRect(&rcStart,2,2);
+
+ text = GetWindowTextUcs(hwndEdit);
+ SendMessage(hwndEdit,EM_GETSEL,(WPARAM)&selStart,(LPARAM)&selEnd);
+ DestroyWindow(hwndEdit);
+ EscapesToMultiline(text,&selStart,&selEnd);
+ hwndEdit=CreateWindowEx(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);
+ OldStringEditProc=(WNDPROC)SetWindowLongUtf(hwndEdit,GWL_WNDPROC,(LONG)StringEditSubclassProc);
+ SendMessage(hwndEdit,WM_SETFONT,(WPARAM)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(;;)
+ {
+ 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);
+ }
+ }
+ SetWindowPos(hwndEdit,0,rcEnd.left,rcEnd.top,rcEnd.right-rcEnd.left,rcEnd.bottom-rcEnd.top,SWP_NOZORDER);
+
+ DestroyWindow(hwnd);
+ hwndExpandButton=NULL;
+
+ SAFE_FREE(&text);
+ }
+ break;
+ }
+ return CallWindowProcUtf(OldExpandButtonProc,hwnd,msg,wParam,lParam);
+}
+
+
+
+void BeginStringEdit(int iItem,RECT *rc,int i,WORD wVKey)
+{
+ char *szValue;
+ char str[80];
+ int alloced=0;
+
+ EndStringEdit(0);
+ InflateRect(rc,-2,-2);
+ rc->left-=2;
+ if(setting[i].displayType&LIF_PASSWORD && !setting[i].changed)
+ szValue=" ";
+ else if ((setting[i].displayType&LIM_TYPE)==LI_NUMBER)
+ {
+ szValue=str;
+ wsprintf(str,"%d",setting[i].value);
+ }
+ else if(setting[i].value)
+ {
+ szValue=BinaryToEscapes((char*)setting[i].value);
+ alloced=1;
+ }
+ else szValue="";
+ iEditItem=iItem;
+
+ if ((setting[i].displayType&LIM_TYPE)==LI_LONGSTRING)
+ {
+ rc->right-=rc->bottom-rc->top;
+ hwndExpandButton=CreateWindow("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));
+ OldExpandButtonProc=(WNDPROC)SetWindowLongUtf(hwndExpandButton,GWL_WNDPROC,(LONG)ExpandButtonSubclassProc);
+ }
+
+ hwndEdit=CreateWindow("EDIT","",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);
+ SetWindowTextUtf(hwndEdit, szValue);
+ if (alloced) SAFE_FREE(&szValue);
+ OldStringEditProc=(WNDPROC)SetWindowLongUtf(hwndEdit,GWL_WNDPROC,(LONG)StringEditSubclassProc);
+ SendMessage(hwndEdit,WM_SETFONT,(WPARAM)hListFont,0);
+ if ((setting[i].displayType&LIM_TYPE)==LI_NUMBER)
+ {
+ int *range=(int*)setting[i].pList;
+ RECT rcUpDown;
+ hwndUpDown=CreateWindow(UPDOWN_CLASS,"",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,setting[i].value);
+ if(!(setting[i].displayType&LIF_ZEROISVALID) && setting[i].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);
+ }
+ SendMessage(hwndEdit,EM_SETSEL,0,(LPARAM)-1);
+ SetFocus(hwndEdit);
+ PostMessage(hwndEdit,WM_KEYDOWN,wVKey,0);
+}
+
+
+
+void EndStringEdit(int save)
+{
+ if (hwndEdit == NULL || iEditItem == -1) return;
+ if (save)
+ {
+ char *text = NULL;
+
+ text=(char*)SAFE_MALLOC(GetWindowTextLength(hwndEdit)+1);
+ GetWindowText(hwndEdit,text,GetWindowTextLength(hwndEdit)+1);
+ EscapesToBinary(text);
+ if((setting[iEditItem].displayType&LIM_TYPE)==LI_NUMBER)
+ {
+ LPARAM newValue;
+ int *range=(int*)setting[iEditItem].pList;
+ newValue=atoi(text);
+ if(newValue)
+ {
+ if(newValue<range[0]) newValue=range[0];
+ if(newValue>range[1]) newValue=range[1];
+ }
+ setting[iEditItem].changed=setting[iEditItem].value!=newValue;
+ setting[iEditItem].value=newValue;
+ SAFE_FREE(&text);
+ }
+ else
+ {
+ if (!(setting[iEditItem].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*)setting[iEditItem].value) && (strlennull(text) + strlennull((char*)setting[iEditItem].value))))
+ {
+ SAFE_FREE((char**)&setting[iEditItem].value);
+ if (text[0])
+ setting[iEditItem].value=(LPARAM)text;
+ else
+ {
+ setting[iEditItem].value=0;
+ SAFE_FREE(&text);
+ }
+ setting[iEditItem].changed=1;
+ }
+ }
+ if (setting[iEditItem].changed) EnableDlgItem(GetParent(hwndList), IDC_SAVE, TRUE);
+ }
+ ListView_RedrawItems(hwndList, iEditItem, iEditItem);
+ iEditItem = -1;
+ DestroyWindow(hwndEdit);
+ hwndEdit = NULL;
+ if (hwndExpandButton) DestroyWindow(hwndExpandButton);
+ hwndExpandButton = NULL;
+ if (hwndUpDown) DestroyWindow(hwndUpDown);
+ hwndUpDown = NULL;
+}
+
+
+
+int IsStringEditWindow(HWND hwnd)
+{
+ if (hwnd == hwndEdit) return 1;
+ if (hwnd == hwndExpandButton) return 1;
+ if (hwnd == hwndUpDown) return 1;
+ return 0;
+}
diff --git a/icqj_mod/changeinfo/expandst.ico b/icqj_mod/changeinfo/expandst.ico Binary files differnew file mode 100644 index 0000000..17367fe --- /dev/null +++ b/icqj_mod/changeinfo/expandst.ico diff --git a/icqj_mod/changeinfo/main.c b/icqj_mod/changeinfo/main.c new file mode 100644 index 0000000..44c3307 --- /dev/null +++ b/icqj_mod/changeinfo/main.c @@ -0,0 +1,54 @@ +// ---------------------------------------------------------------------------80
+// ICQ plugin for Miranda Instant Messenger
+// ________________________________________
+//
+// Copyright 2001,2002,2003,2004 Richard Hughes, Martin berg
+// Copyright 2004,2005,2006 Joe Kucera, Bio
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+// -----------------------------------------------------------------------------
+//
+// File name : $Source: /cvsroot/miranda/miranda/protocols/IcqOscarJ/changeinfo/main.c,v $
+// Revision : $Revision: 2874 $
+// Last change on : $Date: 2006-05-17 01:38:00 +0400 $
+// Last change by : $Author: ghazan $
+//
+// DESCRIPTION:
+//
+// ChangeInfo Plugin stuff
+//
+// -----------------------------------------------------------------------------
+
+#include "icqoscar.h"
+
+
+int InitChangeDetails(WPARAM wParam, LPARAM lParam)
+{
+ OPTIONSDIALOGPAGE odp = {0};
+
+ if (lParam) return 0;
+
+ odp.cbSize = sizeof(odp);
+ odp.hIcon = NULL;
+ odp.hInstance = hInst;
+ odp.position = -1899999999;
+ odp.pszTemplate = MAKEINTRESOURCE(IDD_INFO_CHANGEINFO);
+ odp.pfnDlgProc = ChangeInfoDlgProc;
+
+ AddUserInfoPageUtf(&odp, wParam, "%s Details");
+
+ return 0;
+}
diff --git a/icqj_mod/changeinfo/upload.c b/icqj_mod/changeinfo/upload.c new file mode 100644 index 0000000..a771894 --- /dev/null +++ b/icqj_mod/changeinfo/upload.c @@ -0,0 +1,204 @@ +// ---------------------------------------------------------------------------80
+// ICQ plugin for Miranda Instant Messenger
+// ________________________________________
+//
+// Copyright 2001,2002,2003,2004 Richard Hughes, Martin berg
+// Copyright 2004,2005,2006 Joe Kucera, Bio
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+// -----------------------------------------------------------------------------
+//
+// File name : $Source: /cvsroot/miranda/miranda/protocols/IcqOscarJ/changeinfo/upload.c,v $
+// Revision : $Revision: 2991 $
+// Last change on : $Date: 2006-05-30 21:55:48 +0400 $
+// Last change by : $Author: jokusoftware $
+//
+// DESCRIPTION:
+//
+// ChangeInfo Plugin stuff
+//
+// -----------------------------------------------------------------------------
+
+#include "icqoscar.h"
+
+
+
+int StringToListItemId(const char *szSetting,int def)
+{
+ int i,listCount;
+ char szTmp[256];
+ ListTypeDataItem *list;
+
+ for(i=0;i<settingCount;i++)
+ if(!strcmpnull(szSetting,setting[i].szDbSetting))
+ break;
+
+ if(i==settingCount) return def;
+
+ list=(ListTypeDataItem*)setting[i].pList;
+ listCount=setting[i].listCount;
+
+ if(ICQGetContactStaticString(NULL, szSetting, szTmp, sizeof(szTmp)))
+ return def;
+
+ for(i=0;i<listCount;i++)
+ if(!strcmpnull(list[i].szValue, szTmp)) break;
+
+ if(i==listCount) return def;
+
+ return list[i].id;
+}
+
+
+
+int UploadSettings(HWND hwndParent)
+{
+ PBYTE buf = NULL;
+ int buflen = 0;
+/* BYTE b;
+ WORD w;*/
+
+ if (!icqOnline)
+ {
+ char str[1024],cap[MAX_PATH];
+
+ MessageBoxUtf(hwndParent, ICQTranslateUtfStatic("You are not currently connected to the ICQ network. You must be online in order to update your information on the server.", str), ICQTranslateUtfStatic("Change ICQ Details", cap), MB_OK);
+ return 0;
+ }
+
+/* // userinfo
+ ppackTLVWord(&buf, &buflen, (WORD)GetACP(), TLV_CODEPAGE, 0);
+
+ b = !ICQGetContactSettingByte(NULL, "PublishPrimaryEmail", 0);
+ ppackTLVLNTSBytefromDB(&buf, &buflen, "e-mail", b, TLV_EMAIL);
+ ppackTLVLNTSBytefromDB(&buf, &buflen, "e-mail0", 0, TLV_EMAIL);
+ ppackTLVLNTSBytefromDB(&buf, &buflen, "e-mail1", 0, TLV_EMAIL);
+
+ ppackTLVByte(&buf, &buflen, ICQGetContactSettingByte(NULL, "AllowSpam", 0), TLV_ALLOWSPAM, 1);
+
+ ppackTLVLNTSfromDB(&buf, &buflen, "Phone", TLV_PHONE);
+ ppackTLVLNTSfromDB(&buf, &buflen, "Fax", TLV_FAX);
+ ppackTLVLNTSfromDB(&buf, &buflen, "Cellular", TLV_MOBILE);
+ ppackTLVLNTSfromDB(&buf, &buflen, "CompanyPhone", TLV_WORKPHONE);
+ ppackTLVLNTSfromDB(&buf, &buflen, "CompanyFax", TLV_WORKFAX);
+
+ ppackTLVLNTSfromDB(&buf, &buflen, "Nick", TLV_NICKNAME);
+ ppackTLVLNTSfromDB(&buf, &buflen, "FirstName", TLV_FIRSTNAME);
+ ppackTLVLNTSfromDB(&buf, &buflen, "LastName", TLV_LASTNAME);
+ ppackTLVLNTSfromDB(&buf, &buflen, "About", TLV_ABOUT);
+
+ ppackTLVWord(&buf, &buflen, ICQGetContactSettingWord(NULL, "Age", 0), TLV_AGE, 1);
+ b = ICQGetContactSettingByte(NULL, "Gender", 0);
+ ppackTLVByte(&buf, &buflen, (BYTE)(b ? (b == 'M' ? 2 : 1) : 0), TLV_GENDER, 1);
+ ppackLEWord(&buf, &buflen, TLV_BIRTH);
+ ppackLEWord(&buf, &buflen, 0x06);
+ ppackLEWord(&buf, &buflen, ICQGetContactSettingWord(NULL, "BirthYear", 0));
+ ppackLEWord(&buf, &buflen, (WORD)ICQGetContactSettingByte(NULL, "BirthMonth", 0));
+ ppackLEWord(&buf, &buflen, (WORD)ICQGetContactSettingByte(NULL, "BirthDay", 0));
+
+ ppackTLVWord(&buf, &buflen, (WORD)StringToListItemId("Language1", 0), TLV_LANGUAGE, 1);
+ ppackTLVWord(&buf, &buflen, (WORD)StringToListItemId("Language2", 0), TLV_LANGUAGE, 1);
+ ppackTLVWord(&buf, &buflen, (WORD)StringToListItemId("Language3", 0), TLV_LANGUAGE, 1);
+
+ ppackTLVLNTSfromDB(&buf, &buflen, "CompanyDepartment", TLV_DEPARTMENT);
+ ppackTLVLNTSfromDB(&buf, &buflen, "CompanyPosition", TLV_POSITION);
+ ppackTLVLNTSfromDB(&buf, &buflen, "Company", TLV_COMPANY);
+ ppackTLVLNTSfromDB(&buf, &buflen, "CompanyStreet", TLV_WORKSTREET);
+ ppackTLVLNTSfromDB(&buf, &buflen, "CompanyState", TLV_WORKSTATE);
+ ppackTLVLNTSfromDB(&buf, &buflen, "CompanyCity", TLV_WORKCITY);
+ ppackTLVLNTSfromDB(&buf, &buflen, "CompanyHomepage", TLV_WORKURL);
+ ppackTLVLNTSfromDB(&buf, &buflen, "CompanyZIP", TLV_WORKZIPCODE);
+ ppackTLVWord(&buf, &buflen, ICQGetContactSettingWord(NULL, "CompanyCountry", 0), TLV_WORKCOUNTRY, 1);
+ ppackTLVWord(&buf, &buflen, ICQGetContactSettingWord(NULL, "CompanyOccupation", 0), TLV_OCUPATION, 1);
+
+ ppackTLVLNTSfromDB(&buf, &buflen, "City", TLV_CITY);
+ ppackTLVLNTSfromDB(&buf, &buflen, "State", TLV_STATE);
+ ppackTLVWord(&buf, &buflen, ICQGetContactSettingWord(NULL, "Country", 0), TLV_COUNTRY, 1);
+ ppackTLVLNTSfromDB(&buf, &buflen, "OriginCity", TLV_ORGCITY);
+ ppackTLVLNTSfromDB(&buf, &buflen, "OriginState", TLV_ORGSTATE);
+ ppackTLVWord(&buf, &buflen, ICQGetContactSettingWord(NULL, "OriginCountry", 0), TLV_ORGCOUNTRY, 1);
+ ppackTLVLNTSfromDB(&buf, &buflen, "Street", TLV_STREET);
+ ppackTLVLNTSfromDB(&buf, &buflen, "ZIP", TLV_ZIPCODE);
+
+ ppackTLVLNTSfromDB(&buf, &buflen, "Homepage", TLV_URL);
+
+ ppackTLVByte(&buf, &buflen, ICQGetContactSettingByte(NULL, "Timezone", 0), TLV_TIMEZONE, 1);
+
+ ppackTLVByte(&buf, &buflen, ICQGetContactSettingByte(NULL, "MaritalStatus", 0), TLV_MARITAL, 1);
+
+ w = StringToListItemId("Interest0Cat", 0);
+ ppackTLVWordLNTSfromDB(&buf, &buflen, w, "Interest0Text", TLV_INTERESTS);
+ w = StringToListItemId("Interest1Cat", 0);
+ ppackTLVWordLNTSfromDB(&buf, &buflen, w, "Interest1Text", TLV_INTERESTS);
+ w = StringToListItemId("Interest2Cat", 0);
+ ppackTLVWordLNTSfromDB(&buf, &buflen, w, "Interest2Text", TLV_INTERESTS);
+ w = StringToListItemId("Interest3Cat", 0);
+ ppackTLVWordLNTSfromDB(&buf, &buflen, w, "Interest3Text", TLV_INTERESTS);
+
+ w = StringToListItemId("Past0", 0);
+ ppackTLVWordLNTSfromDB(&buf, &buflen, w, "Past0Text", TLV_PASTINFO);
+ w = StringToListItemId("Past1", 0);
+ ppackTLVWordLNTSfromDB(&buf, &buflen, w, "Past1Text", TLV_PASTINFO);
+ w = StringToListItemId("Past2", 0);
+ ppackTLVWordLNTSfromDB(&buf, &buflen, w, "Past2Text", TLV_PASTINFO);
+
+ w = StringToListItemId("Affiliation0", 0);
+ ppackTLVWordLNTSfromDB(&buf, &buflen, w, "Affiliation0Text", TLV_AFFILATIONS);
+ w = StringToListItemId("Affiliation1", 0);
+ ppackTLVWordLNTSfromDB(&buf, &buflen, w, "Affiliation1Text", TLV_AFFILATIONS);
+ w = StringToListItemId("Affiliation2", 0);
+ ppackTLVWordLNTSfromDB(&buf, &buflen, w, "Affiliation2Text", TLV_AFFILATIONS);
+
+ hUpload[0] = (HANDLE)icq_changeUserDetailsServ(META_SET_FULLINFO_REQ, buf, (WORD)buflen);*/
+ hUpload[0] = (HANDLE)IcqChangeInfoEx(CIXT_FULL, 0);
+
+ //password
+ {
+ char* tmp;
+
+ tmp = GetUserPassword(TRUE);
+ if(tmp)
+ {
+ if (strlennull(Password) > 0 && strcmpnull(Password, tmp))
+ {
+ buflen = 0; // re-init buffer
+
+ ppackLELNTS(&buf, &buflen, tmp);
+
+ hUpload[1] = (HANDLE)icq_changeUserDetailsServ(META_SET_PASSWORD_REQ, buf, (WORD)buflen);
+
+ {
+ char szPwd[16] = {0};
+
+ if (!ICQGetContactStaticString(NULL, "Password", szPwd, 16) && strlennull(szPwd))
+ { // password is stored in DB, update
+ char ptmp[16];
+
+ strcpy(ptmp, tmp);
+
+ CallService(MS_DB_CRYPT_ENCODESTRING, sizeof(ptmp), (LPARAM)ptmp);
+
+ ICQWriteContactSettingString(NULL, "Password", ptmp);
+ }
+ }
+ }
+ }
+ }
+
+ SAFE_FREE(&buf);
+
+ return 1;
+}
|