source: protocols/bee_ft.c @ cb80802

Last change on this file since cb80802 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
RevLine 
[17a6ee9]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;
[6f10697]20  if not, write to the Free Software Foundation, Inc., 51 Franklin St.,
21  Fifth Floor, Boston, MA  02110-1301  USA
[17a6ee9]22*/
23
24#define BITLBEE_CORE
25#include "bitlbee.h"
26#include "ft.h"
27
[5ebff60]28file_transfer_t *imcb_file_send_start(struct im_connection *ic, char *handle, char *file_name, size_t file_size)
[17a6ee9]29{
[5ebff60]30        bee_t *bee = ic->bee;
31        bee_user_t *bu = bee_user_by_handle(bee, ic, handle);
32
[701ab812]33        if (bee->ui->ft_in_start && bu) {
[5ebff60]34                return bee->ui->ft_in_start(bee, bu, file_name, file_size);
35        } else {
[17a6ee9]36                return NULL;
[5ebff60]37        }
[17a6ee9]38}
39
[5ebff60]40gboolean imcb_file_recv_start(struct im_connection *ic, file_transfer_t *ft)
[17a6ee9]41{
42        bee_t *bee = ic->bee;
[5ebff60]43
44        if (bee->ui->ft_out_start) {
45                return bee->ui->ft_out_start(ic, ft);
46        } else {
[17a6ee9]47                return FALSE;
[5ebff60]48        }
[17a6ee9]49}
50
[5ebff60]51void imcb_file_canceled(struct im_connection *ic, file_transfer_t *file, char *reason)
[17a6ee9]52{
53        bee_t *bee = ic->bee;
[5ebff60]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        }
[17a6ee9]62}
63
[5ebff60]64void imcb_file_finished(struct im_connection *ic, file_transfer_t *file)
[17a6ee9]65{
66        bee_t *bee = ic->bee;
[5ebff60]67
68        if (bee->ui->ft_finished) {
69                bee->ui->ft_finished(ic, file);
70        }
[17a6ee9]71}
Note: See TracBrowser for help on using the repository browser.