diff options
| author | dartraiden <wowemuh@gmail.com> | 2023-01-02 21:10:29 +0300 |
|---|---|---|
| committer | dartraiden <wowemuh@gmail.com> | 2023-01-02 21:10:29 +0300 |
| commit | 1979fd80424d16b2e489f9b57d01d9c7811d25a2 (patch) | |
| tree | 960d42c5fe4a51f0fe2850bea91256e226bce221 /src/core/stduserinfo | |
| parent | adfbbb217d4f4a05acf198755f219a5223d31c27 (diff) | |
Update copyrights
Diffstat (limited to 'src/core/stduserinfo')
| -rw-r--r-- | src/core/stduserinfo/src/contactinfo.cpp | 2 | ||||
| -rw-r--r-- | src/core/stduserinfo/src/main.cpp | 2 | ||||
| -rw-r--r-- | src/core/stduserinfo/src/stdafx.h | 2 | ||||
| -rw-r--r-- | src/core/stduserinfo/src/stdinfo.cpp | 2 | ||||
| -rw-r--r-- | src/core/stduserinfo/src/userinfo.cpp | 2 | ||||
| -rw-r--r-- | src/core/stduserinfo/src/utils.h | 428 | ||||
| -rw-r--r-- | src/core/stduserinfo/src/version.h | 2 |
7 files changed, 220 insertions, 220 deletions
diff --git a/src/core/stduserinfo/src/contactinfo.cpp b/src/core/stduserinfo/src/contactinfo.cpp index a19783e4df..7adec4c09b 100644 --- a/src/core/stduserinfo/src/contactinfo.cpp +++ b/src/core/stduserinfo/src/contactinfo.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-22 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-23 Miranda NG team (https://miranda-ng.org),
Copyright (c) 2000-12 Miranda IM project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
diff --git a/src/core/stduserinfo/src/main.cpp b/src/core/stduserinfo/src/main.cpp index 5334c9727f..9bd9b6f7be 100644 --- a/src/core/stduserinfo/src/main.cpp +++ b/src/core/stduserinfo/src/main.cpp @@ -2,7 +2,7 @@ Standard User Info plugin for Miranda NG
-Copyright (C) 2012-22 Miranda NG team (https://miranda-ng.org)
+Copyright (C) 2012-23 Miranda NG team (https://miranda-ng.org)
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
diff --git a/src/core/stduserinfo/src/stdafx.h b/src/core/stduserinfo/src/stdafx.h index 76b456e716..ca5412f200 100644 --- a/src/core/stduserinfo/src/stdafx.h +++ b/src/core/stduserinfo/src/stdafx.h @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-22 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-23 Miranda NG team (https://miranda-ng.org),
Copyright (c) 2000-12 Miranda IM project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
diff --git a/src/core/stduserinfo/src/stdinfo.cpp b/src/core/stduserinfo/src/stdinfo.cpp index 5acec2d245..ca3b2edd20 100644 --- a/src/core/stduserinfo/src/stdinfo.cpp +++ b/src/core/stduserinfo/src/stdinfo.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-22 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-23 Miranda NG team (https://miranda-ng.org),
Copyright (c) 2000-12 Miranda IM project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
diff --git a/src/core/stduserinfo/src/userinfo.cpp b/src/core/stduserinfo/src/userinfo.cpp index 9448d5c96f..30792d9244 100644 --- a/src/core/stduserinfo/src/userinfo.cpp +++ b/src/core/stduserinfo/src/userinfo.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-22 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-23 Miranda NG team (https://miranda-ng.org),
Copyright (c) 2000-12 Miranda IM project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
diff --git a/src/core/stduserinfo/src/utils.h b/src/core/stduserinfo/src/utils.h index cb766c47ae..9ceb33b61d 100644 --- a/src/core/stduserinfo/src/utils.h +++ b/src/core/stduserinfo/src/utils.h @@ -1,214 +1,214 @@ -/* - -Standard User Info plugin for Miranda NG - -Copyright (C) 2012-22 Miranda NG team (https://miranda-ng.org) - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along -with this program; if not, write to the Free Software Foundation, Inc., -51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ - -#define SVS_NORMAL 0 -#define SVS_GENDER 1 -#define SVS_ZEROISUNSPEC 2 -#define SVS_IP 3 -#define SVS_COUNTRY 4 -#define SVS_MONTH 5 -#define SVS_SIGNED 6 -#define SVS_TIMEZONE 7 -#define SVS_MARITAL 8 - -///////////////////////////////////////////////////////////////////////////////////////// - -struct DataItem -{ - const char *szSetting; - int idCtrl, special; -}; - -template <size_t _Size> -bool IsEmptyValue(MCONTACT hContact, DataItem(&buffer)[_Size], const char *szModule = nullptr) -{ - if (szModule == nullptr) - szModule = Proto_GetBaseAccountName(hContact); - - DBVARIANT dbv; - for (auto &it : buffer) { - if (db_get_s(hContact, szModule, it.szSetting, &dbv, 0) != 0) - continue; - - db_free(&dbv); - return false; - } - - return true; -} - -template <size_t _Size> -void SetValue(HWND hwndDlg, MCONTACT hContact, DataItem(&buffer)[_Size], const char *szModule = nullptr) -{ - if (szModule == nullptr) - szModule = Proto_GetBaseAccountName(hContact); - - for (auto &it : buffer) { - char *pstr = nullptr; - wchar_t *pwstr = nullptr, wstr[80]; - - DBVARIANT dbv = { DBVT_DELETED }; - - bool unspecified; - if (szModule == nullptr) - unspecified = true; - else - unspecified = db_get_s(hContact, szModule, it.szSetting, &dbv, 0) != 0; - - if (!unspecified) { - switch (dbv.type) { - case DBVT_BYTE: - if (it.special == SVS_GENDER) { - if (dbv.cVal == 'M') pwstr = TranslateT("Male"); - else if (dbv.cVal == 'F') pwstr = TranslateT("Female"); - else unspecified = 1; - } - else if (it.special == SVS_MONTH) { - if (dbv.bVal > 0 && dbv.bVal <= 12) { - pwstr = wstr; - GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SABBREVMONTHNAME1 - 1 + dbv.bVal, wstr, _countof(wstr)); - } - else unspecified = 1; - } - else if (it.special == SVS_TIMEZONE) { - if (dbv.cVal == -100) unspecified = 1; - else { - pwstr = wstr; - mir_snwprintf(wstr, dbv.cVal ? L"UTC%+d:%02d" : L"UTC", -dbv.cVal / 2, (dbv.cVal & 1) * 30); - } - } - else if (it.special == SVS_MARITAL) { - switch (dbv.cVal) { - case 0: - pwstr = TranslateT("<not specified>"); - break; - case 10: - pwstr = TranslateT("Single"); - break; - case 11: - pwstr = TranslateT("Close relationships"); - break; - case 12: - pwstr = TranslateT("Engaged"); - break; - case 20: - pwstr = TranslateT("Married"); - break; - case 30: - pwstr = TranslateT("Divorced"); - break; - case 31: - pwstr = TranslateT("Separated"); - break; - case 40: - pwstr = TranslateT("Widowed"); - break; - case 50: - pwstr = TranslateT("Actively searching"); - break; - case 60: - pwstr = TranslateT("In love"); - break; - case 70: - pwstr = TranslateT("It's complicated"); - break; - case 80: - pwstr = TranslateT("In a civil union"); - break; - default: - unspecified = 1; - } - } - else { - unspecified = (it.special == SVS_ZEROISUNSPEC && dbv.bVal == 0); - pwstr = _itow(it.special == SVS_SIGNED ? dbv.cVal : dbv.bVal, wstr, 10); - } - break; - - case DBVT_WORD: - if (it.special == SVS_COUNTRY) { - uint16_t wSave = dbv.wVal; - if (wSave == (uint16_t)-1) { - char szSettingName[100]; - mir_snprintf(szSettingName, "%sName", it.szSetting); - if (!db_get_ws(hContact, szModule, szSettingName, &dbv)) { - pwstr = dbv.pwszVal; - unspecified = false; - break; - } - } - - pwstr = TranslateW(_A2T((char *)CallService(MS_UTILS_GETCOUNTRYBYNUMBER, wSave, 0))); - unspecified = pwstr == nullptr; - } - else { - unspecified = (it.special == SVS_ZEROISUNSPEC && dbv.wVal == 0); - pwstr = _itow(it.special == SVS_SIGNED ? dbv.sVal : dbv.wVal, wstr, 10); - } - break; - - case DBVT_DWORD: - unspecified = (it.special == SVS_ZEROISUNSPEC && dbv.dVal == 0); - if (it.special == SVS_IP) { - struct in_addr ia; - ia.S_un.S_addr = htonl(dbv.dVal); - mir_wstrncpy(wstr, _A2T(inet_ntoa(ia)), _countof(wstr)); - pwstr = wstr; - if (dbv.dVal == 0) - unspecified = 1; - } - else pwstr = _itow(it.special == SVS_SIGNED ? dbv.lVal : dbv.dVal, wstr, 10); - break; - - case DBVT_ASCIIZ: - unspecified = (it.special == SVS_ZEROISUNSPEC && dbv.pszVal[0] == '\0'); - pstr = dbv.pszVal; - break; - - case DBVT_UTF8: - unspecified = (it.special == SVS_ZEROISUNSPEC && dbv.pszVal[0] == '\0'); - if (!unspecified) { - SetDlgItemTextW(hwndDlg, it.idCtrl, TranslateW(ptrW(mir_utf8decodeW(dbv.pszVal)))); - goto LBL_Exit; - } - - mir_utf8decode(dbv.pszVal, &pwstr); - break; - - default: - pwstr = wstr; - mir_wstrcpy(wstr, L"???"); - break; - } - } - - if (unspecified) - SetDlgItemText(hwndDlg, it.idCtrl, TranslateT("<not specified>")); - else if (pwstr != nullptr) - SetDlgItemText(hwndDlg, it.idCtrl, pwstr); - else - SetDlgItemTextA(hwndDlg, it.idCtrl, pstr); - -LBL_Exit: - EnableWindow(GetDlgItem(hwndDlg, it.idCtrl), !unspecified); - db_free(&dbv); - } -} +/*
+
+Standard User Info plugin for Miranda NG
+
+Copyright (C) 2012-23 Miranda NG team (https://miranda-ng.org)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
+
+#define SVS_NORMAL 0
+#define SVS_GENDER 1
+#define SVS_ZEROISUNSPEC 2
+#define SVS_IP 3
+#define SVS_COUNTRY 4
+#define SVS_MONTH 5
+#define SVS_SIGNED 6
+#define SVS_TIMEZONE 7
+#define SVS_MARITAL 8
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+struct DataItem
+{
+ const char *szSetting;
+ int idCtrl, special;
+};
+
+template <size_t _Size>
+bool IsEmptyValue(MCONTACT hContact, DataItem(&buffer)[_Size], const char *szModule = nullptr)
+{
+ if (szModule == nullptr)
+ szModule = Proto_GetBaseAccountName(hContact);
+
+ DBVARIANT dbv;
+ for (auto &it : buffer) {
+ if (db_get_s(hContact, szModule, it.szSetting, &dbv, 0) != 0)
+ continue;
+
+ db_free(&dbv);
+ return false;
+ }
+
+ return true;
+}
+
+template <size_t _Size>
+void SetValue(HWND hwndDlg, MCONTACT hContact, DataItem(&buffer)[_Size], const char *szModule = nullptr)
+{
+ if (szModule == nullptr)
+ szModule = Proto_GetBaseAccountName(hContact);
+
+ for (auto &it : buffer) {
+ char *pstr = nullptr;
+ wchar_t *pwstr = nullptr, wstr[80];
+
+ DBVARIANT dbv = { DBVT_DELETED };
+
+ bool unspecified;
+ if (szModule == nullptr)
+ unspecified = true;
+ else
+ unspecified = db_get_s(hContact, szModule, it.szSetting, &dbv, 0) != 0;
+
+ if (!unspecified) {
+ switch (dbv.type) {
+ case DBVT_BYTE:
+ if (it.special == SVS_GENDER) {
+ if (dbv.cVal == 'M') pwstr = TranslateT("Male");
+ else if (dbv.cVal == 'F') pwstr = TranslateT("Female");
+ else unspecified = 1;
+ }
+ else if (it.special == SVS_MONTH) {
+ if (dbv.bVal > 0 && dbv.bVal <= 12) {
+ pwstr = wstr;
+ GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SABBREVMONTHNAME1 - 1 + dbv.bVal, wstr, _countof(wstr));
+ }
+ else unspecified = 1;
+ }
+ else if (it.special == SVS_TIMEZONE) {
+ if (dbv.cVal == -100) unspecified = 1;
+ else {
+ pwstr = wstr;
+ mir_snwprintf(wstr, dbv.cVal ? L"UTC%+d:%02d" : L"UTC", -dbv.cVal / 2, (dbv.cVal & 1) * 30);
+ }
+ }
+ else if (it.special == SVS_MARITAL) {
+ switch (dbv.cVal) {
+ case 0:
+ pwstr = TranslateT("<not specified>");
+ break;
+ case 10:
+ pwstr = TranslateT("Single");
+ break;
+ case 11:
+ pwstr = TranslateT("Close relationships");
+ break;
+ case 12:
+ pwstr = TranslateT("Engaged");
+ break;
+ case 20:
+ pwstr = TranslateT("Married");
+ break;
+ case 30:
+ pwstr = TranslateT("Divorced");
+ break;
+ case 31:
+ pwstr = TranslateT("Separated");
+ break;
+ case 40:
+ pwstr = TranslateT("Widowed");
+ break;
+ case 50:
+ pwstr = TranslateT("Actively searching");
+ break;
+ case 60:
+ pwstr = TranslateT("In love");
+ break;
+ case 70:
+ pwstr = TranslateT("It's complicated");
+ break;
+ case 80:
+ pwstr = TranslateT("In a civil union");
+ break;
+ default:
+ unspecified = 1;
+ }
+ }
+ else {
+ unspecified = (it.special == SVS_ZEROISUNSPEC && dbv.bVal == 0);
+ pwstr = _itow(it.special == SVS_SIGNED ? dbv.cVal : dbv.bVal, wstr, 10);
+ }
+ break;
+
+ case DBVT_WORD:
+ if (it.special == SVS_COUNTRY) {
+ uint16_t wSave = dbv.wVal;
+ if (wSave == (uint16_t)-1) {
+ char szSettingName[100];
+ mir_snprintf(szSettingName, "%sName", it.szSetting);
+ if (!db_get_ws(hContact, szModule, szSettingName, &dbv)) {
+ pwstr = dbv.pwszVal;
+ unspecified = false;
+ break;
+ }
+ }
+
+ pwstr = TranslateW(_A2T((char *)CallService(MS_UTILS_GETCOUNTRYBYNUMBER, wSave, 0)));
+ unspecified = pwstr == nullptr;
+ }
+ else {
+ unspecified = (it.special == SVS_ZEROISUNSPEC && dbv.wVal == 0);
+ pwstr = _itow(it.special == SVS_SIGNED ? dbv.sVal : dbv.wVal, wstr, 10);
+ }
+ break;
+
+ case DBVT_DWORD:
+ unspecified = (it.special == SVS_ZEROISUNSPEC && dbv.dVal == 0);
+ if (it.special == SVS_IP) {
+ struct in_addr ia;
+ ia.S_un.S_addr = htonl(dbv.dVal);
+ mir_wstrncpy(wstr, _A2T(inet_ntoa(ia)), _countof(wstr));
+ pwstr = wstr;
+ if (dbv.dVal == 0)
+ unspecified = 1;
+ }
+ else pwstr = _itow(it.special == SVS_SIGNED ? dbv.lVal : dbv.dVal, wstr, 10);
+ break;
+
+ case DBVT_ASCIIZ:
+ unspecified = (it.special == SVS_ZEROISUNSPEC && dbv.pszVal[0] == '\0');
+ pstr = dbv.pszVal;
+ break;
+
+ case DBVT_UTF8:
+ unspecified = (it.special == SVS_ZEROISUNSPEC && dbv.pszVal[0] == '\0');
+ if (!unspecified) {
+ SetDlgItemTextW(hwndDlg, it.idCtrl, TranslateW(ptrW(mir_utf8decodeW(dbv.pszVal))));
+ goto LBL_Exit;
+ }
+
+ mir_utf8decode(dbv.pszVal, &pwstr);
+ break;
+
+ default:
+ pwstr = wstr;
+ mir_wstrcpy(wstr, L"???");
+ break;
+ }
+ }
+
+ if (unspecified)
+ SetDlgItemText(hwndDlg, it.idCtrl, TranslateT("<not specified>"));
+ else if (pwstr != nullptr)
+ SetDlgItemText(hwndDlg, it.idCtrl, pwstr);
+ else
+ SetDlgItemTextA(hwndDlg, it.idCtrl, pstr);
+
+LBL_Exit:
+ EnableWindow(GetDlgItem(hwndDlg, it.idCtrl), !unspecified);
+ db_free(&dbv);
+ }
+}
diff --git a/src/core/stduserinfo/src/version.h b/src/core/stduserinfo/src/version.h index 1a68b614db..441fd0cdef 100644 --- a/src/core/stduserinfo/src/version.h +++ b/src/core/stduserinfo/src/version.h @@ -8,4 +8,4 @@ #define __DESCRIPTION "Core module for providing user information."
#define __AUTHOR "Miranda NG team"
#define __AUTHORWEB "https://miranda-ng.org/p/StdUserInfo"
-#define __COPYRIGHT "© 2012-22 Miranda NG team"
+#define __COPYRIGHT "© 2012-23 Miranda NG team"
|
