release-1.10release-1.4release-1.5release-1.6release-1.7release-1.8release-1.9
Last change
on this file since 7b4d90e was
476faed,
checked in by Anders Kaseorg <andersk@mit.edu>, 15 years ago
|
Add const qualifiers for owl_buddy *.
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
|
-
Property mode set to
100644
|
File size:
1.1 KB
|
Line | |
---|
1 | #include "owl.h" |
---|
2 | |
---|
3 | void owl_buddy_create(owl_buddy *b, int proto, const char *name) |
---|
4 | { |
---|
5 | b->proto=proto; |
---|
6 | b->name=owl_strdup(name); |
---|
7 | b->idlesince=0; |
---|
8 | } |
---|
9 | |
---|
10 | const char *owl_buddy_get_name(const owl_buddy *b) |
---|
11 | { |
---|
12 | if (b->name) return(b->name); |
---|
13 | return(""); |
---|
14 | } |
---|
15 | |
---|
16 | int owl_buddy_is_idle(const owl_buddy *b) |
---|
17 | { |
---|
18 | if (b->isidle) return(1); |
---|
19 | return(0); |
---|
20 | } |
---|
21 | |
---|
22 | void owl_buddy_set_idle(owl_buddy *b) |
---|
23 | { |
---|
24 | b->isidle=1; |
---|
25 | } |
---|
26 | |
---|
27 | void owl_buddy_set_unidle(owl_buddy *b) |
---|
28 | { |
---|
29 | b->isidle=0; |
---|
30 | } |
---|
31 | |
---|
32 | int owl_buddy_get_proto(const owl_buddy *b) |
---|
33 | { |
---|
34 | return(b->proto); |
---|
35 | } |
---|
36 | |
---|
37 | int owl_buddy_is_proto_aim(const owl_buddy *b) |
---|
38 | { |
---|
39 | if (b->proto==OWL_PROTOCOL_AIM) return(1); |
---|
40 | return(0); |
---|
41 | } |
---|
42 | |
---|
43 | /* Set the buddy to have been idle since 'diff' minutes ago |
---|
44 | */ |
---|
45 | void owl_buddy_set_idle_since(owl_buddy *b, int diff) |
---|
46 | { |
---|
47 | time_t now; |
---|
48 | |
---|
49 | now=time(NULL); |
---|
50 | b->idlesince=now-(diff*60); |
---|
51 | } |
---|
52 | |
---|
53 | /* return the number of minutes the buddy has been idle |
---|
54 | */ |
---|
55 | int owl_buddy_get_idle_time(const owl_buddy *b) |
---|
56 | { |
---|
57 | time_t now; |
---|
58 | |
---|
59 | if (b->isidle) { |
---|
60 | now=time(NULL); |
---|
61 | return((now - b->idlesince)/60); |
---|
62 | } |
---|
63 | return(0); |
---|
64 | } |
---|
65 | |
---|
66 | void owl_buddy_free(owl_buddy *b) |
---|
67 | { |
---|
68 | if (b->name) owl_free(b->name); |
---|
69 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.