line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WebService::LiveJournal::Event; |
2
|
|
|
|
|
|
|
|
3
|
12
|
|
|
12
|
|
93
|
use strict; |
|
12
|
|
|
|
|
29
|
|
|
12
|
|
|
|
|
361
|
|
4
|
12
|
|
|
12
|
|
63
|
use warnings; |
|
12
|
|
|
|
|
42
|
|
|
12
|
|
|
|
|
385
|
|
5
|
12
|
|
|
12
|
|
68
|
use RPC::XML; |
|
12
|
|
|
|
|
43
|
|
|
12
|
|
|
|
|
493
|
|
6
|
12
|
|
|
12
|
|
72
|
use WebService::LiveJournal::Thingie; |
|
12
|
|
|
|
|
46
|
|
|
12
|
|
|
|
|
14524
|
|
7
|
|
|
|
|
|
|
our @ISA = qw/ WebService::LiveJournal::Thingie /; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# ABSTRACT: (Deprecated) LiveJournal event class |
10
|
|
|
|
|
|
|
our $VERSION = '0.09'; # VERSION |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# crib sheet based on stuff i read in the doco may be |
14
|
|
|
|
|
|
|
# complete rubbish. |
15
|
|
|
|
|
|
|
# |
16
|
|
|
|
|
|
|
# itemid (req) # (int) |
17
|
|
|
|
|
|
|
# event (req) # (string) set to empty to delete |
18
|
|
|
|
|
|
|
# lineendings (req) # (string) "unix" |
19
|
|
|
|
|
|
|
# subject (req) # (string) |
20
|
|
|
|
|
|
|
# security (opt) # (string) public|private|usemask (defaults to public) |
21
|
|
|
|
|
|
|
# allowmask (opt) # (int) |
22
|
|
|
|
|
|
|
# year (req) # (4-digit int) |
23
|
|
|
|
|
|
|
# mon (req) # (1- or 2-digit month int) |
24
|
|
|
|
|
|
|
# day (req) # (1- or 2-digit day int) |
25
|
|
|
|
|
|
|
# hour (req) # (1- or 2-digit hour int 0..23) |
26
|
|
|
|
|
|
|
# min (req) # (1- or 2-digit day int 0..60) |
27
|
|
|
|
|
|
|
# props (req) # (struct) |
28
|
|
|
|
|
|
|
# usejournal (opt) # (string) |
29
|
|
|
|
|
|
|
# |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub new |
32
|
|
|
|
|
|
|
{ |
33
|
0
|
|
|
0
|
0
|
|
my $ob = shift; |
34
|
0
|
|
0
|
|
|
|
my $class = ref($ob) || $ob; |
35
|
0
|
|
|
|
|
|
my $self = bless {}, $class; |
36
|
0
|
|
|
|
|
|
my %arg = @_; |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
0
|
|
|
|
$self->{props} = $arg{props} || {}; |
39
|
0
|
0
|
|
|
|
|
$self->{itemid} = $arg{itemid} if defined $arg{itemid}; |
40
|
0
|
|
0
|
|
|
|
$self->{subject} = $arg{subject} || ''; |
41
|
0
|
0
|
|
|
|
|
$self->{url} = $arg{url} if defined $arg{url}; |
42
|
0
|
0
|
|
|
|
|
$self->{anum} = $arg{anum} if defined $arg{anum}; |
43
|
0
|
|
0
|
|
|
|
$self->{event} = $arg{event} || ' '; |
44
|
0
|
0
|
|
|
|
|
$self->eventtime($arg{eventtime}) if defined $arg{eventtime}; |
45
|
0
|
|
0
|
|
|
|
$self->{security} = $arg{security} || 'public'; |
46
|
0
|
0
|
|
|
|
|
$self->{allowmask} = $arg{allowmask} if defined $arg{allowmask}; |
47
|
0
|
0
|
|
|
|
|
$self->{usejournal} = $arg{usejournal} if defined $arg{usejournal}; |
48
|
0
|
|
|
|
|
|
$self->{client} = $arg{client}; |
49
|
0
|
0
|
|
|
|
|
$self->{props}->{picture_keyword} = $arg{picture} if defined $arg{picture}; |
50
|
|
|
|
|
|
|
|
51
|
0
|
0
|
|
|
|
|
$self->{year} = $arg{year} if defined $arg{year}; |
52
|
0
|
0
|
|
|
|
|
$self->{month} = $arg{month} if defined $arg{month}; |
53
|
0
|
0
|
|
|
|
|
$self->{day} = $arg{day} if defined $arg{day}; |
54
|
0
|
0
|
|
|
|
|
$self->{hour} = $arg{hour} if defined $arg{hour}; |
55
|
0
|
0
|
|
|
|
|
$self->{min} = $arg{min} if defined $arg{min}; |
56
|
|
|
|
|
|
|
|
57
|
0
|
|
|
|
|
|
return $self; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub subject |
62
|
|
|
|
|
|
|
{ |
63
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
64
|
0
|
|
|
|
|
|
my $value = shift; |
65
|
0
|
0
|
|
|
|
|
$self->{subject} = $value if defined $value; |
66
|
0
|
|
|
|
|
|
$self->{subject}; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub event |
71
|
|
|
|
|
|
|
{ |
72
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
73
|
0
|
|
|
|
|
|
my $value = shift; |
74
|
0
|
0
|
|
|
|
|
$self->{event} = $value if defined $value; |
75
|
0
|
|
|
|
|
|
$self->{event}; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub year |
80
|
|
|
|
|
|
|
{ |
81
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
82
|
0
|
|
|
|
|
|
my $value = shift; |
83
|
0
|
0
|
|
|
|
|
$self->{year} = $value if defined $value; |
84
|
0
|
|
|
|
|
|
$self->{year}; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
sub month |
89
|
|
|
|
|
|
|
{ |
90
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
91
|
0
|
|
|
|
|
|
my $value = shift; |
92
|
0
|
0
|
|
|
|
|
$self->{month} = $value if defined $value; |
93
|
0
|
|
|
|
|
|
$self->{month}; |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
sub day |
98
|
|
|
|
|
|
|
{ |
99
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
100
|
0
|
|
|
|
|
|
my $value = shift; |
101
|
0
|
0
|
|
|
|
|
$self->{day} = $value if defined $value; |
102
|
0
|
|
|
|
|
|
$self->{day}; |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
sub hour |
107
|
|
|
|
|
|
|
{ |
108
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
109
|
0
|
|
|
|
|
|
my $value = shift; |
110
|
0
|
0
|
|
|
|
|
$self->{hour} = $value if defined $value; |
111
|
0
|
|
|
|
|
|
$self->{hour}; |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
sub min |
116
|
|
|
|
|
|
|
{ |
117
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
118
|
0
|
|
|
|
|
|
my $value = shift; |
119
|
0
|
0
|
|
|
|
|
$self->{min} = $value if defined $value; |
120
|
0
|
|
|
|
|
|
$self->{min}; |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
sub security |
125
|
|
|
|
|
|
|
{ |
126
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
127
|
0
|
|
|
|
|
|
my $value = shift; |
128
|
0
|
0
|
|
|
|
|
if(defined $value) |
129
|
|
|
|
|
|
|
{ |
130
|
0
|
0
|
|
|
|
|
if($value eq 'friends') |
131
|
|
|
|
|
|
|
{ |
132
|
0
|
|
|
|
|
|
$self->{security} = 'usemask'; |
133
|
0
|
|
|
|
|
|
$self->{allowmask} = 1; |
134
|
|
|
|
|
|
|
} |
135
|
|
|
|
|
|
|
else |
136
|
|
|
|
|
|
|
{ |
137
|
0
|
|
|
|
|
|
$self->{security} = $value; |
138
|
|
|
|
|
|
|
} |
139
|
|
|
|
|
|
|
} |
140
|
0
|
|
|
|
|
|
$self->{security}; |
141
|
|
|
|
|
|
|
} |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
sub allowmask |
145
|
|
|
|
|
|
|
{ |
146
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
147
|
0
|
|
|
|
|
|
my $value = shift; |
148
|
0
|
0
|
|
|
|
|
$self->{allowmask} = $value if defined $value; |
149
|
0
|
|
|
|
|
|
$self->{allowmask}; |
150
|
|
|
|
|
|
|
} |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
sub picture |
154
|
|
|
|
|
|
|
{ |
155
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
156
|
0
|
|
|
|
|
|
my $value = shift; |
157
|
0
|
0
|
|
|
|
|
if(defined $value) |
158
|
|
|
|
|
|
|
{ |
159
|
0
|
|
|
|
|
|
$self->{props}->{picture_keyword} = $value; |
160
|
|
|
|
|
|
|
} |
161
|
0
|
|
|
|
|
|
$self->{props}->{picture_keyword}; |
162
|
|
|
|
|
|
|
} |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
|
165
|
0
|
|
|
0
|
1
|
|
sub itemid { $_[0]->{itemid} } |
166
|
0
|
|
|
0
|
1
|
|
sub url { $_[0]->{url} } |
167
|
0
|
|
|
0
|
1
|
|
sub anum { $_[0]->{anum} } |
168
|
0
|
|
|
0
|
1
|
|
sub usejournal { $_[0]->{usejournal} } |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
|
171
|
0
|
|
|
0
|
1
|
|
sub props { $_[0]->{props} } |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
sub update |
175
|
|
|
|
|
|
|
{ |
176
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
177
|
0
|
0
|
|
|
|
|
if(defined $self->itemid) |
178
|
|
|
|
|
|
|
{ |
179
|
0
|
|
|
|
|
|
return $self->editevent; |
180
|
|
|
|
|
|
|
} |
181
|
|
|
|
|
|
|
else |
182
|
|
|
|
|
|
|
{ |
183
|
0
|
|
|
|
|
|
return $self->postevent; |
184
|
|
|
|
|
|
|
} |
185
|
|
|
|
|
|
|
} |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
|
188
|
0
|
|
|
0
|
1
|
|
sub save { shift->update(@_) } |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
sub delete |
192
|
|
|
|
|
|
|
{ |
193
|
0
|
|
|
0
|
1
|
|
my($self) = @_; |
194
|
0
|
|
|
|
|
|
$self->event(''); |
195
|
0
|
|
|
|
|
|
return $self->update; |
196
|
|
|
|
|
|
|
} |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
|
199
|
0
|
|
|
0
|
0
|
|
sub getprop { $_[0]->{props}->{$_[1]} } |
200
|
0
|
|
|
0
|
0
|
|
sub setprop { $_[0]->{props}->{$_[1]} = $_[2] } |
201
|
0
|
|
|
0
|
1
|
|
sub get_prop { $_[0]->{props}->{$_[1]} } |
202
|
0
|
|
|
0
|
1
|
|
sub set_prop { $_[0]->{props}->{$_[1]} = $_[2] } |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
sub _prep |
205
|
|
|
|
|
|
|
{ |
206
|
0
|
|
|
0
|
|
|
my $self = shift; |
207
|
0
|
|
|
|
|
|
my @list; |
208
|
|
|
|
|
|
|
push @list, |
209
|
|
|
|
|
|
|
event => new RPC::XML::string($self->event), |
210
|
|
|
|
|
|
|
subject => new RPC::XML::string($self->subject), |
211
|
|
|
|
|
|
|
security => new RPC::XML::string($self->security), |
212
|
12
|
|
|
12
|
|
127
|
lineendings => do { no warnings; $WebService::LiveJournal::Client::lineendings_unix }, |
|
12
|
|
|
|
|
27
|
|
|
12
|
|
|
|
|
18290
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
year => new RPC::XML::int($self->year), |
215
|
|
|
|
|
|
|
mon => new RPC::XML::int($self->month), |
216
|
|
|
|
|
|
|
day => new RPC::XML::int($self->day), |
217
|
|
|
|
|
|
|
hour => new RPC::XML::int($self->hour), |
218
|
|
|
|
|
|
|
min => new RPC::XML::int($self->min), |
219
|
|
|
|
|
|
|
; |
220
|
0
|
0
|
|
|
|
|
push @list, allowmask => new RPC::XML::int($self->allowmask) if $self->security eq 'usemask'; |
221
|
0
|
0
|
|
|
|
|
push @list, usejournal => new RPC::XML::string($self->usejournal) if defined $self->usejournal; |
222
|
|
|
|
|
|
|
|
223
|
0
|
|
|
|
|
|
my @props; |
224
|
0
|
|
|
|
|
|
foreach my $key (keys %{ $self->{props} }) |
|
0
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
{ |
226
|
0
|
|
|
|
|
|
push @props, $key => new RPC::XML::string($self->{props}->{$key}); |
227
|
|
|
|
|
|
|
} |
228
|
0
|
|
|
|
|
|
push @list, props => new RPC::XML::struct(@props); |
229
|
|
|
|
|
|
|
|
230
|
0
|
|
|
|
|
|
@list; |
231
|
|
|
|
|
|
|
} |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
sub _prep_flat |
234
|
|
|
|
|
|
|
{ |
235
|
0
|
|
|
0
|
|
|
my $self = shift; |
236
|
0
|
|
|
|
|
|
my @list; |
237
|
0
|
|
|
|
|
|
push @list, |
238
|
|
|
|
|
|
|
event => $self->event, |
239
|
|
|
|
|
|
|
subject => $self->subject, |
240
|
|
|
|
|
|
|
security => $self->security, |
241
|
|
|
|
|
|
|
lineendings => 'unix', |
242
|
|
|
|
|
|
|
year => $self->year, |
243
|
|
|
|
|
|
|
mon => $self->month, |
244
|
|
|
|
|
|
|
day => $self->day, |
245
|
|
|
|
|
|
|
hour => $self->hour, |
246
|
|
|
|
|
|
|
min => $self->min, |
247
|
|
|
|
|
|
|
; |
248
|
0
|
0
|
|
|
|
|
push @list, allowmask => $self->allowmask if $self->security eq 'usemask'; |
249
|
0
|
0
|
|
|
|
|
push @list, usejournal => $self->usejournal if defined $self->usejournal; |
250
|
0
|
|
|
|
|
|
foreach my $key (keys %{ $self->{props} }) |
|
0
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
{ |
252
|
0
|
|
|
|
|
|
push @list, "prop_$key" => $self->{props}->{$key}; |
253
|
|
|
|
|
|
|
} |
254
|
|
|
|
|
|
|
|
255
|
0
|
|
|
|
|
|
@list; |
256
|
|
|
|
|
|
|
} |
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
sub editevent |
259
|
|
|
|
|
|
|
{ |
260
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
261
|
0
|
|
|
|
|
|
my $client = $self->client; |
262
|
|
|
|
|
|
|
|
263
|
0
|
|
|
|
|
|
if(1) |
264
|
|
|
|
|
|
|
{ |
265
|
0
|
|
|
|
|
|
my @list = _prep_flat($self, @_); |
266
|
0
|
|
|
|
|
|
push @list, itemid => $self->itemid; |
267
|
0
|
|
|
|
|
|
my $response = $client->send_flat_request('editevent', @list); |
268
|
0
|
0
|
|
|
|
|
if(defined $response) |
269
|
0
|
|
|
|
|
|
{ return 1 } |
270
|
|
|
|
|
|
|
else |
271
|
0
|
|
|
|
|
|
{ return } |
272
|
|
|
|
|
|
|
} |
273
|
|
|
|
|
|
|
else |
274
|
|
|
|
|
|
|
{ |
275
|
|
|
|
|
|
|
my @list = _prep($self, @_); |
276
|
|
|
|
|
|
|
push @list, itemid => new RPC::XML::int($self->itemid); |
277
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
my $response = $client->send_request('editevent', @list); |
279
|
|
|
|
|
|
|
if(defined $response) |
280
|
|
|
|
|
|
|
{ return 1 } |
281
|
|
|
|
|
|
|
else |
282
|
|
|
|
|
|
|
{ return } |
283
|
|
|
|
|
|
|
} |
284
|
|
|
|
|
|
|
} |
285
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
sub _fill_in_default_time |
287
|
|
|
|
|
|
|
{ |
288
|
0
|
|
|
0
|
|
|
my($self) = @_; |
289
|
|
|
|
|
|
|
return if defined $self->{year} |
290
|
|
|
|
|
|
|
&& defined $self->{month} |
291
|
|
|
|
|
|
|
&& defined $self->{day} |
292
|
|
|
|
|
|
|
&& defined $self->{hour} |
293
|
0
|
0
|
0
|
|
|
|
&& defined $self->{min}; |
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
294
|
0
|
|
|
|
|
|
my ($sec,$min,$hour,$mday,$month,$year,$wday,$yday,$isdst) = localtime(time); |
295
|
0
|
|
0
|
|
|
|
$self->{year} //= $year+1900; |
296
|
0
|
|
0
|
|
|
|
$self->{month} //= $month+1; |
297
|
0
|
|
0
|
|
|
|
$self->{day} //= $mday; |
298
|
0
|
|
0
|
|
|
|
$self->{hour} //= $hour; |
299
|
0
|
|
0
|
|
|
|
$self->{min} //= $min; |
300
|
0
|
|
|
|
|
|
return; |
301
|
|
|
|
|
|
|
} |
302
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
sub postevent |
304
|
|
|
|
|
|
|
{ |
305
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
306
|
0
|
|
|
|
|
|
my $client = $self->client; |
307
|
|
|
|
|
|
|
|
308
|
0
|
|
|
|
|
|
$self->_fill_in_default_time; |
309
|
|
|
|
|
|
|
|
310
|
0
|
|
|
|
|
|
my $h; |
311
|
0
|
|
|
|
|
|
if(1) |
312
|
|
|
|
|
|
|
{ |
313
|
0
|
|
|
|
|
|
my @list = _prep_flat($self, @_); |
314
|
0
|
|
|
|
|
|
$h = $client->send_flat_request('postevent', @list); |
315
|
0
|
0
|
|
|
|
|
return unless defined $h; |
316
|
|
|
|
|
|
|
} |
317
|
|
|
|
|
|
|
else |
318
|
|
|
|
|
|
|
{ |
319
|
|
|
|
|
|
|
my @list = _prep($self, @_); |
320
|
|
|
|
|
|
|
my $response = $client->send_request('postevent', @list); |
321
|
|
|
|
|
|
|
return unless defined $response; |
322
|
|
|
|
|
|
|
$h = $response->value; |
323
|
|
|
|
|
|
|
} |
324
|
|
|
|
|
|
|
|
325
|
0
|
|
|
|
|
|
$self->{itemid} = $h->{itemid}; |
326
|
0
|
|
|
|
|
|
$self->{url} = $h->{url}; |
327
|
0
|
|
|
|
|
|
$self->{anum} = $h->{anum}; |
328
|
0
|
|
|
|
|
|
return 1; |
329
|
|
|
|
|
|
|
} |
330
|
|
|
|
|
|
|
|
331
|
|
|
|
|
|
|
sub as_string |
332
|
|
|
|
|
|
|
{ |
333
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
334
|
0
|
|
|
|
|
|
my $subject = $self->subject; |
335
|
0
|
0
|
0
|
|
|
|
$subject = 'untitled' if !defined $subject || $subject eq ''; |
336
|
0
|
|
|
|
|
|
"[event $subject]"; |
337
|
|
|
|
|
|
|
} |
338
|
|
|
|
|
|
|
|
339
|
|
|
|
|
|
|
|
340
|
|
|
|
|
|
|
sub get_tags |
341
|
|
|
|
|
|
|
{ |
342
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
343
|
0
|
0
|
|
|
|
|
if(defined $self->{props}->{taglist}) |
344
|
|
|
|
|
|
|
{ |
345
|
0
|
|
|
|
|
|
return split /, /, $self->{props}->{taglist}; |
346
|
|
|
|
|
|
|
} |
347
|
|
|
|
|
|
|
else |
348
|
|
|
|
|
|
|
{ |
349
|
0
|
|
|
|
|
|
return (); |
350
|
|
|
|
|
|
|
} |
351
|
|
|
|
|
|
|
} |
352
|
|
|
|
|
|
|
|
353
|
|
|
|
|
|
|
# legacy |
354
|
0
|
|
|
0
|
0
|
|
sub gettags { shift->get_tags(@_) } |
355
|
|
|
|
|
|
|
|
356
|
|
|
|
|
|
|
|
357
|
|
|
|
|
|
|
sub set_tags |
358
|
|
|
|
|
|
|
{ |
359
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
360
|
0
|
|
|
|
|
|
my $tags = join ', ', @_; |
361
|
0
|
|
|
|
|
|
$self->{props}->{taglist} = $tags; |
362
|
0
|
|
|
|
|
|
$self; |
363
|
|
|
|
|
|
|
} |
364
|
|
|
|
|
|
|
|
365
|
0
|
|
|
0
|
0
|
|
sub settags { shift->set_tags(@_) } |
366
|
|
|
|
|
|
|
|
367
|
|
|
|
|
|
|
|
368
|
|
|
|
|
|
|
sub htmlid |
369
|
|
|
|
|
|
|
{ |
370
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
371
|
0
|
|
|
|
|
|
my $url = $self->url; |
372
|
0
|
0
|
|
|
|
|
if($url =~ m!/(\d+)\.html$!) |
373
|
|
|
|
|
|
|
{ |
374
|
0
|
|
|
|
|
|
return $1; |
375
|
|
|
|
|
|
|
} |
376
|
|
|
|
|
|
|
else |
377
|
|
|
|
|
|
|
{ |
378
|
0
|
|
|
|
|
|
return; |
379
|
|
|
|
|
|
|
} |
380
|
|
|
|
|
|
|
} |
381
|
|
|
|
|
|
|
|
382
|
0
|
|
|
0
|
0
|
|
sub name { itemid(@_) } |
383
|
|
|
|
|
|
|
|
384
|
|
|
|
|
|
|
|
385
|
|
|
|
|
|
|
sub set_access |
386
|
|
|
|
|
|
|
{ |
387
|
0
|
|
|
0
|
1
|
|
my($self, $type, @groups) = @_; |
388
|
|
|
|
|
|
|
|
389
|
0
|
0
|
|
|
|
|
if($type =~ /^(?:public|private)$/) |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
390
|
|
|
|
|
|
|
{ |
391
|
0
|
|
|
|
|
|
$self->security($type); |
392
|
|
|
|
|
|
|
} |
393
|
|
|
|
|
|
|
elsif($type eq 'groups') |
394
|
|
|
|
|
|
|
{ |
395
|
0
|
|
|
|
|
|
my $mask = 0; |
396
|
0
|
|
|
|
|
|
foreach my $group (@_) |
397
|
|
|
|
|
|
|
{ |
398
|
0
|
|
|
|
|
|
$mask |= $group->mask; |
399
|
|
|
|
|
|
|
} |
400
|
0
|
|
|
|
|
|
$self->security('usemask'); |
401
|
0
|
|
|
|
|
|
$self->allowmask($mask); |
402
|
|
|
|
|
|
|
} |
403
|
|
|
|
|
|
|
elsif($type eq 'friends') |
404
|
|
|
|
|
|
|
{ |
405
|
0
|
|
|
|
|
|
$self->security('usemask'); |
406
|
0
|
|
|
|
|
|
$self->allowmask(1); |
407
|
|
|
|
|
|
|
} |
408
|
0
|
|
|
|
|
|
return ($type, @groups); |
409
|
|
|
|
|
|
|
} |
410
|
|
|
|
|
|
|
|
411
|
|
|
|
|
|
|
|
412
|
|
|
|
|
|
|
sub get_access |
413
|
|
|
|
|
|
|
{ |
414
|
0
|
|
|
0
|
1
|
|
my($self) = @_; |
415
|
|
|
|
|
|
|
|
416
|
0
|
|
|
|
|
|
my $security = $self->security; |
417
|
0
|
0
|
|
|
|
|
return $security if $security =~ /^(?:public|private)$/; |
418
|
0
|
|
|
|
|
|
my $allowmask = $self->allowmask; |
419
|
0
|
0
|
|
|
|
|
return 'friends' if $allowmask == 1; |
420
|
0
|
|
|
|
|
|
my $groups = $self->client->getfriendgroups; |
421
|
0
|
|
|
|
|
|
my @list; |
422
|
0
|
|
|
|
|
|
foreach my $group (@{ $groups }) |
|
0
|
|
|
|
|
|
|
423
|
|
|
|
|
|
|
{ |
424
|
0
|
|
|
|
|
|
my $mask = $group->mask; |
425
|
12
|
|
|
12
|
|
124
|
no warnings; |
|
12
|
|
|
|
|
53
|
|
|
12
|
|
|
|
|
3656
|
|
426
|
0
|
0
|
|
|
|
|
push @list, $group if $mask & $allowmask == $mask; |
427
|
|
|
|
|
|
|
} |
428
|
0
|
|
|
|
|
|
return ('grops', @list); |
429
|
|
|
|
|
|
|
} |
430
|
|
|
|
|
|
|
|
431
|
|
|
|
|
|
|
# legacy |
432
|
|
|
|
|
|
|
sub access |
433
|
|
|
|
|
|
|
{ |
434
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
435
|
0
|
|
|
|
|
|
my $type = shift; |
436
|
0
|
0
|
|
|
|
|
defined $type ? $self->set_access(@_) : $self->get_access; |
437
|
|
|
|
|
|
|
} |
438
|
|
|
|
|
|
|
|
439
|
|
|
|
|
|
|
sub eventtime |
440
|
|
|
|
|
|
|
{ |
441
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
442
|
0
|
|
|
|
|
|
my $value = shift; |
443
|
0
|
0
|
|
|
|
|
if(defined $value) |
444
|
|
|
|
|
|
|
{ |
445
|
0
|
0
|
|
|
|
|
if($value =~ m/^(\d\d\d\d)-(\d\d)-(\d\d) (\d\d):(\d\d):(\d\d)$/) |
|
|
0
|
|
|
|
|
|
446
|
|
|
|
|
|
|
{ |
447
|
0
|
|
|
|
|
|
$self->{year} = $1; |
448
|
0
|
|
|
|
|
|
$self->{month} = $2; |
449
|
0
|
|
|
|
|
|
$self->{day} = $3; |
450
|
0
|
|
|
|
|
|
$self->{hour} = $4; |
451
|
0
|
|
|
|
|
|
$self->{min} = $5; |
452
|
|
|
|
|
|
|
} |
453
|
|
|
|
|
|
|
elsif($value eq 'now') |
454
|
|
|
|
|
|
|
{ |
455
|
0
|
|
|
|
|
|
my($sec,$min,$hour,$mday,$month,$year,$wday,$yday,$isdst) = localtime(time); |
456
|
0
|
|
|
|
|
|
$self->{year} = $year+1900; |
457
|
0
|
|
|
|
|
|
$self->{month} = $month+1; |
458
|
0
|
|
|
|
|
|
$self->{day} = $mday; |
459
|
0
|
|
|
|
|
|
$self->{hour} = $hour; |
460
|
0
|
|
|
|
|
|
$self->{min} = $min; |
461
|
|
|
|
|
|
|
} |
462
|
|
|
|
|
|
|
} |
463
|
12
|
|
|
12
|
|
98
|
no warnings; |
|
12
|
|
|
|
|
39
|
|
|
12
|
|
|
|
|
1198
|
|
464
|
0
|
|
|
|
|
|
sprintf("%04d-%02d-%02d %02d:%02d:%02d", $self->year, $self->month, $self->day, $self->hour, $self->min); |
465
|
|
|
|
|
|
|
} |
466
|
|
|
|
|
|
|
|
467
|
|
|
|
|
|
|
1; |
468
|
|
|
|
|
|
|
|
469
|
|
|
|
|
|
|
__END__ |
470
|
|
|
|
|
|
|
|
471
|
|
|
|
|
|
|
=pod |
472
|
|
|
|
|
|
|
|
473
|
|
|
|
|
|
|
=encoding UTF-8 |
474
|
|
|
|
|
|
|
|
475
|
|
|
|
|
|
|
=head1 NAME |
476
|
|
|
|
|
|
|
|
477
|
|
|
|
|
|
|
WebService::LiveJournal::Event - (Deprecated) LiveJournal event class |
478
|
|
|
|
|
|
|
|
479
|
|
|
|
|
|
|
=head1 VERSION |
480
|
|
|
|
|
|
|
|
481
|
|
|
|
|
|
|
version 0.09 |
482
|
|
|
|
|
|
|
|
483
|
|
|
|
|
|
|
=head1 SYNOPSIS |
484
|
|
|
|
|
|
|
|
485
|
|
|
|
|
|
|
create an event |
486
|
|
|
|
|
|
|
|
487
|
|
|
|
|
|
|
use WebService::LiveJournal; |
488
|
|
|
|
|
|
|
my $client = WebService::LiveJournal::Client->new( |
489
|
|
|
|
|
|
|
username => $user, |
490
|
|
|
|
|
|
|
password => $password, |
491
|
|
|
|
|
|
|
); |
492
|
|
|
|
|
|
|
|
493
|
|
|
|
|
|
|
# $event is an instance of WS::LJ::Event |
494
|
|
|
|
|
|
|
my $event = $client->create_event; |
495
|
|
|
|
|
|
|
$event->subject("this is a subject"); |
496
|
|
|
|
|
|
|
$event->event("this is the event content"); |
497
|
|
|
|
|
|
|
# doesn't show up on the LiveJournal server |
498
|
|
|
|
|
|
|
# until you use the update method. |
499
|
|
|
|
|
|
|
$event->update; |
500
|
|
|
|
|
|
|
|
501
|
|
|
|
|
|
|
# save the itemid for later use |
502
|
|
|
|
|
|
|
$itemid = $event->itemid; |
503
|
|
|
|
|
|
|
|
504
|
|
|
|
|
|
|
update an existing event |
505
|
|
|
|
|
|
|
|
506
|
|
|
|
|
|
|
use WebService::LiveJournal; |
507
|
|
|
|
|
|
|
my $client = WebService::LiveJournal::Client->new( |
508
|
|
|
|
|
|
|
username => $user, |
509
|
|
|
|
|
|
|
password => $password, |
510
|
|
|
|
|
|
|
); |
511
|
|
|
|
|
|
|
|
512
|
|
|
|
|
|
|
my $event = $client->get_event( $itemid ); |
513
|
|
|
|
|
|
|
$event->subject('new subject'); |
514
|
|
|
|
|
|
|
$event->update; |
515
|
|
|
|
|
|
|
|
516
|
|
|
|
|
|
|
=head1 DESCRIPTION |
517
|
|
|
|
|
|
|
|
518
|
|
|
|
|
|
|
B<NOTE>: This distribution is deprecated. It uses the outmoded XML-RPC protocol. |
519
|
|
|
|
|
|
|
LiveJournal has also been compromised. I recommend using DreamWidth instead |
520
|
|
|
|
|
|
|
(L<https://www.dreamwidth.org/>) which is in keeping with the original philosophy |
521
|
|
|
|
|
|
|
LiveJournal regarding advertising. |
522
|
|
|
|
|
|
|
|
523
|
|
|
|
|
|
|
This class represents an "event" on the LiveJournal server. |
524
|
|
|
|
|
|
|
|
525
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
526
|
|
|
|
|
|
|
|
527
|
|
|
|
|
|
|
=head2 subject |
528
|
|
|
|
|
|
|
|
529
|
|
|
|
|
|
|
Required. |
530
|
|
|
|
|
|
|
|
531
|
|
|
|
|
|
|
The subject for the event. |
532
|
|
|
|
|
|
|
|
533
|
|
|
|
|
|
|
=head2 event |
534
|
|
|
|
|
|
|
|
535
|
|
|
|
|
|
|
Required. |
536
|
|
|
|
|
|
|
|
537
|
|
|
|
|
|
|
The content of the event. |
538
|
|
|
|
|
|
|
|
539
|
|
|
|
|
|
|
=head2 year |
540
|
|
|
|
|
|
|
|
541
|
|
|
|
|
|
|
Year |
542
|
|
|
|
|
|
|
|
543
|
|
|
|
|
|
|
=head2 month |
544
|
|
|
|
|
|
|
|
545
|
|
|
|
|
|
|
Month |
546
|
|
|
|
|
|
|
|
547
|
|
|
|
|
|
|
=head2 day |
548
|
|
|
|
|
|
|
|
549
|
|
|
|
|
|
|
Day |
550
|
|
|
|
|
|
|
|
551
|
|
|
|
|
|
|
=head2 hour |
552
|
|
|
|
|
|
|
|
553
|
|
|
|
|
|
|
Hour |
554
|
|
|
|
|
|
|
|
555
|
|
|
|
|
|
|
=head2 min |
556
|
|
|
|
|
|
|
|
557
|
|
|
|
|
|
|
Minute |
558
|
|
|
|
|
|
|
|
559
|
|
|
|
|
|
|
=head2 security |
560
|
|
|
|
|
|
|
|
561
|
|
|
|
|
|
|
One of |
562
|
|
|
|
|
|
|
|
563
|
|
|
|
|
|
|
=over 4 |
564
|
|
|
|
|
|
|
|
565
|
|
|
|
|
|
|
=item public |
566
|
|
|
|
|
|
|
|
567
|
|
|
|
|
|
|
=item private |
568
|
|
|
|
|
|
|
|
569
|
|
|
|
|
|
|
=item friends |
570
|
|
|
|
|
|
|
|
571
|
|
|
|
|
|
|
=item usemask |
572
|
|
|
|
|
|
|
|
573
|
|
|
|
|
|
|
=back |
574
|
|
|
|
|
|
|
|
575
|
|
|
|
|
|
|
=head2 allowmask |
576
|
|
|
|
|
|
|
|
577
|
|
|
|
|
|
|
Relevant when security is usemask. A 32-bit unsigned integer |
578
|
|
|
|
|
|
|
representing which of the user's groups of friends are allowed |
579
|
|
|
|
|
|
|
to view this post. Turn bit 0 on to allow any defined friend to |
580
|
|
|
|
|
|
|
read it. Otherwise, turn bit 1-30 on for every friend group that |
581
|
|
|
|
|
|
|
should be allowed to read it. Bit 31 is reserved. |
582
|
|
|
|
|
|
|
|
583
|
|
|
|
|
|
|
=head2 picture |
584
|
|
|
|
|
|
|
|
585
|
|
|
|
|
|
|
The picture tag to use for this entry. Each icon picture |
586
|
|
|
|
|
|
|
may have one or more tags, you can select it by using any |
587
|
|
|
|
|
|
|
one of those tags for this attribute. |
588
|
|
|
|
|
|
|
|
589
|
|
|
|
|
|
|
=head2 itemid |
590
|
|
|
|
|
|
|
|
591
|
|
|
|
|
|
|
Read only. |
592
|
|
|
|
|
|
|
|
593
|
|
|
|
|
|
|
The LiveJournal item id |
594
|
|
|
|
|
|
|
|
595
|
|
|
|
|
|
|
=head2 url |
596
|
|
|
|
|
|
|
|
597
|
|
|
|
|
|
|
Read only. |
598
|
|
|
|
|
|
|
|
599
|
|
|
|
|
|
|
URL for the LiveJournal event. |
600
|
|
|
|
|
|
|
|
601
|
|
|
|
|
|
|
=head2 anum |
602
|
|
|
|
|
|
|
|
603
|
|
|
|
|
|
|
Read only. |
604
|
|
|
|
|
|
|
|
605
|
|
|
|
|
|
|
The authentication number generated for this entry |
606
|
|
|
|
|
|
|
Probably best ignored. |
607
|
|
|
|
|
|
|
|
608
|
|
|
|
|
|
|
=head2 usejournal |
609
|
|
|
|
|
|
|
|
610
|
|
|
|
|
|
|
If editing a shared journal entry, include this key and the username |
611
|
|
|
|
|
|
|
you wish to edit the entry in. By default, you edit the entry as if |
612
|
|
|
|
|
|
|
it were in user "user"'s journal, as specified above. |
613
|
|
|
|
|
|
|
|
614
|
|
|
|
|
|
|
=head2 props |
615
|
|
|
|
|
|
|
|
616
|
|
|
|
|
|
|
Property hash |
617
|
|
|
|
|
|
|
|
618
|
|
|
|
|
|
|
=head1 METHODS |
619
|
|
|
|
|
|
|
|
620
|
|
|
|
|
|
|
=head2 $event-E<gt>update |
621
|
|
|
|
|
|
|
|
622
|
|
|
|
|
|
|
Create a new (if it isn't on the LiveJournal server yet) or update |
623
|
|
|
|
|
|
|
the existing event on the LiveJournal server. |
624
|
|
|
|
|
|
|
|
625
|
|
|
|
|
|
|
Returns true on success. |
626
|
|
|
|
|
|
|
|
627
|
|
|
|
|
|
|
This method signals an error depending on the interface |
628
|
|
|
|
|
|
|
selected by throwing an exception or returning undef. |
629
|
|
|
|
|
|
|
|
630
|
|
|
|
|
|
|
=head2 $event-E<gt>save |
631
|
|
|
|
|
|
|
|
632
|
|
|
|
|
|
|
An alias for update. |
633
|
|
|
|
|
|
|
|
634
|
|
|
|
|
|
|
=head2 $event-E<gt>delete |
635
|
|
|
|
|
|
|
|
636
|
|
|
|
|
|
|
Remove the event on the LiveJournal server. |
637
|
|
|
|
|
|
|
|
638
|
|
|
|
|
|
|
This method signals an error depending on the interface |
639
|
|
|
|
|
|
|
selected by throwing an exception or returning undef. |
640
|
|
|
|
|
|
|
|
641
|
|
|
|
|
|
|
=head2 $event-E<gt>get_prop( $key ) |
642
|
|
|
|
|
|
|
|
643
|
|
|
|
|
|
|
Get the property with the given key |
644
|
|
|
|
|
|
|
|
645
|
|
|
|
|
|
|
=head2 $event-E<gt>set_prop( $key => $value ) |
646
|
|
|
|
|
|
|
|
647
|
|
|
|
|
|
|
Set the property with the given key and value |
648
|
|
|
|
|
|
|
|
649
|
|
|
|
|
|
|
=head2 $event-E<gt>get_tags |
650
|
|
|
|
|
|
|
|
651
|
|
|
|
|
|
|
Returns the tags for the event as a list. |
652
|
|
|
|
|
|
|
|
653
|
|
|
|
|
|
|
=head2 $event-E<gt>set_tags( @new_tags ) |
654
|
|
|
|
|
|
|
|
655
|
|
|
|
|
|
|
Set the tags for the event. |
656
|
|
|
|
|
|
|
|
657
|
|
|
|
|
|
|
=head2 $event-E<gt>set_access([ 'public' | 'private' | 'friends' ]) |
658
|
|
|
|
|
|
|
|
659
|
|
|
|
|
|
|
=head2 $event-E<gt>set_access('group', @group_list) |
660
|
|
|
|
|
|
|
|
661
|
|
|
|
|
|
|
Set the access for the event. The first argument is the type: |
662
|
|
|
|
|
|
|
|
663
|
|
|
|
|
|
|
=over 4 |
664
|
|
|
|
|
|
|
|
665
|
|
|
|
|
|
|
=item public |
666
|
|
|
|
|
|
|
|
667
|
|
|
|
|
|
|
Entry will be readable by anyone |
668
|
|
|
|
|
|
|
|
669
|
|
|
|
|
|
|
=item private |
670
|
|
|
|
|
|
|
|
671
|
|
|
|
|
|
|
Entry will be readable only by the journal owner |
672
|
|
|
|
|
|
|
|
673
|
|
|
|
|
|
|
=item friends |
674
|
|
|
|
|
|
|
|
675
|
|
|
|
|
|
|
Entry will be readable only by the journal owner's friends |
676
|
|
|
|
|
|
|
|
677
|
|
|
|
|
|
|
=item group |
678
|
|
|
|
|
|
|
|
679
|
|
|
|
|
|
|
Entry will be readable only by the members of the given groups. |
680
|
|
|
|
|
|
|
|
681
|
|
|
|
|
|
|
=back |
682
|
|
|
|
|
|
|
|
683
|
|
|
|
|
|
|
=head2 get_access |
684
|
|
|
|
|
|
|
|
685
|
|
|
|
|
|
|
Returns the access information for the entry. It will always return the type |
686
|
|
|
|
|
|
|
as defined above in the C<set_access> method. In addition for the C<group> |
687
|
|
|
|
|
|
|
type the list of groups will also be returned: |
688
|
|
|
|
|
|
|
|
689
|
|
|
|
|
|
|
my($type, @groups) = $event-E<gt>get_access |
690
|
|
|
|
|
|
|
|
691
|
|
|
|
|
|
|
=head1 SEE ALSO |
692
|
|
|
|
|
|
|
|
693
|
|
|
|
|
|
|
L<WebService::LiveJournal> |
694
|
|
|
|
|
|
|
|
695
|
|
|
|
|
|
|
=head1 AUTHOR |
696
|
|
|
|
|
|
|
|
697
|
|
|
|
|
|
|
Graham Ollis <plicease@cpan.org> |
698
|
|
|
|
|
|
|
|
699
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
700
|
|
|
|
|
|
|
|
701
|
|
|
|
|
|
|
This software is copyright (c) 2013 by Graham Ollis. |
702
|
|
|
|
|
|
|
|
703
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
704
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
705
|
|
|
|
|
|
|
|
706
|
|
|
|
|
|
|
=cut |