summaryrefslogtreecommitdiff
path: root/plugins/ExternalAPI/delphi/m_weather.inc
blob: d8fd41ae312fe9cafec85add3477a7cb9c749b9b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
{
Weather Protocol plugin for Miranda IM
Copyright (C) 2005-2009 Boris Krasnovskiy All Rights Reserved
Copyright (C) 2002-2005 Calvin Che

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; version 2
of the License.

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, see <http://www.gnu.org/licenses/>.
}

{$IFNDEF M_WEATHER}
{$DEFINE M_WEATHER}

// {6B612A34-DCF2-4e32-85CF-B6FD006B745E}
const MIID_WEATHER:TGUID = '{6B612A34-DCF2-4E32-85CF-B6FD006B745E}';

//============  CONSTANTS  ============
const
// name
  WEATHERPROTONAME  = 'Weather';
  WEATHERPROTOTEXT  = 'Weather';
  DEFCURRENTWEATHER = 'WeatherCondition';
  WEATHERCONDITION  = 'Current';

// weather conditions
   SUNNY   = ID_STATUS_ONLINE;
   NA      = ID_STATUS_OFFLINE;
   PCLOUDY = ID_STATUS_AWAY;
   CLOUDY  = ID_STATUS_NA;
   RAIN	   = ID_STATUS_OCCUPIED;
   RSHOWER = ID_STATUS_DND;
   SNOW    = ID_STATUS_FREECHAT;
   LIGHT   = ID_STATUS_INVISIBLE;
   THUNDER = ID_STATUS_INVISIBLE;
   SSHOWER = ID_STATUS_ONTHEPHONE;
   FOG     = ID_STATUS_OUTTOLUNCH;
   UNAVAIL = ID_STATUS_IDLE;


//============  WEATHER CONDITION STRUCT  ============

// weather conditions  (added in v0.1.2.0)
type
  PWEATHERINFO = ^TWEATHERINFO;
  TWEATHERINFO = record
    hContact:THANDLE;
    id      :array [0..127] of WideChar;
    city    :array [0..127] of WideChar;
    update  :array [0.. 63] of WideChar;
    cond    :array [0..127] of WideChar;
    temp    :array [0.. 15] of WideChar;
    low     :array [0.. 15] of WideChar;
    high    :array [0.. 15] of WideChar;
    feel    :array [0.. 15] of WideChar;
    wind    :array [0.. 15] of WideChar;
    winddir :array [0.. 63] of WideChar;
    dewpoint:array [0.. 15] of WideChar;
    pressure:array [0.. 15] of WideChar;
    humid   :array [0.. 15] of WideChar;
    vis     :array [0.. 15] of WideChar;
    sunrise :array [0.. 31] of WideChar;
    sunset  :array [0.. 31] of WideChar;
// are the other ones that important!?
    status:word;
  end;


const
// ===============  WEATHER SERVICES  ================

// Enable or disable weather protocol.
// WPARAM = FALSE to toggle, TRUE to use the LPARAM
// LPARAM = TRUE to enable, FALSE to disable
  MS_WEATHER_ENABLED:pAnsiChar = 'Weather/EnableDisable';

// Update all weather info
// WPARAM = LPARAM = NULL
  MS_WEATHER_UPDATEALL:pAnsiChar = 'Weather/UpdateAll';

// Update all weather info + erase the old ones
// WPARAM = LPARAM = NULL
  MS_WEATHER_REFRESHALL:pAnsiChar = 'Weather/RefreshAll';

// Below are the service functions for weather contacts
// The plugin does NOT verify that they are used in weather contact,
// so bad call on these function may cause crashes.

// Update a single station
// WPARAM = (HANDLE)hContact
// LPARAM = NULL
  MS_WEATHER_UPDATE:pAnsiChar = 'Weather/Update';

// Update a single station + delete old settings
// WPARAM = (HANDLE)hContact
// LPARAM = NULL
  MS_WEATHER_REFRESH:pAnsiChar = 'Weather/Refresh';

// View the brief info of a contact
// WPARAM = (HANDLE)hContact
// LPARAM = NULL
  MS_WEATHER_BRIEF:pAnsiChar = 'Weather/Brief';

// Use default browser to open the complete forecast on web
// WPARAM = (HANDLE)hContact
// LPARAM = NULL
  MS_WEATHER_COMPLETE:pAnsiChar = 'Weather/CompleteForecast';

// Use default browser to open the weather map defined for the contact
// WPARAM = (HANDLE)hContact
// LPARAM = NULL
  MS_WEATHER_MAP:pAnsiChar = 'Weather/Map';

// Open the external log of the weather contact
// WPARAM = (HANDLE)hContact
// LPARAM = NULL
  MS_WEATHER_LOG:pAnsiChar = 'Weather/Log';

// Edit weather contact setting
// WPARAM = (HANDLE)hContact
// LPARAM = NULL
  MS_WEATHER_EDIT:pAnsiChar = 'Weather/Edit';

// parse the string to turn it to weather display
// WPARAM = (WEATHERINFO*)hContact
// LPARAM = (char*)display_str
  MS_WEATHER_GETDISPLAY:pAnsiChar = 'Weather/GetDisplay';

// ===============  WEATHER EVENTS  ================

{
HANDLE hContact = (HANDLE)wParam;
BOOL Condition_Changed = (BOOL)lParam;

hContact is the handle of updated contact
If the weather condition is differ from the last update (either temperature/condition,
or the last update time, depend what the user choose in the options), then
Condition_Changed is true; otherwise is false.
}
  ME_WEATHER_UPDATED:pAnsiChar = 'Miranda/Weather/Updated';

{
Shows a warning message for Weather Popup.
wParam = (char*) lpzMessage
lParam = Type
Type can either be SM_WARNING, SM_NOTIFY, or SM_WEATHERALERT

This event is used to avoid the error popup to occurs within a thread, so the "Use
multiply thread" fuction don't have to be enabled for weather popups to work.
}
  SM_WEATHERALERT = 16;
  ME_WEATHER_ERROR:pAnsiChar = 'Miranda/Weather/Error';


{$ENDIF}