diff options
Diffstat (limited to 'plugins/Weather/src/weather_addstn.cpp')
-rw-r--r-- | plugins/Weather/src/weather_addstn.cpp | 90 |
1 files changed, 45 insertions, 45 deletions
diff --git a/plugins/Weather/src/weather_addstn.cpp b/plugins/Weather/src/weather_addstn.cpp index 304f1d2641..bf999c9dea 100644 --- a/plugins/Weather/src/weather_addstn.cpp +++ b/plugins/Weather/src/weather_addstn.cpp @@ -26,7 +26,7 @@ to the contact list. Contain code for both name and ID search. // variables used for weather_addstn.c
static int sttSearchId = -1;
-static TCHAR name1[256];
+static wchar_t name1[256];
// ============ ADDING NEW STATION ============
@@ -35,7 +35,7 @@ static TCHAR name1[256]; INT_PTR WeatherAddToList(WPARAM, LPARAM lParam)
{
PROTOSEARCHRESULT *psr = (PROTOSEARCHRESULT*)lParam;
- if (!psr || !psr->email.t)
+ if (!psr || !psr->email.w)
return 0;
// search for existing contact
@@ -45,7 +45,7 @@ INT_PTR WeatherAddToList(WPARAM, LPARAM lParam) DBVARIANT dbv;
// check ID to see if the contact already exist in the database
if (!db_get_ts(hContact, WEATHERPROTONAME, "ID", &dbv)) {
- if (!mir_tstrcmpi(psr->email.t, dbv.ptszVal)) {
+ if (!mir_tstrcmpi(psr->email.w, dbv.ptszVal)) {
// remove the flag for not on list and hidden, thus make the contact visible
// and add them on the list
if (db_get_b(hContact, "CList", "NotOnList", 1)) {
@@ -69,11 +69,11 @@ INT_PTR WeatherAddToList(WPARAM, LPARAM lParam) CallService(MS_IGNORE_IGNORE, hContact, IGNOREEVENT_USERONLINE);
// set contact info and settings
- TCHAR svc[256];
- _tcsncpy(svc, psr->email.t, _countof(svc)); svc[_countof(svc) - 1] = 0;
+ wchar_t svc[256];
+ wcsncpy(svc, psr->email.w, _countof(svc)); svc[_countof(svc) - 1] = 0;
GetSvc(svc);
// set settings by obtaining the default for the service
- if (psr->lastName.t[0] != 0) {
+ if (psr->lastName.w[0] != 0) {
WIDATA *sData = GetWIData(svc);
db_set_ts(hContact, WEATHERPROTONAME, "MapURL", sData->DefaultMap);
db_set_s(hContact, WEATHERPROTONAME, "InfoURL", sData->DefaultURL);
@@ -83,14 +83,14 @@ INT_PTR WeatherAddToList(WPARAM, LPARAM lParam) db_set_s(hContact, WEATHERPROTONAME, "InfoURL", "");
}
// write the other info and settings to the database
- db_set_ts(hContact, WEATHERPROTONAME, "ID", psr->email.t);
- db_set_ts(hContact, WEATHERPROTONAME, "Nick", psr->nick.t);
+ db_set_ts(hContact, WEATHERPROTONAME, "ID", psr->email.w);
+ db_set_ts(hContact, WEATHERPROTONAME, "Nick", psr->nick.w);
db_set_w(hContact, WEATHERPROTONAME, "Status", ID_STATUS_OFFLINE);
AvatarDownloaded(hContact);
- TCHAR str[256];
- mir_sntprintf(str, TranslateT("Current weather information for %s."), psr->nick.t);
+ wchar_t str[256];
+ mir_sntprintf(str, TranslateT("Current weather information for %s."), psr->nick.w);
db_set_ts(hContact, WEATHERPROTONAME, "About", str);
// make the last update tags to something invalid
@@ -134,7 +134,7 @@ BOOL CheckSearch() // ============ BASIC ID SEARCH ============
-static TCHAR sttSID[32];
+static wchar_t sttSID[32];
// A timer process for the ID search (threaded)
static void __cdecl BasicSearchTimerProc(LPVOID)
@@ -156,7 +156,7 @@ static void __cdecl BasicSearchTimerProc(LPVOID) INT_PTR WeatherBasicSearch(WPARAM, LPARAM lParam)
{
if (sttSearchId != -1) return 0; //only one search at a time
- _tcsncpy(sttSID, (TCHAR*)lParam, _countof(sttSID));
+ wcsncpy(sttSID, (wchar_t*)lParam, _countof(sttSID));
sttSID[_countof(sttSID) - 1] = 0;
sttSearchId = 1;
// create a thread for the ID search
@@ -225,22 +225,22 @@ INT_PTR WeatherAdvancedSearch(WPARAM, LPARAM lParam) // searchId = -1
// sData = the ID search data for that particular weather service
// svcname = the name of the weather service that is currently searching (ie. Yahoo Weather)
-int IDSearchProc(TCHAR *sID, const int searchId, WIIDSEARCH *sData, TCHAR *svc, TCHAR *svcname)
+int IDSearchProc(wchar_t *sID, const int searchId, WIIDSEARCH *sData, wchar_t *svc, wchar_t *svcname)
{
- TCHAR str[MAX_DATA_LEN], newID[MAX_DATA_LEN];
+ wchar_t str[MAX_DATA_LEN], newID[MAX_DATA_LEN];
if (sData->Available) {
char loc[255];
- TCHAR *szData = NULL;
+ wchar_t *szData = NULL;
// load the page
mir_snprintf(loc, sData->SearchURL, sID);
BOOL bFound = (InternetDownloadFile(loc, NULL, NULL, &szData) == 0);
if (bFound) {
- TCHAR* szInfo = szData;
+ wchar_t* szInfo = szData;
// not found
- if (_tcsstr(szInfo, sData->NotFoundStr) == NULL)
+ if (wcsstr(szInfo, sData->NotFoundStr) == NULL)
GetDataValue(&sData->Name, str, &szInfo);
}
@@ -250,16 +250,16 @@ int IDSearchProc(TCHAR *sID, const int searchId, WIIDSEARCH *sData, TCHAR *svc, }
// give no station name but only ID if the search is unavailable
- else _tcsncpy(str, TranslateT("<Enter station name here>"), MAX_DATA_LEN - 1);
+ else wcsncpy(str, TranslateT("<Enter station name here>"), MAX_DATA_LEN - 1);
mir_sntprintf(newID, L"%s/%s", svc, sID);
// set the search result and broadcast it
PROTOSEARCHRESULT psr = { sizeof(psr) };
psr.flags = PSR_TCHAR;
- psr.nick.t = str;
- psr.firstName.t = L" ";
- psr.lastName.t = svcname;
- psr.email.t = newID;
+ psr.nick.w = str;
+ psr.firstName.w = L" ";
+ psr.lastName.w = svcname;
+ psr.email.w = newID;
ProtoBroadcastAck(WEATHERPROTONAME, NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)searchId, (LPARAM)&psr);
return 0;
@@ -269,7 +269,7 @@ int IDSearchProc(TCHAR *sID, const int searchId, WIIDSEARCH *sData, TCHAR *svc, // sID: the ID to search for
// searchId: don't change
// return 0 if no error
-int IDSearch(TCHAR *sID, const int searchId)
+int IDSearch(wchar_t *sID, const int searchId)
{
// for a normal ID search (ID != #)
if (mir_tstrcmp(sID, L"#")) {
@@ -287,10 +287,10 @@ int IDSearch(TCHAR *sID, const int searchId) // return an empty contact on "#"
PROTOSEARCHRESULT psr = { sizeof(psr) };
psr.flags = PSR_TCHAR;
- psr.nick.t = TranslateT("<Enter station name here>"); // to be entered
- psr.firstName.t = L" ";
- psr.lastName.t = L"";
- psr.email.t = TranslateT("<Enter station ID here>"); // to be entered
+ psr.nick.w = TranslateT("<Enter station name here>"); // to be entered
+ psr.firstName.w = L" ";
+ psr.lastName.w = L"";
+ psr.email.w = TranslateT("<Enter station ID here>"); // to be entered
ProtoBroadcastAck(WEATHERPROTONAME, NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)searchId, (LPARAM)&psr);
}
@@ -304,21 +304,21 @@ int IDSearch(TCHAR *sID, const int searchId) // searchId = -1
// sData = the name search data for that particular weather service
// svcname = the name of the weather service that is currently searching (ie. Yahoo Weather)
-int NameSearchProc(TCHAR *name, const int searchId, WINAMESEARCH *sData, TCHAR *svc, TCHAR *svcname)
+int NameSearchProc(wchar_t *name, const int searchId, WINAMESEARCH *sData, wchar_t *svc, wchar_t *svcname)
{
- TCHAR Name[MAX_DATA_LEN], str[MAX_DATA_LEN], sID[MAX_DATA_LEN], *szData = NULL, *search;
+ wchar_t Name[MAX_DATA_LEN], str[MAX_DATA_LEN], sID[MAX_DATA_LEN], *szData = NULL, *search;
// replace spaces with %20
char loc[256];
T2Utf szSearchName(name);
mir_snprintf(loc, sData->SearchURL, ptrA(mir_urlEncode(szSearchName)));
if (InternetDownloadFile(loc, NULL, NULL, &szData) == 0) {
- TCHAR* szInfo = szData;
- search = _tcsstr(szInfo, sData->NotFoundStr); // determine if data is available
+ wchar_t* szInfo = szData;
+ search = wcsstr(szInfo, sData->NotFoundStr); // determine if data is available
if (search == NULL) { // if data is found
// test if it is single result
if (sData->Single.Available && sData->Multiple.Available)
- search = _tcsstr(szInfo, sData->SingleStr);
+ search = wcsstr(szInfo, sData->SingleStr);
// for single result
if (sData->Single.Available && (search != NULL || !sData->Multiple.Available)) { // single result
// if station ID appears first in the downloaded data
@@ -344,16 +344,16 @@ int NameSearchProc(TCHAR *name, const int searchId, WINAMESEARCH *sData, TCHAR * // if can't get the name, use the search string as name
if (Name[0] == 0)
- _tcsncpy(Name, name, _countof(Name));
+ wcsncpy(Name, name, _countof(Name));
// set the data and broadcast it
PROTOSEARCHRESULT psr = { sizeof(psr) };
psr.flags = PSR_TCHAR;
- psr.nick.t = Name;
- psr.firstName.t = L" ";
- psr.lastName.t = svcname;
- psr.email.t = sID;
- psr.id.t = sID;
+ psr.nick.w = Name;
+ psr.firstName.w = L" ";
+ psr.lastName.w = svcname;
+ psr.email.w = sID;
+ psr.id.w = sID;
ProtoBroadcastAck(WEATHERPROTONAME, NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)searchId, (LPARAM)&psr);
mir_free(szData);
return 0;
@@ -383,15 +383,15 @@ int NameSearchProc(TCHAR *name, const int searchId, WINAMESEARCH *sData, TCHAR * // if can't get the name, use the search string as name
if (Name[0] == 0)
- _tcsncpy(Name, name, _countof(Name));
+ wcsncpy(Name, name, _countof(Name));
PROTOSEARCHRESULT psr = { sizeof(psr) };
psr.flags = PSR_TCHAR;
- psr.nick.t = Name;
- psr.firstName.t = L"";
- psr.lastName.t = svcname;
- psr.email.t = sID;
- psr.id.t = sID;
+ psr.nick.w = Name;
+ psr.firstName.w = L"";
+ psr.lastName.w = svcname;
+ psr.email.w = sID;
+ psr.id.w = sID;
ProtoBroadcastAck(WEATHERPROTONAME, NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)searchId, (LPARAM)&psr);
}
}
@@ -409,7 +409,7 @@ int NameSearchProc(TCHAR *name, const int searchId, WINAMESEARCH *sData, TCHAR * // name: the station name to search for
// searchId: don't change
// return 0 if no error
-int NameSearch(TCHAR *name, const int searchId)
+int NameSearch(wchar_t *name, const int searchId)
{
WIDATALIST *Item = WIHead;
|