Mercurial > pidgin.yaz
annotate plugins/icq/contacts.c @ 1401:bf041349b11e
[gaim-migrate @ 1411]
abliity to set accounts away independent of each other. also allows for all the other states (like in yahoo and icq). probably breaks MSN, so don't use it until rob fixes it.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Wed, 10 Jan 2001 22:15:24 +0000 |
parents | 0a766047b4fd |
children | 4c510ca3563f |
rev | line source |
---|---|
1152 | 1 /* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 /* | |
1309
0a766047b4fd
[gaim-migrate @ 1319]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1152
diff
changeset
|
3 $Id: contacts.c 1319 2000-12-19 10:08:29Z warmenhoven $ |
1152 | 4 $Log$ |
1309
0a766047b4fd
[gaim-migrate @ 1319]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1152
diff
changeset
|
5 Revision 1.2 2000/12/19 10:08:29 warmenhoven |
0a766047b4fd
[gaim-migrate @ 1319]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1152
diff
changeset
|
6 Yay, new icqlib |
0a766047b4fd
[gaim-migrate @ 1319]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1152
diff
changeset
|
7 |
0a766047b4fd
[gaim-migrate @ 1319]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1152
diff
changeset
|
8 Revision 1.5 2000/12/19 06:00:07 bills |
0a766047b4fd
[gaim-migrate @ 1319]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1152
diff
changeset
|
9 moved members from ICQLINK to ICQLINK_private struct |
1152 | 10 |
11 Revision 1.4 2000/06/17 16:38:45 denis | |
12 New parameter was added in icq_ContactSetVis() for setting/resetting | |
13 'Visible to User' status. | |
14 Port's type was changed to unsigned short in icq_UserOnline callback. | |
15 | |
16 Revision 1.3 2000/01/16 03:59:10 bills | |
17 reworked list code so list_nodes don't need to be inside item structures, | |
18 removed strlist code and replaced with generic list calls | |
19 | |
20 Revision 1.2 1999/07/23 12:28:00 denis | |
21 Cleaned up. | |
22 | |
23 Revision 1.1 1999/07/18 20:11:48 bills | |
24 added | |
25 | |
26 */ | |
27 | |
28 #include <stdlib.h> | |
29 #include <stdarg.h> | |
30 | |
1309
0a766047b4fd
[gaim-migrate @ 1319]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1152
diff
changeset
|
31 #include "icq.h" |
0a766047b4fd
[gaim-migrate @ 1319]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1152
diff
changeset
|
32 #include "icqlib.h" |
1152 | 33 #include "icqtypes.h" |
34 #include "util.h" | |
35 #include "list.h" | |
36 #include "contacts.h" | |
37 | |
38 icq_ContactItem *icq_ContactNew(ICQLINK *link) | |
39 { | |
40 icq_ContactItem *pcontact= | |
41 (icq_ContactItem *)malloc(sizeof(icq_ContactItem)); | |
42 | |
43 if(pcontact) | |
44 pcontact->icqlink=link; | |
45 | |
46 return pcontact; | |
47 } | |
48 | |
49 void icq_ContactDelete(void *p) | |
50 { | |
51 free(p); | |
52 } | |
53 | |
54 void icq_ContactAdd(ICQLINK *link, DWORD cuin) | |
55 { | |
56 icq_ContactItem *p = icq_ContactNew(link); | |
57 p->uin = cuin; | |
58 p->vis_list = FALSE; | |
59 | |
1309
0a766047b4fd
[gaim-migrate @ 1319]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1152
diff
changeset
|
60 list_enqueue(link->d->icq_ContactList, p); |
1152 | 61 } |
62 | |
63 void icq_ContactRemove(ICQLINK *link, DWORD cuin) | |
64 { | |
65 icq_ContactItem *pcontact=icq_ContactFind(link, cuin); | |
66 | |
67 if (pcontact) | |
68 { | |
1309
0a766047b4fd
[gaim-migrate @ 1319]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1152
diff
changeset
|
69 list_remove(link->d->icq_ContactList, pcontact); |
1152 | 70 icq_ContactDelete(pcontact); |
71 } | |
72 } | |
73 | |
74 void icq_ContactClear(ICQLINK *link) | |
75 { | |
1309
0a766047b4fd
[gaim-migrate @ 1319]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1152
diff
changeset
|
76 list_delete(link->d->icq_ContactList, icq_ContactDelete); |
0a766047b4fd
[gaim-migrate @ 1319]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1152
diff
changeset
|
77 link->d->icq_ContactList=list_new(); |
1152 | 78 } |
79 | |
80 int _icq_ContactFind(void *p, va_list data) | |
81 { | |
82 DWORD uin=va_arg(data, DWORD); | |
83 | |
84 return (((icq_ContactItem *)p)->uin == uin); | |
85 } | |
86 | |
87 icq_ContactItem *icq_ContactFind(ICQLINK *link, DWORD cuin) | |
88 { | |
1309
0a766047b4fd
[gaim-migrate @ 1319]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1152
diff
changeset
|
89 return list_traverse(link->d->icq_ContactList, _icq_ContactFind, cuin); |
1152 | 90 } |
91 | |
92 void icq_ContactSetVis(ICQLINK *link, DWORD cuin, BYTE vu) | |
93 { | |
94 icq_ContactItem *p = icq_ContactFind(link, cuin); | |
95 if(p) | |
96 p->vis_list = vu; | |
97 } | |
98 | |
99 icq_ContactItem *icq_ContactGetFirst(ICQLINK *link) | |
100 { | |
1309
0a766047b4fd
[gaim-migrate @ 1319]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1152
diff
changeset
|
101 return list_first(link->d->icq_ContactList); |
1152 | 102 } |
103 | |
104 icq_ContactItem *icq_ContactGetNext(icq_ContactItem *pcontact) | |
105 { | |
1309
0a766047b4fd
[gaim-migrate @ 1319]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1152
diff
changeset
|
106 list_node *p=list_find(pcontact->icqlink->d->icq_ContactList, pcontact); |
1152 | 107 |
108 if (p && p->next) | |
109 return p->next->item; | |
110 else | |
111 return 0L; | |
112 | |
113 } |