source: protocols/bee_ft.c @ e199620

Last change on this file since e199620 was 701ab812, checked in by dequis <dx@…>, at 2016-11-13T19:52:43Z

imcb_file_send_start: handle ft attempts from non-existing users

  • Property mode set to 100644
File size: 2.1 KB
Line 
1/********************************************************************\
2* BitlBee -- An IRC to other IM-networks gateway                     *
3*                                                                    *
4* Copyright 2010 Wilmer van der Gaast <wilmer@gaast.net>             *
5\********************************************************************/
6
7/*
8  This program is free software; you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation; either version 2 of the License, or
11  (at your option) any later version.
12
13  This program is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  GNU General Public License for more details.
17
18  You should have received a copy of the GNU General Public License with
19  the Debian GNU/Linux distribution in /usr/share/common-licenses/GPL;
20  if not, write to the Free Software Foundation, Inc., 51 Franklin St.,
21  Fifth Floor, Boston, MA  02110-1301  USA
22*/
23
24#define BITLBEE_CORE
25#include "bitlbee.h"
26#include "ft.h"
27
28file_transfer_t *imcb_file_send_start(struct im_connection *ic, char *handle, char *file_name, size_t file_size)
29{
30        bee_t *bee = ic->bee;
31        bee_user_t *bu = bee_user_by_handle(bee, ic, handle);
32
33        if (bee->ui->ft_in_start && bu) {
34                return bee->ui->ft_in_start(bee, bu, file_name, file_size);
35        } else {
36                return NULL;
37        }
38}
39
40gboolean imcb_file_recv_start(struct im_connection *ic, file_transfer_t *ft)
41{
42        bee_t *bee = ic->bee;
43
44        if (bee->ui->ft_out_start) {
45                return bee->ui->ft_out_start(ic, ft);
46        } else {
47                return FALSE;
48        }
49}
50
51void imcb_file_canceled(struct im_connection *ic, file_transfer_t *file, char *reason)
52{
53        bee_t *bee = ic->bee;
54
55        if (file->canceled) {
56                file->canceled(file, reason);
57        }
58
59        if (bee->ui->ft_close) {
60                bee->ui->ft_close(ic, file);
61        }
62}
63
64void imcb_file_finished(struct im_connection *ic, file_transfer_t *file)
65{
66        bee_t *bee = ic->bee;
67
68        if (bee->ui->ft_finished) {
69                bee->ui->ft_finished(ic, file);
70        }
71}
Note: See TracBrowser for help on using the repository browser.