Mercurial > pidgin.yaz
comparison plugins/icq/filesession.c @ 1912:8ed70631ed15
[gaim-migrate @ 1922]
new icqlib
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Tue, 29 May 2001 10:32:53 +0000 |
parents | e06dcc3025a9 |
children | 7b3f1eb1ef7d |
comparison
equal
deleted
inserted
replaced
1911:db3104dda736 | 1912:8ed70631ed15 |
---|---|
1 /* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | |
2 | |
3 /* | |
4 * Copyright (C) 1998-2001, Denis V. Dmitrienko <denis@null.net> and | |
5 * Bill Soudan <soudan@kde.org> | |
6 * | |
7 * This program is free software; you can redistribute it and/or modify | |
8 * it under the terms of the GNU General Public License as published by | |
9 * the Free Software Foundation; either version 2 of the License, or | |
10 * (at your option) any later version. | |
11 * | |
12 * This program is distributed in the hope that it will be useful, | |
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 * GNU General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU General Public License | |
18 * along with this program; if not, write to the Free Software | |
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |
20 * | |
21 */ | |
22 | |
1 #include <stdlib.h> | 23 #include <stdlib.h> |
2 #include <fcntl.h> | 24 #include <fcntl.h> |
3 #include <stdio.h> | |
4 #include <string.h> | |
5 #include <sys/stat.h> | 25 #include <sys/stat.h> |
6 | 26 |
7 #ifdef _MSVC_ | 27 #ifdef _MSVC_ |
8 #include <io.h> | 28 #include <io.h> |
9 #define open _open | 29 #define open _open |
12 #define write _write | 32 #define write _write |
13 #endif | 33 #endif |
14 | 34 |
15 #include "icqlib.h" | 35 #include "icqlib.h" |
16 #include "filesession.h" | 36 #include "filesession.h" |
17 #include "list.h" | |
18 #include "icqpacket.h" | |
19 #include "stdpackets.h" | 37 #include "stdpackets.h" |
20 | 38 |
21 icq_FileSession *icq_FileSessionNew(ICQLINK *icqlink) | 39 icq_FileSession *icq_FileSessionNew(icq_Link *icqlink) |
22 { | 40 { |
23 icq_FileSession *p=(icq_FileSession *)malloc(sizeof(icq_FileSession)); | 41 icq_FileSession *p=(icq_FileSession *)malloc(sizeof(icq_FileSession)); |
24 | 42 |
25 if (p) | 43 if (p) |
26 { | 44 { |
37 p->total_bytes=0; | 55 p->total_bytes=0; |
38 p->total_files=0; | 56 p->total_files=0; |
39 p->total_transferred_bytes=0; | 57 p->total_transferred_bytes=0; |
40 p->working_dir[0]=0; | 58 p->working_dir[0]=0; |
41 p->user_data=NULL; | 59 p->user_data=NULL; |
42 list_insert(icqlink->d->icq_FileSessions, 0, p); | 60 icq_ListInsert(icqlink->d->icq_FileSessions, 0, p); |
43 } | 61 } |
44 | 62 |
45 return p; | 63 return p; |
46 } | 64 } |
47 | 65 |
75 | 93 |
76 return (psession->remote_uin == uin) && ( id ? (psession->id == id) : 1 ); | 94 return (psession->remote_uin == uin) && ( id ? (psession->id == id) : 1 ); |
77 | 95 |
78 } | 96 } |
79 | 97 |
80 icq_FileSession *icq_FindFileSession(ICQLINK *icqlink, DWORD uin, | 98 icq_FileSession *icq_FindFileSession(icq_Link *icqlink, DWORD uin, |
81 unsigned long id) | 99 unsigned long id) |
82 { | 100 { |
83 return list_traverse(icqlink->d->icq_FileSessions, _icq_FindFileSession, | 101 return icq_ListTraverse(icqlink->d->icq_FileSessions, _icq_FindFileSession, |
84 uin, id); | 102 uin, id); |
85 } | 103 } |
86 | 104 |
87 void icq_FileSessionSetStatus(icq_FileSession *p, int status) | 105 void icq_FileSessionSetStatus(icq_FileSession *p, int status) |
88 { | 106 { |
226 icq_TCPLinkClose(plink); | 244 icq_TCPLinkClose(plink); |
227 } | 245 } |
228 | 246 |
229 icq_FileSessionDelete(p); | 247 icq_FileSessionDelete(p); |
230 | 248 |
231 list_remove(p->icqlink->d->icq_FileSessions, p); | 249 icq_ListRemove(p->icqlink->d->icq_FileSessions, p); |
232 } | 250 } |
233 | 251 |
234 void icq_FileSessionSetWorkingDir(icq_FileSession *p, const char *dir) | 252 void icq_FileSessionSetWorkingDir(icq_FileSession *p, const char *dir) |
235 { | 253 { |
236 strncpy(p->working_dir, dir, 512); | 254 strncpy(p->working_dir, dir, 512); |