1 /*
2  * gtalk-file-collection.h - Header for GTalkFileCollection
3  * Copyright (C) 2010 Collabora Ltd.
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18  */
19 
20 #ifndef __GTALK_FILE_COLLECTION_H__
21 #define __GTALK_FILE_COLLECTION_H__
22 
23 #include <glib-object.h>
24 #include <wocky/wocky.h>
25 #include "connection.h"
26 
27 typedef struct _GTalkFileCollection GTalkFileCollection;
28 
29 typedef enum {
30   GTALK_FILE_COLLECTION_STATE_PENDING,
31   GTALK_FILE_COLLECTION_STATE_ACCEPTED,
32   GTALK_FILE_COLLECTION_STATE_OPEN,
33   GTALK_FILE_COLLECTION_STATE_TERMINATED,
34   GTALK_FILE_COLLECTION_STATE_CONNECTION_FAILED,
35   GTALK_FILE_COLLECTION_STATE_ERROR,
36   GTALK_FILE_COLLECTION_STATE_COMPLETED
37 } GTalkFileCollectionState;
38 
39 #include "ft-channel.h"
40 
41 G_BEGIN_DECLS
42 
43 typedef struct _GTalkFileCollectionClass GTalkFileCollectionClass;
44 
45 GType gtalk_file_collection_get_type (void);
46 
47 /* TYPE MACROS */
48 #define GTALK_TYPE_FILE_COLLECTION \
49   (gtalk_file_collection_get_type ())
50 #define GTALK_FILE_COLLECTION(obj) \
51   (G_TYPE_CHECK_INSTANCE_CAST((obj), GTALK_TYPE_FILE_COLLECTION, \
52                               GTalkFileCollection))
53 #define GTALK_FILE_COLLECTION_CLASS(klass) \
54   (G_TYPE_CHECK_CLASS_CAST((klass), GTALK_TYPE_FILE_COLLECTION, \
55                            GTalkFileCollectionClass))
56 #define GTALK_IS_FILE_COLLECTION(obj) \
57   (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTALK_TYPE_FILE_COLLECTION))
58 #define GTALK_IS_FILE_COLLECTION_CLASS(klass) \
59   (G_TYPE_CHECK_CLASS_TYPE((klass), GTALK_TYPE_FILE_COLLECTION))
60 #define GTALK_FILE_COLLECTION_GET_CLASS(obj) \
61   (G_TYPE_INSTANCE_GET_CLASS ((obj), GTALK_TYPE_FILE_COLLECTION, \
62                               GTalkFileCollectionClass))
63 
64 struct _GTalkFileCollectionClass {
65     GObjectClass parent_class;
66 };
67 
68 typedef struct _GTalkFileCollectionPrivate GTalkFileCollectionPrivate;
69 
70 struct _GTalkFileCollection {
71     GObject parent;
72     GTalkFileCollectionPrivate *priv;
73 };
74 
75 GTalkFileCollection *gtalk_file_collection_new (
76     GabbleFileTransferChannel *channel, WockyJingleFactory *jingle_factory,
77     TpHandle handle, const gchar *jid);
78 
79 GTalkFileCollection *gtalk_file_collection_new_from_session (
80     WockyJingleFactory *jingle_factory, WockyJingleSession *session);
81 
82 void gtalk_file_collection_add_channel (GTalkFileCollection *self,
83     GabbleFileTransferChannel *channel);
84 
85 void gtalk_file_collection_initiate (GTalkFileCollection *self,
86     GabbleFileTransferChannel *channel);
87 void gtalk_file_collection_accept (GTalkFileCollection *self,
88     GabbleFileTransferChannel *channel);
89 void gtalk_file_collection_terminate (GTalkFileCollection *self,
90     GabbleFileTransferChannel *channel);
91 void gtalk_file_collection_completed (GTalkFileCollection *self,
92     GabbleFileTransferChannel *channel);
93 void gtalk_file_collection_block_reading (GTalkFileCollection *self,
94     GabbleFileTransferChannel *channel, gboolean block);
95 gboolean gtalk_file_collection_send_data (GTalkFileCollection *self,
96     GabbleFileTransferChannel *channel, const gchar *data, guint length);
97 
98 void gtalk_file_collection_set_test_mode (void);
99 
100 #endif /* __GTALK_FILE_COLLECTION_H__ */
101 
102