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