libpurple/xfer.c

branch
gtkdoc-conversion
changeset 35466
e259e75f1c6f
parent 35454
cf2a24d01503
child 35489
e1452d2416ed
child 37072
b4d3e353c563
equal deleted inserted replaced
35465:ff7632670775 35466:e259e75f1c6f
37 #define FT_MAX_BUFFER_SIZE 65535 37 #define FT_MAX_BUFFER_SIZE 65535
38 38
39 #define PURPLE_XFER_GET_PRIVATE(obj) \ 39 #define PURPLE_XFER_GET_PRIVATE(obj) \
40 (G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_XFER, PurpleXferPrivate)) 40 (G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_XFER, PurpleXferPrivate))
41 41
42 /** @copydoc _PurpleXferPrivate */
43 typedef struct _PurpleXferPrivate PurpleXferPrivate; 42 typedef struct _PurpleXferPrivate PurpleXferPrivate;
44 43
45 static PurpleXferUiOps *xfer_ui_ops = NULL; 44 static PurpleXferUiOps *xfer_ui_ops = NULL;
46 static GList *xfers; 45 static GList *xfers;
47 46
48 /** Private data for a file transfer */ 47 /* Private data for a file transfer */
49 struct _PurpleXferPrivate { 48 struct _PurpleXferPrivate {
50 PurpleXferType type; /**< The type of transfer. */ 49 PurpleXferType type; /* The type of transfer. */
51 50
52 PurpleAccount *account; /**< The account. */ 51 PurpleAccount *account; /* The account. */
53 52
54 char *who; /**< The person on the other end of the 53 char *who; /* The person on the other end of the
55 transfer. */ 54 transfer. */
56 55
57 char *message; /**< A message sent with the request */ 56 char *message; /* A message sent with the request */
58 char *filename; /**< The name sent over the network. */ 57 char *filename; /* The name sent over the network. */
59 char *local_filename; /**< The name on the local hard drive. */ 58 char *local_filename; /* The name on the local hard drive. */
60 goffset size; /**< The size of the file. */ 59 goffset size; /* The size of the file. */
61 60
62 FILE *dest_fp; /**< The destination file pointer. */ 61 FILE *dest_fp; /* The destination file pointer. */
63 62
64 char *remote_ip; /**< The remote IP address. */ 63 char *remote_ip; /* The remote IP address. */
65 guint16 local_port; /**< The local port. */ 64 guint16 local_port; /* The local port. */
66 guint16 remote_port; /**< The remote port. */ 65 guint16 remote_port; /* The remote port. */
67 66
68 int fd; /**< The socket file descriptor. */ 67 int fd; /* The socket file descriptor. */
69 int watcher; /**< Watcher. */ 68 int watcher; /* Watcher. */
70 69
71 goffset bytes_sent; /**< The number of bytes sent. */ 70 goffset bytes_sent; /* The number of bytes sent. */
72 goffset bytes_remaining; /**< The number of bytes remaining. */ 71 goffset bytes_remaining; /* The number of bytes remaining. */
73 time_t start_time; /**< When the transfer of data began. */ 72 time_t start_time; /* When the transfer of data began. */
74 time_t end_time; /**< When the transfer of data ended. */ 73 time_t end_time; /* When the transfer of data ended. */
75 74
76 size_t current_buffer_size; /**< This gradually increases for fast 75 size_t current_buffer_size; /* This gradually increases for fast
77 network connections. */ 76 network connections. */
78 77
79 PurpleXferStatus status; /**< File Transfer's status. */ 78 PurpleXferStatus status; /* File Transfer's status. */
80 79
81 /** I/O operations, which should be set by the prpl using 80 /* I/O operations, which should be set by the prpl using
82 * purple_xfer_set_init_fnc() and friends. Setting #init is 81 * purple_xfer_set_init_fnc() and friends. Setting #init is
83 * mandatory; all others are optional. 82 * mandatory; all others are optional.
84 */ 83 */
85 struct 84 struct
86 { 85 {
87 void (*init)(PurpleXfer *xfer); 86 void (*init)(PurpleXfer *xfer);
88 void (*request_denied)(PurpleXfer *xfer); 87 void (*request_denied)(PurpleXfer *xfer);
93 gssize (*read)(guchar **buffer, size_t size, PurpleXfer *xfer); 92 gssize (*read)(guchar **buffer, size_t size, PurpleXfer *xfer);
94 gssize (*write)(const guchar *buffer, size_t size, PurpleXfer *xfer); 93 gssize (*write)(const guchar *buffer, size_t size, PurpleXfer *xfer);
95 void (*ack)(PurpleXfer *xfer, const guchar *buffer, size_t size); 94 void (*ack)(PurpleXfer *xfer, const guchar *buffer, size_t size);
96 } ops; 95 } ops;
97 96
98 PurpleXferUiOps *ui_ops; /**< UI-specific operations. */ 97 PurpleXferUiOps *ui_ops; /* UI-specific operations. */
99 98
100 /* TODO Remove this and use protocol-specific subclasses. */ 99 /* TODO Remove this and use protocol-specific subclasses. */
101 void *proto_data; /**< prpl-specific data. */ 100 void *proto_data; /* prpl-specific data. */
102 101
103 /* 102 /*
104 * Used to moderate the file transfer when either the read/write ui_ops are 103 * Used to moderate the file transfer when either the read/write ui_ops are
105 * set or fd is not set. In those cases, the UI/prpl call the respective 104 * set or fd is not set. In those cases, the UI/prpl call the respective
106 * function, which is somewhat akin to a fd watch being triggered. 105 * function, which is somewhat akin to a fd watch being triggered.
112 } ready; 111 } ready;
113 112
114 /* TODO: Should really use a PurpleCircBuffer for this. */ 113 /* TODO: Should really use a PurpleCircBuffer for this. */
115 GByteArray *buffer; 114 GByteArray *buffer;
116 115
117 gpointer thumbnail_data; /**< thumbnail image */ 116 gpointer thumbnail_data; /* thumbnail image */
118 gsize thumbnail_size; 117 gsize thumbnail_size;
119 gchar *thumbnail_mimetype; 118 gchar *thumbnail_mimetype;
120 }; 119 };
121 120
122 /* GObject property enums */ 121 /* GObject property enums */

mercurial