Tue, 28 Nov 2000 02:22:42 +0000
[gaim-migrate @ 1162]
icq. whoop de doo
| 1152 | 1 | |
| 2 | #include <stdlib.h> | |
| 3 | ||
| 4 | #include "chatsession.h" | |
| 5 | #include "list.h" | |
| 6 | ||
| 7 | icq_ChatSession *icq_ChatSessionNew(ICQLINK *icqlink) | |
| 8 | { | |
| 9 | icq_ChatSession *p=(icq_ChatSession *)malloc(sizeof(icq_ChatSession)); | |
| 10 | ||
| 11 | if (p) | |
| 12 | { | |
| 13 | p->remote_handle=0L; | |
| 14 | p->status=0; | |
| 15 | p->id=0L; | |
| 16 | p->icqlink=icqlink; | |
| 17 | list_insert(icqlink->icq_ChatSessions, 0, p); | |
| 18 | } | |
| 19 | ||
| 20 | return p; | |
| 21 | } | |
| 22 | ||
| 23 | void icq_ChatSessionDelete(void *p) | |
| 24 | { | |
| 25 | free(p); | |
| 26 | } | |
| 27 | ||
| 28 | void icq_ChatSessionClose(icq_ChatSession *p) | |
| 29 | { | |
| 30 | list_remove(p->icqlink->icq_ChatSessions, p); | |
| 31 | icq_ChatSessionDelete(p); | |
| 32 | } | |
| 33 | ||
| 34 | int _icq_FindChatSession(void *p, va_list data) | |
| 35 | { | |
| 36 | DWORD uin=va_arg(data, DWORD); | |
| 37 | return (((icq_ChatSession *)p)->remote_uin == uin); | |
| 38 | } | |
| 39 | ||
| 40 | icq_ChatSession *icq_FindChatSession(ICQLINK *icqlink, DWORD uin) | |
| 41 | { | |
| 42 | return list_traverse(icqlink->icq_ChatSessions, | |
| 43 | _icq_FindChatSession, uin); | |
| 44 | } | |
| 45 | ||
| 46 | void icq_ChatSessionSetStatus(icq_ChatSession *p, int status) | |
| 47 | { | |
| 48 | p->status=status; | |
| 49 | if(p->id) | |
| 50 | if(p->icqlink->icq_RequestNotify) | |
| 51 | (*p->icqlink->icq_RequestNotify)(p->icqlink, p->id, ICQ_NOTIFY_CHAT, status, 0); | |
| 52 | } |