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