Mercurial > pidgin
changeset 6240:ac191233b816
[gaim-migrate @ 6734]
Updated the file transfer API to resemble that of the rest of Gaim's API.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Sun, 20 Jul 2003 03:30:43 +0000 |
parents | 8d10cdfe1bb1 |
children | 9ce44a7f9ae7 |
files | src/ft.c src/ft.h src/gtkft.c src/gtkft.h src/protocols/irc/irc.c src/protocols/jabber/jabber.c src/protocols/oscar/oscar.c |
diffstat | 7 files changed, 334 insertions(+), 382 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ft.c Sun Jul 20 03:05:58 2003 +0000 +++ b/src/ft.c Sun Jul 20 03:30:43 2003 +0000 @@ -25,19 +25,19 @@ #include "notify.h" #include "proxy.h" -static struct gaim_xfer_ui_ops *xfer_ui_ops = NULL; +static GaimXferUiOps *xfer_ui_ops = NULL; -struct gaim_xfer * -gaim_xfer_new(GaimAccount *account, GaimXferType type, - const char *who) +GaimXfer * +gaim_xfer_new(GaimAccount *account, GaimXferType type, const char *who) { - struct gaim_xfer *xfer; - struct gaim_xfer_ui_ops *ui_ops; + GaimXfer *xfer; + GaimXferUiOps *ui_ops; - if (account == NULL || type == GAIM_XFER_UNKNOWN || who == NULL) - return NULL; + g_return_val_if_fail(type != GAIM_XFER_UNKNOWN, NULL); + g_return_val_if_fail(account != NULL, NULL); + g_return_val_if_fail(who != NULL, NULL); - xfer = g_malloc0(sizeof(struct gaim_xfer)); + xfer = g_new0(GaimXfer, 1); xfer->type = type; xfer->account = account; @@ -46,19 +46,18 @@ ui_ops = gaim_xfer_get_ui_ops(xfer); - if (ui_ops != NULL && ui_ops->new != NULL) - ui_ops->new(xfer); + if (ui_ops != NULL && ui_ops->new_xfer != NULL) + ui_ops->new_xfer(xfer); return xfer; } void -gaim_xfer_destroy(struct gaim_xfer *xfer) +gaim_xfer_destroy(GaimXfer *xfer) { - struct gaim_xfer_ui_ops *ui_ops; + GaimXferUiOps *ui_ops; - if (xfer == NULL) - return; + g_return_if_fail(xfer != NULL); if (!xfer->completed) gaim_xfer_cancel_local(xfer); @@ -81,12 +80,12 @@ } void -gaim_xfer_request(struct gaim_xfer *xfer) +gaim_xfer_request(GaimXfer *xfer) { - struct gaim_xfer_ui_ops *ui_ops; + GaimXferUiOps *ui_ops; - if (xfer == NULL || xfer->ops.init == NULL) - return; + g_return_if_fail(xfer != NULL); + g_return_if_fail(xfer->ops.init != NULL); ui_ops = gaim_get_xfer_ui_ops(); @@ -97,7 +96,7 @@ } void -gaim_xfer_request_accepted(struct gaim_xfer *xfer, char *filename) +gaim_xfer_request_accepted(GaimXfer *xfer, char *filename) { GaimXferType type; @@ -157,10 +156,9 @@ } void -gaim_xfer_request_denied(struct gaim_xfer *xfer) +gaim_xfer_request_denied(GaimXfer *xfer) { - if (xfer == NULL) - return; + g_return_if_fail(xfer != NULL); gaim_xfer_destroy(xfer); @@ -168,82 +166,73 @@ } GaimXferType -gaim_xfer_get_type(const struct gaim_xfer *xfer) +gaim_xfer_get_type(const GaimXfer *xfer) { - if (xfer == NULL) - return GAIM_XFER_UNKNOWN; + g_return_val_if_fail(xfer != NULL, GAIM_XFER_UNKNOWN); return xfer->type; } GaimAccount * -gaim_xfer_get_account(const struct gaim_xfer *xfer) +gaim_xfer_get_account(const GaimXfer *xfer) { - if (xfer == NULL) - return NULL; + g_return_val_if_fail(xfer != NULL, NULL); return xfer->account; } gboolean -gaim_xfer_is_completed(const struct gaim_xfer *xfer) +gaim_xfer_is_completed(const GaimXfer *xfer) { - if (xfer == NULL) - return TRUE; + g_return_val_if_fail(xfer != NULL, TRUE); return xfer->completed; } const char * -gaim_xfer_get_filename(const struct gaim_xfer *xfer) +gaim_xfer_get_filename(const GaimXfer *xfer) { - if (xfer == NULL) - return NULL; + g_return_val_if_fail(xfer != NULL, NULL); return xfer->filename; } const char * -gaim_xfer_get_local_filename(const struct gaim_xfer *xfer) +gaim_xfer_get_local_filename(const GaimXfer *xfer) { - if (xfer == NULL) - return NULL; + g_return_val_if_fail(xfer != NULL, NULL); return xfer->local_filename; } size_t -gaim_xfer_get_bytes_sent(const struct gaim_xfer *xfer) +gaim_xfer_get_bytes_sent(const GaimXfer *xfer) { - if (xfer == NULL) - return 0; + g_return_val_if_fail(xfer != NULL, 0); return xfer->bytes_sent; } size_t -gaim_xfer_get_bytes_remaining(const struct gaim_xfer *xfer) +gaim_xfer_get_bytes_remaining(const GaimXfer *xfer) { - if (xfer == NULL) - return 0; + g_return_val_if_fail(xfer != NULL, 0); return xfer->bytes_remaining; } size_t -gaim_xfer_get_size(const struct gaim_xfer *xfer) +gaim_xfer_get_size(const GaimXfer *xfer) { - if (xfer == NULL) - return 0; + g_return_val_if_fail(xfer != NULL, 0); return xfer->size; } double -gaim_xfer_get_progress(const struct gaim_xfer *xfer) +gaim_xfer_get_progress(const GaimXfer *xfer) { - if (xfer == NULL) - return 0.0; + g_return_val_if_fail(xfer != NULL, 0.0); if (gaim_xfer_get_size(xfer) == 0) return 0.0; @@ -253,48 +242,43 @@ } const char * -gaim_xfer_get_local_ip(const struct gaim_xfer *xfer) +gaim_xfer_get_local_ip(const GaimXfer *xfer) { - if (xfer == NULL) - return NULL; + g_return_val_if_fail(xfer != NULL, NULL); return xfer->local_ip; } unsigned int -gaim_xfer_get_local_port(const struct gaim_xfer *xfer) +gaim_xfer_get_local_port(const GaimXfer *xfer) { - if (xfer == NULL) - return -1; + g_return_val_if_fail(xfer != NULL, -1); return xfer->local_port; } const char * -gaim_xfer_get_remote_ip(const struct gaim_xfer *xfer) +gaim_xfer_get_remote_ip(const GaimXfer *xfer) { - if (xfer == NULL) - return NULL; + g_return_val_if_fail(xfer != NULL, NULL); return xfer->remote_ip; } unsigned int -gaim_xfer_get_remote_port(const struct gaim_xfer *xfer) +gaim_xfer_get_remote_port(const GaimXfer *xfer) { - if (xfer == NULL) - return -1; + g_return_val_if_fail(xfer != NULL, -1); return xfer->remote_port; } void -gaim_xfer_set_completed(struct gaim_xfer *xfer, gboolean completed) +gaim_xfer_set_completed(GaimXfer *xfer, gboolean completed) { - struct gaim_xfer_ui_ops *ui_ops; + GaimXferUiOps *ui_ops; - if (xfer == NULL) - return; + g_return_if_fail(xfer != NULL); xfer->completed = completed; @@ -306,10 +290,9 @@ } void -gaim_xfer_set_filename(struct gaim_xfer *xfer, const char *filename) +gaim_xfer_set_filename(GaimXfer *xfer, const char *filename) { - if (xfer == NULL) - return; + g_return_if_fail(xfer != NULL); if (xfer->filename != NULL) g_free(xfer->filename); @@ -318,10 +301,9 @@ } void -gaim_xfer_set_local_filename(struct gaim_xfer *xfer, const char *filename) +gaim_xfer_set_local_filename(GaimXfer *xfer, const char *filename) { - if (xfer == NULL) - return; + g_return_if_fail(xfer != NULL); if (xfer->local_filename != NULL) g_free(xfer->local_filename); @@ -330,10 +312,9 @@ } void -gaim_xfer_set_size(struct gaim_xfer *xfer, size_t size) +gaim_xfer_set_size(GaimXfer *xfer, size_t size) { - if (xfer == NULL) - return; + g_return_if_fail(xfer != NULL); if (xfer->size == 0) xfer->bytes_remaining = size - xfer->bytes_sent; @@ -341,104 +322,88 @@ xfer->size = size; } -struct gaim_xfer_ui_ops * -gaim_xfer_get_ui_ops(const struct gaim_xfer *xfer) +GaimXferUiOps * +gaim_xfer_get_ui_ops(const GaimXfer *xfer) { - if (xfer == NULL) - return NULL; + g_return_val_if_fail(xfer != NULL, NULL); return xfer->ui_ops; } void -gaim_xfer_set_init_fnc(struct gaim_xfer *xfer, - void (*fnc)(struct gaim_xfer *)) +gaim_xfer_set_init_fnc(GaimXfer *xfer, void (*fnc)(GaimXfer *)) { - if (xfer == NULL) - return; + g_return_if_fail(xfer != NULL); xfer->ops.init = fnc; } void -gaim_xfer_set_read_fnc(struct gaim_xfer *xfer, - size_t (*fnc)(char **, struct gaim_xfer *)) +gaim_xfer_set_read_fnc(GaimXfer *xfer, size_t (*fnc)(char **, GaimXfer *)) { - if (xfer == NULL) - return; + g_return_if_fail(xfer != NULL); xfer->ops.read = fnc; } void -gaim_xfer_set_write_fnc(struct gaim_xfer *xfer, - size_t (*fnc)(const char *, size_t, - struct gaim_xfer *)) +gaim_xfer_set_write_fnc(GaimXfer *xfer, + size_t (*fnc)(const char *, size_t, GaimXfer *)) { - if (xfer == NULL) - return; + g_return_if_fail(xfer != NULL); xfer->ops.write = fnc; } void -gaim_xfer_set_ack_fnc(struct gaim_xfer *xfer, - void (*fnc)(struct gaim_xfer *, const char *, size_t)) +gaim_xfer_set_ack_fnc(GaimXfer *xfer, + void (*fnc)(GaimXfer *, const char *, size_t)) { - if (xfer == NULL) - return; + g_return_if_fail(xfer != NULL); xfer->ops.ack = fnc; } void -gaim_xfer_set_start_fnc(struct gaim_xfer *xfer, - void (*fnc)(struct gaim_xfer *)) +gaim_xfer_set_start_fnc(GaimXfer *xfer, void (*fnc)(GaimXfer *)) { - if (xfer == NULL) - return; + g_return_if_fail(xfer != NULL); xfer->ops.start = fnc; } void -gaim_xfer_set_end_fnc(struct gaim_xfer *xfer, - void (*fnc)(struct gaim_xfer *)) +gaim_xfer_set_end_fnc(GaimXfer *xfer, void (*fnc)(GaimXfer *)) { - if (xfer == NULL) - return; + g_return_if_fail(xfer != NULL); xfer->ops.end = fnc; } void -gaim_xfer_set_cancel_send_fnc(struct gaim_xfer *xfer, - void (*fnc)(struct gaim_xfer *)) +gaim_xfer_set_cancel_send_fnc(GaimXfer *xfer, void (*fnc)(GaimXfer *)) { - if (xfer == NULL) - return; + g_return_if_fail(xfer != NULL); xfer->ops.cancel_send = fnc; } void -gaim_xfer_set_cancel_recv_fnc(struct gaim_xfer *xfer, - void (*fnc)(struct gaim_xfer *)) +gaim_xfer_set_cancel_recv_fnc(GaimXfer *xfer, void (*fnc)(GaimXfer *)) { - if (xfer == NULL) - return; + g_return_if_fail(xfer != NULL); xfer->ops.cancel_recv = fnc; } size_t -gaim_xfer_read(struct gaim_xfer *xfer, char **buffer) +gaim_xfer_read(GaimXfer *xfer, char **buffer) { size_t s, r; - if (xfer == NULL || buffer == NULL) - return 0; + g_return_val_if_fail(xfer != NULL, 0); + g_return_val_if_fail(buffer != NULL, 0); if (gaim_xfer_get_size(xfer) == 0) s = 4096; @@ -460,12 +425,13 @@ } size_t -gaim_xfer_write(struct gaim_xfer *xfer, const char *buffer, size_t size) +gaim_xfer_write(GaimXfer *xfer, const char *buffer, size_t size) { size_t r, s; - if (xfer == NULL || buffer == NULL || size == 0) - return 0; + g_return_val_if_fail(xfer != NULL, 0); + g_return_val_if_fail(buffer != NULL, 0); + g_return_val_if_fail(size != 0, 0); s = MIN(gaim_xfer_get_bytes_remaining(xfer), size); @@ -480,8 +446,8 @@ static void transfer_cb(gpointer data, gint source, GaimInputCondition condition) { - struct gaim_xfer_ui_ops *ui_ops; - struct gaim_xfer *xfer = (struct gaim_xfer *)data; + GaimXferUiOps *ui_ops; + GaimXfer *xfer = (GaimXfer *)data; char *buffer = NULL; size_t r; @@ -526,9 +492,9 @@ } static void -begin_transfer(struct gaim_xfer *xfer, GaimInputCondition cond) +begin_transfer(GaimXfer *xfer, GaimInputCondition cond) { - struct gaim_xfer_ui_ops *ui_ops; + GaimXferUiOps *ui_ops; GaimXferType type = gaim_xfer_get_type(xfer); ui_ops = gaim_xfer_get_ui_ops(xfer); @@ -558,7 +524,7 @@ static void connect_cb(gpointer data, gint source, GaimInputCondition condition) { - struct gaim_xfer *xfer = (struct gaim_xfer *)data; + GaimXfer *xfer = (GaimXfer *)data; xfer->fd = source; @@ -566,14 +532,14 @@ } void -gaim_xfer_start(struct gaim_xfer *xfer, int fd, const char *ip, +gaim_xfer_start(GaimXfer *xfer, int fd, const char *ip, unsigned int port) { GaimInputCondition cond; GaimXferType type; - if (xfer == NULL || gaim_xfer_get_type(xfer) == GAIM_XFER_UNKNOWN) - return; + g_return_if_fail(xfer != NULL); + g_return_if_fail(gaim_xfer_get_type(xfer) != GAIM_XFER_UNKNOWN); type = gaim_xfer_get_type(xfer); @@ -607,10 +573,9 @@ } void -gaim_xfer_end(struct gaim_xfer *xfer) +gaim_xfer_end(GaimXfer *xfer) { - if (xfer == NULL) - return; + g_return_if_fail(xfer != NULL); /* See if we are actually trying to cancel this. */ if (!xfer->completed) { @@ -636,12 +601,11 @@ } void -gaim_xfer_cancel_local(struct gaim_xfer *xfer) +gaim_xfer_cancel_local(GaimXfer *xfer) { - struct gaim_xfer_ui_ops *ui_ops; + GaimXferUiOps *ui_ops; - if (xfer == NULL) - return; + g_return_if_fail(xfer != NULL); if (gaim_xfer_get_type(xfer) == GAIM_XFER_SEND) { @@ -676,12 +640,11 @@ } void -gaim_xfer_cancel_remote(struct gaim_xfer *xfer) +gaim_xfer_cancel_remote(GaimXfer *xfer) { - struct gaim_xfer_ui_ops *ui_ops; + GaimXferUiOps *ui_ops; - if (xfer == NULL) - return; + g_return_if_fail(xfer != NULL); if (gaim_xfer_get_type(xfer) == GAIM_XFER_SEND) { @@ -720,8 +683,8 @@ { char *title; - if (msg == NULL || type == GAIM_XFER_UNKNOWN) - return; + g_return_if_fail(msg != NULL); + g_return_if_fail(type != GAIM_XFER_UNKNOWN); if (type == GAIM_XFER_SEND) title = g_strdup_printf(_("File transfer to %s aborted.\n"), who); @@ -734,15 +697,14 @@ } void -gaim_set_xfer_ui_ops(struct gaim_xfer_ui_ops *ops) +gaim_set_xfer_ui_ops(GaimXferUiOps *ops) { - if (ops == NULL) - return; + g_return_if_fail(ops != NULL); xfer_ui_ops = ops; } -struct gaim_xfer_ui_ops * +GaimXferUiOps * gaim_get_xfer_ui_ops(void) { return xfer_ui_ops;
--- a/src/ft.h Sun Jul 20 03:05:58 2003 +0000 +++ b/src/ft.h Sun Jul 20 03:30:43 2003 +0000 @@ -26,7 +26,7 @@ /**************************************************************************/ /** Data Structures */ /**************************************************************************/ -struct gaim_xfer; +typedef struct _GaimXfer GaimXfer; #include "account.h" @@ -45,28 +45,29 @@ * File transfer UI operations. * * Any UI representing a file transfer must assign a filled-out - * gaim_xfer_ui_ops structure to the gaim_xfer. + * GaimXferUiOps structure to the gaim_xfer. */ -struct gaim_xfer_ui_ops +typedef struct { - void (*new)(struct gaim_xfer *xfer); - void (*destroy)(struct gaim_xfer *xfer); - void (*request_file)(struct gaim_xfer *xfer); - void (*ask_cancel)(struct gaim_xfer *xfer); - void (*add_xfer)(struct gaim_xfer *xfer); - void (*update_progress)(struct gaim_xfer *xfer, double percent); - void (*cancel_local)(struct gaim_xfer *xfer); - void (*cancel_remote)(struct gaim_xfer *xfer); -}; + void (*new_xfer)(GaimXfer *xfer); + void (*destroy)(GaimXfer *xfer); + void (*request_file)(GaimXfer *xfer); + void (*ask_cancel)(GaimXfer *xfer); + void (*add_xfer)(GaimXfer *xfer); + void (*update_progress)(GaimXfer *xfer, double percent); + void (*cancel_local)(GaimXfer *xfer); + void (*cancel_remote)(GaimXfer *xfer); + +} GaimXferUiOps; /** * A core representation of a file transfer. */ -struct gaim_xfer +struct _GaimXfer { GaimXferType type; /**< The type of transfer. */ - GaimAccount *account; /**< The account. */ + GaimAccount *account; /**< The account. */ char *who; /**< The person on the other end of the transfer. */ @@ -93,20 +94,18 @@ /* I/O operations. */ struct { - void (*init)(struct gaim_xfer *xfer); - void (*start)(struct gaim_xfer *xfer); - void (*end)(struct gaim_xfer *xfer); - void (*cancel_send)(struct gaim_xfer *xfer); - void (*cancel_recv)(struct gaim_xfer *xfer); - size_t (*read)(char **buffer, struct gaim_xfer *xfer); - size_t (*write)(const char *buffer, size_t size, - struct gaim_xfer *xfer); - void (*ack)(struct gaim_xfer *xfer, const char *buffer, - size_t size); + void (*init)(GaimXfer *xfer); + void (*start)(GaimXfer *xfer); + void (*end)(GaimXfer *xfer); + void (*cancel_send)(GaimXfer *xfer); + void (*cancel_recv)(GaimXfer *xfer); + size_t (*read)(char **buffer, GaimXfer *xfer); + size_t (*write)(const char *buffer, size_t size, GaimXfer *xfer); + void (*ack)(GaimXfer *xfer, const char *buffer, size_t size); } ops; - struct gaim_xfer_ui_ops *ui_ops; /**< UI-specific operations. */ + GaimXferUiOps *ui_ops; /**< UI-specific operations. */ void *ui_data; /**< UI-specific data. */ void *data; /**< prpl-specific data. */ @@ -130,7 +129,7 @@ * * @return A file transfer handle. */ -struct gaim_xfer *gaim_xfer_new(GaimAccount *account, +GaimXfer *gaim_xfer_new(GaimAccount *account, GaimXferType type, const char *who); /** @@ -138,14 +137,14 @@ * * @param xfer The file transfer to destroy. */ -void gaim_xfer_destroy(struct gaim_xfer *xfer); +void gaim_xfer_destroy(GaimXfer *xfer); /** * Requests confirmation for a file transfer from the user. * * @param xfer The file transfer to request confirmation on. */ -void gaim_xfer_request(struct gaim_xfer *xfer); +void gaim_xfer_request(GaimXfer *xfer); /** * Called if the user accepts the file transfer request. @@ -153,14 +152,14 @@ * @param xfer The file transfer. * @param filename The filename. */ -void gaim_xfer_request_accepted(struct gaim_xfer *xfer, char *filename); +void gaim_xfer_request_accepted(GaimXfer *xfer, char *filename); /** * Called if the user rejects the file transfer request. * * @param xfer The file transfer. */ -void gaim_xfer_request_denied(struct gaim_xfer *xfer); +void gaim_xfer_request_denied(GaimXfer *xfer); /** * Returns the type of file transfer. @@ -169,7 +168,7 @@ * * @return The type of the file transfer. */ -GaimXferType gaim_xfer_get_type(const struct gaim_xfer *xfer); +GaimXferType gaim_xfer_get_type(const GaimXfer *xfer); /** * Returns the account the file transfer is using. @@ -178,7 +177,7 @@ * * @return The account. */ -GaimAccount *gaim_xfer_get_account(const struct gaim_xfer *xfer); +GaimAccount *gaim_xfer_get_account(const GaimXfer *xfer); /** * Returns the completed state for a file transfer. @@ -187,7 +186,7 @@ * * @return The completed state. */ -gboolean gaim_xfer_is_completed(const struct gaim_xfer *xfer); +gboolean gaim_xfer_is_completed(const GaimXfer *xfer); /** * Returns the name of the file being sent or received. @@ -196,7 +195,7 @@ * * @return The filename. */ -const char *gaim_xfer_get_filename(const struct gaim_xfer *xfer); +const char *gaim_xfer_get_filename(const GaimXfer *xfer); /** * Returns the file's destination filename, @@ -205,7 +204,7 @@ * * @return The destination filename. */ -const char *gaim_xfer_get_local_filename(const struct gaim_xfer *xfer); +const char *gaim_xfer_get_local_filename(const GaimXfer *xfer); /** * Returns the number of bytes sent so far. @@ -214,7 +213,7 @@ * * @return The number of bytes sent. */ -size_t gaim_xfer_get_bytes_sent(const struct gaim_xfer *xfer); +size_t gaim_xfer_get_bytes_sent(const GaimXfer *xfer); /** * Returns the number of bytes received so far. @@ -223,7 +222,7 @@ * * @return The number of bytes received. */ -size_t gaim_xfer_get_bytes_remaining(const struct gaim_xfer *xfer); +size_t gaim_xfer_get_bytes_remaining(const GaimXfer *xfer); /** * Returns the size of the file being sent or received. @@ -232,7 +231,7 @@ * * @return The total size of the file. */ -size_t gaim_xfer_get_size(const struct gaim_xfer *xfer); +size_t gaim_xfer_get_size(const GaimXfer *xfer); /** * Returns the current percentage of progress of the transfer. @@ -243,7 +242,7 @@ * * @return The percentage complete. */ -double gaim_xfer_get_progress(const struct gaim_xfer *xfer); +double gaim_xfer_get_progress(const GaimXfer *xfer); /** * Returns the local IP address in the file transfer. @@ -252,7 +251,7 @@ * * @return The IP address on this end. */ -const char *gaim_xfer_get_local_ip(const struct gaim_xfer *xfer); +const char *gaim_xfer_get_local_ip(const GaimXfer *xfer); /** * Returns the local port number in the file transfer. @@ -261,7 +260,7 @@ * * @return The port number on this end. */ -unsigned int gaim_xfer_get_local_port(const struct gaim_xfer *xfer); +unsigned int gaim_xfer_get_local_port(const GaimXfer *xfer); /** * Returns the remote IP address in the file transfer. @@ -270,7 +269,7 @@ * * @return The IP address on the other end. */ -const char *gaim_xfer_get_remote_ip(const struct gaim_xfer *xfer); +const char *gaim_xfer_get_remote_ip(const GaimXfer *xfer); /** * Returns the remote port number in the file transfer. @@ -279,7 +278,7 @@ * * @return The port number on the other end. */ -unsigned int gaim_xfer_get_remote_port(const struct gaim_xfer *xfer); +unsigned int gaim_xfer_get_remote_port(const GaimXfer *xfer); /** * Sets the completed state for the file transfer. @@ -287,7 +286,7 @@ * @param xfer The file transfer. * @param completed The completed state. */ -void gaim_xfer_set_completed(struct gaim_xfer *xfer, gboolean completed); +void gaim_xfer_set_completed(GaimXfer *xfer, gboolean completed); /** * Sets the filename for the file transfer. @@ -295,7 +294,7 @@ * @param xfer The file transfer. * @param filename The filename. */ -void gaim_xfer_set_filename(struct gaim_xfer *xfer, const char *filename); +void gaim_xfer_set_filename(GaimXfer *xfer, const char *filename); /** * Sets the local filename for the file transfer. @@ -303,7 +302,7 @@ * @param xfer The file transfer. * @param filename The filename */ -void gaim_xfer_set_local_filename(struct gaim_xfer *xfer, const char *filename); +void gaim_xfer_set_local_filename(GaimXfer *xfer, const char *filename); /** * Sets the size of the file in a file transfer. @@ -311,7 +310,7 @@ * @param xfer The file transfer. * @param size The size of the file. */ -void gaim_xfer_set_size(struct gaim_xfer *xfer, size_t size); +void gaim_xfer_set_size(GaimXfer *xfer, size_t size); /** * Returns the UI operations structure for a file transfer. @@ -320,7 +319,7 @@ * * @return The UI operations structure. */ -struct gaim_xfer_ui_ops *gaim_xfer_get_ui_ops(const struct gaim_xfer *xfer); +GaimXferUiOps *gaim_xfer_get_ui_ops(const GaimXfer *xfer); /** * Sets the read function for the file transfer. @@ -328,8 +327,8 @@ * @param xfer The file transfer. * @param fnc The read function. */ -void gaim_xfer_set_read_fnc(struct gaim_xfer *xfer, - size_t (*fnc)(char **, struct gaim_xfer *)); +void gaim_xfer_set_read_fnc(GaimXfer *xfer, + size_t (*fnc)(char **, GaimXfer *)); /** * Sets the write function for the file transfer. @@ -337,8 +336,8 @@ * @param xfer The file transfer. * @param fnc The write function. */ -void gaim_xfer_set_write_fnc(struct gaim_xfer *xfer, - size_t (*fnc)(const char *, size_t, struct gaim_xfer *)); +void gaim_xfer_set_write_fnc(GaimXfer *xfer, + size_t (*fnc)(const char *, size_t, GaimXfer *)); /** * Sets the acknowledge function for the file transfer. @@ -346,8 +345,8 @@ * @param xfer The file transfer. * @param fnc The acknowledge function. */ -void gaim_xfer_set_ack_fnc(struct gaim_xfer *xfer, - void (*fnc)(struct gaim_xfer *, const char *, size_t)); +void gaim_xfer_set_ack_fnc(GaimXfer *xfer, + void (*fnc)(GaimXfer *, const char *, size_t)); /** * Sets the transfer initialization function for the file transfer. @@ -359,8 +358,7 @@ * @param xfer The file transfer. * @param fnc The transfer initialization function. */ -void gaim_xfer_set_init_fnc(struct gaim_xfer *xfer, - void (*fnc)(struct gaim_xfer *)); +void gaim_xfer_set_init_fnc(GaimXfer *xfer, void (*fnc)(GaimXfer *)); /** * Sets the start transfer function for the file transfer. @@ -368,8 +366,7 @@ * @param xfer The file transfer. * @param fnc The start transfer function. */ -void gaim_xfer_set_start_fnc(struct gaim_xfer *xfer, - void (*fnc)(struct gaim_xfer *)); +void gaim_xfer_set_start_fnc(GaimXfer *xfer, void (*fnc)(GaimXfer *)); /** * Sets the end transfer function for the file transfer. @@ -377,8 +374,7 @@ * @param xfer The file transfer. * @param fnc The end transfer function. */ -void gaim_xfer_set_end_fnc(struct gaim_xfer *xfer, - void (*fnc)(struct gaim_xfer *)); +void gaim_xfer_set_end_fnc(GaimXfer *xfer, void (*fnc)(GaimXfer *)); /** * Sets the cancel send function for the file transfer. @@ -386,8 +382,7 @@ * @param xfer The file transfer. * @param fnc The cancel send function. */ -void gaim_xfer_set_cancel_send_fnc(struct gaim_xfer *xfer, - void (*fnc)(struct gaim_xfer *)); +void gaim_xfer_set_cancel_send_fnc(GaimXfer *xfer, void (*fnc)(GaimXfer *)); /** * Sets the cancel receive function for the file transfer. @@ -395,8 +390,7 @@ * @param xfer The file transfer. * @param fnc The cancel receive function. */ -void gaim_xfer_set_cancel_recv_fnc(struct gaim_xfer *xfer, - void (*fnc)(struct gaim_xfer *)); +void gaim_xfer_set_cancel_recv_fnc(GaimXfer *xfer, void (*fnc)(GaimXfer *)); /** * Reads in data from a file transfer stream. @@ -406,7 +400,7 @@ * * @return The number of bytes read. */ -size_t gaim_xfer_read(struct gaim_xfer *xfer, char **buffer); +size_t gaim_xfer_read(GaimXfer *xfer, char **buffer); /** * Writes data to a file transfer stream. @@ -417,8 +411,7 @@ * * @return The number of bytes written. */ -size_t gaim_xfer_write(struct gaim_xfer *xfer, const char *buffer, - size_t size); +size_t gaim_xfer_write(GaimXfer *xfer, const char *buffer, size_t size); /** * Starts a file transfer. @@ -432,7 +425,7 @@ * @param ip The IP address to connect to. * @param port The port to connect to. */ -void gaim_xfer_start(struct gaim_xfer *xfer, int fd, const char *ip, +void gaim_xfer_start(GaimXfer *xfer, int fd, const char *ip, unsigned int port); /** @@ -440,21 +433,21 @@ * * @param xfer The file transfer. */ -void gaim_xfer_end(struct gaim_xfer *xfer); +void gaim_xfer_end(GaimXfer *xfer); /** * Cancels a file transfer on the local end. * * @param xfer The file transfer. */ -void gaim_xfer_cancel_local(struct gaim_xfer *xfer); +void gaim_xfer_cancel_local(GaimXfer *xfer); /** * Cancels a file transfer from the remote end. * * @param xfer The file transfer. */ -void gaim_xfer_cancel_remote(struct gaim_xfer *xfer); +void gaim_xfer_cancel_remote(GaimXfer *xfer); /** * Displays a file transfer-related error message. @@ -481,14 +474,14 @@ * * @param fnc The function. */ -void gaim_set_xfer_ui_ops(struct gaim_xfer_ui_ops *ops); +void gaim_set_xfer_ui_ops(GaimXferUiOps *ops); /** * Returns the UI operations structure to be used in all gaim file transfers. * * @return The UI operations structure. */ -struct gaim_xfer_ui_ops *gaim_get_xfer_ui_ops(void); +GaimXferUiOps *gaim_get_xfer_ui_ops(void); /*@}*/
--- a/src/gtkft.c Sun Jul 20 03:05:58 2003 +0000 +++ b/src/gtkft.c Sun Jul 20 03:30:43 2003 +0000 @@ -37,16 +37,16 @@ #include "stock.h" #define GAIM_GTKXFER(xfer) \ - (struct gaim_gtkxfer_ui_data *)(xfer)->ui_data + (GaimGtkXferUiData *)(xfer)->ui_data -struct gaim_gtkxfer_dialog +struct _GaimGtkXferDialog { gboolean keep_open; gboolean auto_clear; gint num_transfers; - struct gaim_xfer *selected_xfer; + GaimXfer *selected_xfer; GtkWidget *window; GtkWidget *tree; @@ -75,16 +75,17 @@ GtkWidget *close_button; }; -struct gaim_gtkxfer_ui_data +typedef struct { GtkWidget *filesel; GtkTreeIter iter; time_t start_time; char *name; -}; -static struct gaim_gtkxfer_dialog *xfer_dialog = NULL; +} GaimGtkXferUiData; + +static GaimGtkXferDialog *xfer_dialog = NULL; enum { @@ -101,11 +102,10 @@ * Utility Functions **************************************************************************/ static void -get_xfer_info_strings(struct gaim_xfer *xfer, - char **kbsec, char **time_elapsed, +get_xfer_info_strings(GaimXfer *xfer, char **kbsec, char **time_elapsed, char **time_remaining) { - struct gaim_gtkxfer_ui_data *data; + GaimGtkXferUiData *data; double kb_sent, kb_rem; double kbps = 0.0; time_t elapsed, now; @@ -162,10 +162,9 @@ } static void -update_detailed_info(struct gaim_gtkxfer_dialog *dialog, - struct gaim_xfer *xfer) +update_detailed_info(GaimGtkXferDialog *dialog, GaimXfer *xfer) { - struct gaim_gtkxfer_ui_data *data; + GaimGtkXferUiData *data; char *kbsec, *time_elapsed, *time_remaining; char *status; @@ -225,7 +224,7 @@ } static void -update_buttons(struct gaim_gtkxfer_dialog *dialog, struct gaim_xfer *xfer) +update_buttons(GaimGtkXferDialog *dialog, GaimXfer *xfer) { if (dialog->selected_xfer == NULL) { gtk_widget_set_sensitive(dialog->disclosure, FALSE); @@ -267,7 +266,7 @@ } static void -ensure_row_selected(struct gaim_gtkxfer_dialog *dialog) +ensure_row_selected(GaimGtkXferDialog *dialog) { GtkTreeIter iter; GtkTreeSelection *selection; @@ -287,9 +286,9 @@ static gint delete_win_cb(GtkWidget *w, GdkEventAny *e, gpointer d) { - struct gaim_gtkxfer_dialog *dialog; + GaimGtkXferDialog *dialog; - dialog = (struct gaim_gtkxfer_dialog *)d; + dialog = (GaimGtkXferDialog *)d; gaim_gtkxfer_dialog_hide(dialog); @@ -297,25 +296,26 @@ } static void -toggle_keep_open_cb(GtkWidget *w, struct gaim_gtkxfer_dialog *dialog) +toggle_keep_open_cb(GtkWidget *w, GaimGtkXferDialog *dialog) { dialog->keep_open = !dialog->keep_open; - gaim_prefs_set_bool("/gaim/gtk/filetransfer/keep_open", dialog->keep_open); + gaim_prefs_set_bool("/gaim/gtk/filetransfer/keep_open", + dialog->keep_open); } static void -toggle_clear_finished_cb(GtkWidget *w, struct gaim_gtkxfer_dialog *dialog) +toggle_clear_finished_cb(GtkWidget *w, GaimGtkXferDialog *dialog) { dialog->auto_clear = !dialog->auto_clear; - gaim_prefs_set_bool("/gaim/gtk/filetransfer/clear_finished", dialog->auto_clear); + gaim_prefs_set_bool("/gaim/gtk/filetransfer/clear_finished", + dialog->auto_clear); } static void -selection_changed_cb(GtkTreeSelection *selection, - struct gaim_gtkxfer_dialog *dialog) +selection_changed_cb(GtkTreeSelection *selection, GaimGtkXferDialog *dialog) { GtkTreeIter iter; - struct gaim_xfer *xfer = NULL; + GaimXfer *xfer = NULL; if (gtk_tree_selection_get_selected(selection, NULL, &iter)) { GValue val = {0, }; @@ -344,34 +344,34 @@ } static void -open_button_cb(GtkButton *button, struct gaim_gtkxfer_dialog *dialog) +open_button_cb(GtkButton *button, GaimGtkXferDialog *dialog) { } static void -pause_button_cb(GtkButton *button, struct gaim_gtkxfer_dialog *dialog) +pause_button_cb(GtkButton *button, GaimGtkXferDialog *dialog) { } static void -resume_button_cb(GtkButton *button, struct gaim_gtkxfer_dialog *dialog) +resume_button_cb(GtkButton *button, GaimGtkXferDialog *dialog) { } static void -remove_button_cb(GtkButton *button, struct gaim_gtkxfer_dialog *dialog) +remove_button_cb(GtkButton *button, GaimGtkXferDialog *dialog) { gaim_gtkxfer_dialog_remove_xfer(dialog, dialog->selected_xfer); } static void -stop_button_cb(GtkButton *button, struct gaim_gtkxfer_dialog *dialog) +stop_button_cb(GtkButton *button, GaimGtkXferDialog *dialog) { gaim_xfer_cancel_local(dialog->selected_xfer); } static void -close_button_cb(GtkButton *button, struct gaim_gtkxfer_dialog *dialog) +close_button_cb(GtkButton *button, GaimGtkXferDialog *dialog) { gaim_gtkxfer_dialog_hide(dialog); } @@ -380,7 +380,7 @@ * Dialog Building Functions **************************************************************************/ static GtkWidget * -setup_tree(struct gaim_gtkxfer_dialog *dialog) +setup_tree(GaimGtkXferDialog *dialog) { GtkWidget *sw; GtkWidget *tree; @@ -468,7 +468,7 @@ } static GtkWidget * -make_info_table(struct gaim_gtkxfer_dialog *dialog) +make_info_table(GaimGtkXferDialog *dialog) { GtkWidget *table; GtkWidget *label; @@ -533,10 +533,10 @@ return table; } -struct gaim_gtkxfer_dialog * +GaimGtkXferDialog * gaim_gtkxfer_dialog_new(void) { - struct gaim_gtkxfer_dialog *dialog; + GaimGtkXferDialog *dialog; GtkWidget *window; GtkWidget *vbox1, *vbox2; GtkWidget *bbox; @@ -547,9 +547,11 @@ GtkWidget *table; GtkWidget *checkbox; - dialog = g_new0(struct gaim_gtkxfer_dialog, 1); - dialog->keep_open = gaim_prefs_get_bool("/gaim/gtk/filetransfer/keep_open"); - dialog->auto_clear = gaim_prefs_get_bool("/gaim/gtk/filetransfer/clear_finished"); + dialog = g_new0(GaimGtkXferDialog, 1); + dialog->keep_open = + gaim_prefs_get_bool("/gaim/gtk/filetransfer/keep_open"); + dialog->auto_clear = + gaim_prefs_get_bool("/gaim/gtk/filetransfer/clear_finished"); /* Create the window. */ dialog->window = window = gtk_window_new(GTK_WINDOW_TOPLEVEL); @@ -696,10 +698,9 @@ } void -gaim_gtkxfer_dialog_destroy(struct gaim_gtkxfer_dialog *dialog) +gaim_gtkxfer_dialog_destroy(GaimGtkXferDialog *dialog) { - if (dialog == NULL) - return; + g_return_if_fail(dialog != NULL); gtk_widget_destroy(dialog->window); @@ -707,19 +708,17 @@ } void -gaim_gtkxfer_dialog_show(struct gaim_gtkxfer_dialog *dialog) +gaim_gtkxfer_dialog_show(GaimGtkXferDialog *dialog) { - if (dialog == NULL) - return; + g_return_if_fail(dialog != NULL); gtk_widget_show(dialog->window); } void -gaim_gtkxfer_dialog_hide(struct gaim_gtkxfer_dialog *dialog) +gaim_gtkxfer_dialog_hide(GaimGtkXferDialog *dialog) { - if (dialog == NULL) - return; + g_return_if_fail(dialog != NULL); gtk_widget_hide(dialog->window); } @@ -727,30 +726,29 @@ void gaim_show_xfer_dialog() { - struct gaim_gtkxfer_dialog *dialog; - - dialog = gaim_get_gtkxfer_dialog(); - - if (dialog == NULL) { - dialog = gaim_gtkxfer_dialog_new(); + GaimGtkXferDialog *dialog; + + dialog = gaim_get_gtkxfer_dialog(); - gaim_set_gtkxfer_dialog(dialog); - } + if (dialog == NULL) { + dialog = gaim_gtkxfer_dialog_new(); - gaim_gtkxfer_dialog_show(dialog); + gaim_set_gtkxfer_dialog(dialog); + } + + gaim_gtkxfer_dialog_show(dialog); } void -gaim_gtkxfer_dialog_add_xfer(struct gaim_gtkxfer_dialog *dialog, - struct gaim_xfer *xfer) +gaim_gtkxfer_dialog_add_xfer(GaimGtkXferDialog *dialog, GaimXfer *xfer) { - struct gaim_gtkxfer_ui_data *data; + GaimGtkXferUiData *data; GaimXferType type; GdkPixbuf *pixbuf; char *size_str, *remaining_str; - if (dialog == NULL || xfer == NULL) - return; + g_return_if_fail(dialog != NULL); + g_return_if_fail(xfer != NULL); data = GAIM_GTKXFER(xfer); @@ -792,13 +790,13 @@ } void -gaim_gtkxfer_dialog_remove_xfer(struct gaim_gtkxfer_dialog *dialog, - struct gaim_xfer *xfer) +gaim_gtkxfer_dialog_remove_xfer(GaimGtkXferDialog *dialog, + GaimXfer *xfer) { - struct gaim_gtkxfer_ui_data *data; + GaimGtkXferUiData *data; - if (dialog == NULL || xfer == NULL) - return; + g_return_if_fail(dialog != NULL); + g_return_if_fail(xfer != NULL); data = GAIM_GTKXFER(xfer); @@ -821,16 +819,16 @@ } void -gaim_gtkxfer_dialog_cancel_xfer(struct gaim_gtkxfer_dialog *dialog, - struct gaim_xfer *xfer) +gaim_gtkxfer_dialog_cancel_xfer(GaimGtkXferDialog *dialog, + GaimXfer *xfer) { - struct gaim_gtkxfer_ui_data *data; + GaimGtkXferUiData *data; #if 0 GdkPixbuf *pixbuf; #endif - if (dialog == NULL || xfer == NULL) - return; + g_return_if_fail(dialog != NULL); + g_return_if_fail(xfer != NULL); data = GAIM_GTKXFER(xfer); @@ -865,17 +863,17 @@ } void -gaim_gtkxfer_dialog_update_xfer(struct gaim_gtkxfer_dialog *dialog, - struct gaim_xfer *xfer) +gaim_gtkxfer_dialog_update_xfer(GaimGtkXferDialog *dialog, + GaimXfer *xfer) { - struct gaim_gtkxfer_ui_data *data; + GaimGtkXferUiData *data; char *size_str, *remaining_str; GtkTreeSelection *selection; - if (dialog == NULL || xfer == NULL) - return; + g_return_if_fail(dialog != NULL); + g_return_if_fail(xfer != NULL); - if (!(data = GAIM_GTKXFER(xfer))) + if ((data = GAIM_GTKXFER(xfer)) == NULL) return; size_str = gaim_get_size_string(gaim_xfer_get_size(xfer)); @@ -917,17 +915,17 @@ * File Transfer UI Ops **************************************************************************/ static void -gaim_gtkxfer_new(struct gaim_xfer *xfer) +gaim_gtkxfer_new_xfer(GaimXfer *xfer) { - struct gaim_gtkxfer_ui_data *data; + GaimGtkXferUiData *data; /* This is where we're setting xfer->ui_data for the first time. */ - data = g_malloc0(sizeof(struct gaim_gtkxfer_ui_data)); + data = g_new0(GaimGtkXferUiData, 1); xfer->ui_data = data; } static void -gaim_gtkxfer_destroy(struct gaim_xfer *xfer) +gaim_gtkxfer_destroy(GaimXfer *xfer) { gaim_gtkxfer_dialog_remove_xfer(xfer_dialog, xfer); } @@ -935,7 +933,7 @@ static gboolean choose_file_close_cb(GtkWidget *widget, GdkEvent *event, gpointer user_data) { - gaim_xfer_request_denied((struct gaim_xfer *)user_data); + gaim_xfer_request_denied((GaimXfer *)user_data); return FALSE; } @@ -943,8 +941,8 @@ static void choose_file_cancel_cb(GtkButton *button, gpointer user_data) { - struct gaim_xfer *xfer = (struct gaim_xfer *)user_data; - struct gaim_gtkxfer_ui_data *data; + GaimXfer *xfer = (GaimXfer *)user_data; + GaimGtkXferUiData *data; data = GAIM_GTKXFER(xfer); @@ -955,9 +953,9 @@ } static int -do_overwrite_cb(struct gaim_xfer *xfer) +do_overwrite_cb(GaimXfer *xfer) { - struct gaim_gtkxfer_ui_data *data; + GaimGtkXferUiData *data; data = GAIM_GTKXFER(xfer); @@ -973,9 +971,9 @@ } static int -dont_overwrite_cb(struct gaim_xfer *xfer) +dont_overwrite_cb(GaimXfer *xfer) { - struct gaim_gtkxfer_ui_data *data; + GaimGtkXferUiData *data; data = GAIM_GTKXFER(xfer); @@ -990,12 +988,12 @@ static void choose_file_ok_cb(GtkButton *button, gpointer user_data) { - struct gaim_xfer *xfer; - struct gaim_gtkxfer_ui_data *data; + GaimXfer *xfer; + GaimGtkXferUiData *data; struct stat st; const char *name; - xfer = (struct gaim_xfer *)user_data; + xfer = (GaimXfer *)user_data; data = GAIM_GTKXFER(xfer); name = gtk_file_selection_get_filename(GTK_FILE_SELECTION(data->filesel)); @@ -1015,7 +1013,9 @@ gaim_xfer_request_denied(xfer); } } - else if ((gaim_xfer_get_type(xfer) == GAIM_XFER_SEND) && (st.st_size == 0)) { + else if ((gaim_xfer_get_type(xfer) == GAIM_XFER_SEND) && + (st.st_size == 0)) { + gaim_notify_error(NULL, NULL, _("Cannot send a file of 0 bytes."), NULL); @@ -1046,10 +1046,10 @@ } static int -choose_file(struct gaim_xfer *xfer) +choose_file(GaimXfer *xfer) { char *cur_dir, *init_str; - struct gaim_gtkxfer_ui_data *data; + GaimGtkXferUiData *data; data = GAIM_GTKXFER(xfer); cur_dir = g_get_current_dir(); @@ -1087,7 +1087,7 @@ } static int -cancel_recv_cb(struct gaim_xfer *xfer) +cancel_recv_cb(GaimXfer *xfer) { gaim_xfer_request_denied(xfer); @@ -1095,7 +1095,7 @@ } static void -gaim_gtkxfer_ask_recv(struct gaim_xfer *xfer) +gaim_gtkxfer_ask_recv(GaimXfer *xfer) { char *buf, *size_buf; size_t size; @@ -1117,25 +1117,21 @@ } static void -gaim_gtkxfer_request_file(struct gaim_xfer *xfer) +gaim_gtkxfer_request_file(GaimXfer *xfer) { if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) - { gaim_gtkxfer_ask_recv(xfer); - } else - { choose_file(xfer); - } } static void -gaim_gtkxfer_ask_cancel(struct gaim_xfer *xfer) +gaim_gtkxfer_ask_cancel(GaimXfer *xfer) { } static void -gaim_gtkxfer_add_xfer(struct gaim_xfer *xfer) +gaim_gtkxfer_add_xfer(GaimXfer *xfer) { if (xfer_dialog == NULL) xfer_dialog = gaim_gtkxfer_dialog_new(); @@ -1144,31 +1140,33 @@ } static void -gaim_gtkxfer_update_progress(struct gaim_xfer *xfer, double percent) +gaim_gtkxfer_update_progress(GaimXfer *xfer, double percent) { gaim_gtkxfer_dialog_update_xfer(xfer_dialog, xfer); /* See if it's removed. */ /* XXX - This caused some bad stuff, and I don't see a point to it */ -/* if (xfer->ui_data == NULL) - gaim_xfer_destroy(xfer); */ +#if 0 + if (xfer->ui_data == NULL) + gaim_xfer_destroy(xfer); +#endif } static void -gaim_gtkxfer_cancel_local(struct gaim_xfer *xfer) +gaim_gtkxfer_cancel_local(GaimXfer *xfer) { gaim_gtkxfer_dialog_cancel_xfer(xfer_dialog, xfer); } static void -gaim_gtkxfer_cancel_remote(struct gaim_xfer *xfer) +gaim_gtkxfer_cancel_remote(GaimXfer *xfer) { gaim_gtkxfer_dialog_cancel_xfer(xfer_dialog, xfer); } -struct gaim_xfer_ui_ops ops = +static GaimXferUiOps ops = { - gaim_gtkxfer_new, + gaim_gtkxfer_new_xfer, gaim_gtkxfer_destroy, gaim_gtkxfer_request_file, gaim_gtkxfer_ask_cancel, @@ -1190,18 +1188,18 @@ } void -gaim_set_gtkxfer_dialog(struct gaim_gtkxfer_dialog *dialog) +gaim_set_gtkxfer_dialog(GaimGtkXferDialog *dialog) { xfer_dialog = dialog; } -struct gaim_gtkxfer_dialog * +GaimGtkXferDialog * gaim_get_gtkxfer_dialog(void) { return xfer_dialog; } -struct gaim_xfer_ui_ops * +GaimXferUiOps * gaim_get_gtk_xfer_ui_ops(void) { return &ops;
--- a/src/gtkft.h Sun Jul 20 03:05:58 2003 +0000 +++ b/src/gtkft.h Sun Jul 20 03:30:43 2003 +0000 @@ -31,7 +31,7 @@ * The structure is opaque, as nobody should be touching anything inside of * it. */ -struct gaim_gtkxfer_dialog; +typedef struct _GaimGtkXferDialog GaimGtkXferDialog; /**************************************************************************/ /** @name GTK+ File Transfer Dialog API */ @@ -43,28 +43,28 @@ * * @return The new dialog. */ -struct gaim_gtkxfer_dialog *gaim_gtkxfer_dialog_new(void); +GaimGtkXferDialog *gaim_gtkxfer_dialog_new(void); /** * Destroys a file transfer dialog. * * @param dialog The file transfer dialog. */ -void gaim_gtkxfer_dialog_destroy(struct gaim_gtkxfer_dialog *dialog); +void gaim_gtkxfer_dialog_destroy(GaimGtkXferDialog *dialog); /** * Displays the file transfer dialog. * * @param dialog The file transfer dialog to show. */ -void gaim_gtkxfer_dialog_show(struct gaim_gtkxfer_dialog *dialog); +void gaim_gtkxfer_dialog_show(GaimGtkXferDialog *dialog); /** * Hides the file transfer dialog. * * @param dialog The file transfer dialog to hide. */ -void gaim_gtkxfer_dialog_hide(struct gaim_gtkxfer_dialog *dialog); +void gaim_gtkxfer_dialog_hide(GaimGtkXferDialog *dialog); /** * Shows the file transfer dialog, creating a new one if necessary @@ -77,8 +77,7 @@ * @param dialog The file transfer dialog. * @param xfer The file transfer. */ -void gaim_gtkxfer_dialog_add_xfer(struct gaim_gtkxfer_dialog *dialog, - struct gaim_xfer *xfer); +void gaim_gtkxfer_dialog_add_xfer(GaimGtkXferDialog *dialog, GaimXfer *xfer); /** * Removes a file transfer from the dialog. @@ -86,8 +85,8 @@ * @param dialog The file transfer dialog. * @param xfer The file transfer. */ -void gaim_gtkxfer_dialog_remove_xfer(struct gaim_gtkxfer_dialog *dialog, - struct gaim_xfer *xfer); +void gaim_gtkxfer_dialog_remove_xfer(GaimGtkXferDialog *dialog, + GaimXfer *xfer); /** * Indicate in a file transfer dialog that a transfer was canceled. @@ -95,8 +94,8 @@ * @param dialog The file transfer dialog. * @param xfer The file transfer that was canceled. */ -void gaim_gtkxfer_dialog_cancel_xfer(struct gaim_gtkxfer_dialog *dialog, - struct gaim_xfer *xfer); +void gaim_gtkxfer_dialog_cancel_xfer(GaimGtkXferDialog *dialog, + GaimXfer *xfer); /** * Updates the information for a transfer in the dialog. @@ -104,8 +103,8 @@ * @param dialog The file transfer dialog. * @param xfer The file transfer. */ -void gaim_gtkxfer_dialog_update_xfer(struct gaim_gtkxfer_dialog *dialog, - struct gaim_xfer *xfer); +void gaim_gtkxfer_dialog_update_xfer(GaimGtkXferDialog *dialog, + GaimXfer *xfer); /*@}*/ @@ -124,21 +123,21 @@ * * @param dialog The main dialog. */ -void gaim_set_gtkxfer_dialog(struct gaim_gtkxfer_dialog *dialog); +void gaim_set_gtkxfer_dialog(GaimGtkXferDialog *dialog); /** * Returns gaim's main file transfer dialog. * * @return The main dialog. */ -struct gaim_gtkxfer_dialog *gaim_get_gtkxfer_dialog(void); +GaimGtkXferDialog *gaim_get_gtkxfer_dialog(void); /** * Returns the UI operations structure for the GTK+ file transfer UI. * * @return The GTK+ file transfer UI operations structure. */ -struct gaim_xfer_ui_ops *gaim_get_gtk_xfer_ui_ops(void); +GaimXferUiOps *gaim_get_gtk_xfer_ui_ops(void); /*@}*/
--- a/src/protocols/irc/irc.c Sun Jul 20 03:05:58 2003 +0000 +++ b/src/protocols/irc/irc.c Sun Jul 20 03:30:43 2003 +0000 @@ -1261,7 +1261,7 @@ } static void -irc_xfer_init(struct gaim_xfer *xfer) +irc_xfer_init(GaimXfer *xfer) { struct irc_xfer_data *data = (struct irc_xfer_data *)xfer->data; @@ -1269,7 +1269,7 @@ } static void -irc_xfer_end(struct gaim_xfer *xfer) +irc_xfer_end(GaimXfer *xfer) { struct irc_xfer_data *data = (struct irc_xfer_data *)xfer->data; @@ -1281,7 +1281,7 @@ } static void -irc_xfer_cancel_send(struct gaim_xfer *xfer) +irc_xfer_cancel_send(GaimXfer *xfer) { struct irc_xfer_data *data = (struct irc_xfer_data *)xfer->data; @@ -1293,7 +1293,7 @@ } static void -irc_xfer_cancel_recv(struct gaim_xfer *xfer) +irc_xfer_cancel_recv(GaimXfer *xfer) { struct irc_xfer_data *data = (struct irc_xfer_data *)xfer->data; @@ -1305,7 +1305,7 @@ } static void -irc_xfer_ack(struct gaim_xfer *xfer, const char *buffer, size_t size) +irc_xfer_ack(GaimXfer *xfer, const char *buffer, size_t size) { guint32 pos; @@ -1434,7 +1434,7 @@ _("Cancel"), G_CALLBACK(dcc_chat_cancel)); } else if (!g_ascii_strncasecmp(msg, "DCC SEND", 8)) { - struct gaim_xfer *xfer; + GaimXfer *xfer; char **send_args; char *ip, *filename; struct irc_xfer_data *xfer_data; @@ -1988,9 +1988,9 @@ /* Kill any existing transfers */ while (idata->file_transfers) { - struct gaim_xfer *xfer; - - xfer = (struct gaim_xfer *)idata->file_transfers->data; + GaimXfer *xfer; + + xfer = (GaimXfer *)idata->file_transfers->data; gaim_xfer_end(xfer); gaim_xfer_destroy(xfer);
--- a/src/protocols/jabber/jabber.c Sun Jul 20 03:05:58 2003 +0000 +++ b/src/protocols/jabber/jabber.c Sun Jul 20 03:30:43 2003 +0000 @@ -2007,13 +2007,13 @@ struct jabber_data *jd; }; -static void jabber_xfer_init(struct gaim_xfer *xfer) +static void jabber_xfer_init(GaimXfer *xfer) { struct jabber_xfer_data *data = xfer->data; gaim_xfer_start(xfer, -1, data->url->address, data->url->port); } -static void jabber_xfer_free(struct gaim_xfer *xfer) +static void jabber_xfer_free(GaimXfer *xfer) { struct jabber_xfer_data *data = xfer->data; data->jd->file_transfers = g_slist_remove(data->jd->file_transfers, xfer); @@ -2026,7 +2026,7 @@ xfer->data = NULL; } -static void jabber_xfer_end(struct gaim_xfer *xfer) +static void jabber_xfer_end(GaimXfer *xfer) { struct jabber_xfer_data *data = xfer->data; xmlnode x; @@ -2043,7 +2043,7 @@ jabber_xfer_free(xfer); } -static void jabber_xfer_start(struct gaim_xfer *xfer) +static void jabber_xfer_start(GaimXfer *xfer) { struct jabber_xfer_data *data = xfer->data; char *buf = g_strdup_printf("GET /%s HTTP/1.1\r\nHost: %s\r\n\r\n", @@ -2052,7 +2052,7 @@ g_free(buf); } -static size_t jabber_xfer_read(char **buffer, struct gaim_xfer *xfer) { +static size_t jabber_xfer_read(char **buffer, GaimXfer *xfer) { struct jabber_xfer_data *data = xfer->data; char test; int size; @@ -2080,10 +2080,10 @@ return 0; } -static void jabber_xfer_cancel_send(struct gaim_xfer *xfer) { +static void jabber_xfer_cancel_send(GaimXfer *xfer) { } -static void jabber_xfer_cancel_recv(struct gaim_xfer *xfer) { +static void jabber_xfer_cancel_recv(GaimXfer *xfer) { struct jabber_xfer_data *data = xfer->data; xmlnode x,y; @@ -2106,7 +2106,7 @@ static void jabber_handleoob(gjconn gjc, xmlnode iqnode) { struct jabber_xfer_data *xfer_data; struct jabber_data *jd = GJ_GC(gjc)->proto_data; - struct gaim_xfer *xfer; + GaimXfer *xfer; char *msg = NULL; char *filename; xmlnode querynode = xmlnode_get_tag(iqnode, "query");
--- a/src/protocols/oscar/oscar.c Sun Jul 20 03:05:58 2003 +0000 +++ b/src/protocols/oscar/oscar.c Sun Jul 20 03:30:43 2003 +0000 @@ -713,8 +713,8 @@ } /* BBB */ while (od->file_transfers) { - struct gaim_xfer *xfer; - xfer = (struct gaim_xfer *)od->file_transfers->data; + GaimXfer *xfer; + xfer = (GaimXfer *)od->file_transfers->data; gaim_xfer_destroy(xfer); } while (od->requesticon) { @@ -822,7 +822,7 @@ static void oscar_sendfile_connected(gpointer data, gint source, GaimInputCondition condition); /* XXX - This function is pretty ugly */ -static void oscar_xfer_init(struct gaim_xfer *xfer) +static void oscar_xfer_init(GaimXfer *xfer) { struct aim_oft_info *oft_info = xfer->data; GaimConnection *gc = oft_info->sess->aux_data; @@ -881,14 +881,14 @@ } } -static void oscar_xfer_start(struct gaim_xfer *xfer) +static void oscar_xfer_start(GaimXfer *xfer) { gaim_debug(GAIM_DEBUG_INFO, "oscar", "AAA - in oscar_xfer_start\n"); /* I'm pretty sure we don't need to do jack here. Nor Jill. */ } -static void oscar_xfer_end(struct gaim_xfer *xfer) +static void oscar_xfer_end(GaimXfer *xfer) { struct aim_oft_info *oft_info = xfer->data; GaimConnection *gc = oft_info->sess->aux_data; @@ -907,7 +907,7 @@ od->file_transfers = g_slist_remove(od->file_transfers, xfer); } -static void oscar_xfer_cancel_send(struct gaim_xfer *xfer) +static void oscar_xfer_cancel_send(GaimXfer *xfer) { struct aim_oft_info *oft_info = xfer->data; GaimConnection *gc = oft_info->sess->aux_data; @@ -924,7 +924,7 @@ od->file_transfers = g_slist_remove(od->file_transfers, xfer); } -static void oscar_xfer_cancel_recv(struct gaim_xfer *xfer) +static void oscar_xfer_cancel_recv(GaimXfer *xfer) { struct aim_oft_info *oft_info = xfer->data; GaimConnection *gc = oft_info->sess->aux_data; @@ -941,7 +941,7 @@ od->file_transfers = g_slist_remove(od->file_transfers, xfer); } -static void oscar_xfer_ack(struct gaim_xfer *xfer, const char *buffer, size_t size) +static void oscar_xfer_ack(GaimXfer *xfer, const char *buffer, size_t size) { struct aim_oft_info *oft_info = xfer->data; @@ -962,9 +962,9 @@ } } -static struct gaim_xfer *oscar_find_xfer_by_cookie(GSList *fts, const char *ck) +static GaimXfer *oscar_find_xfer_by_cookie(GSList *fts, const char *ck) { - struct gaim_xfer *xfer; + GaimXfer *xfer; struct aim_oft_info *oft_info; while (fts) { @@ -980,9 +980,9 @@ return NULL; } -static struct gaim_xfer *oscar_find_xfer_by_conn(GSList *fts, aim_conn_t *conn) +static GaimXfer *oscar_find_xfer_by_conn(GSList *fts, aim_conn_t *conn) { - struct gaim_xfer *xfer; + GaimXfer *xfer; struct aim_oft_info *oft_info; while (fts) { @@ -1000,7 +1000,7 @@ static void oscar_ask_sendfile(GaimConnection *gc, const char *destsn) { struct oscar_data *od = (struct oscar_data *)gc->proto_data; - struct gaim_xfer *xfer; + GaimXfer *xfer; struct aim_oft_info *oft_info; aim_conn_t *conn; @@ -1913,7 +1913,7 @@ static int oscar_sendfile_estblsh(aim_session_t *sess, aim_frame_t *fr, ...) { GaimConnection *gc = sess->aux_data; struct oscar_data *od = (struct oscar_data *)gc->proto_data; - struct gaim_xfer *xfer; + GaimXfer *xfer; struct aim_oft_info *oft_info; va_list ap; aim_conn_t *conn, *listenerconn; @@ -1953,7 +1953,7 @@ * user in order to transfer a file. */ static void oscar_sendfile_connected(gpointer data, gint source, GaimInputCondition condition) { - struct gaim_xfer *xfer; + GaimXfer *xfer; struct aim_oft_info *oft_info; gaim_debug(GAIM_DEBUG_INFO, "oscar", @@ -1986,7 +1986,7 @@ static int oscar_sendfile_prompt(aim_session_t *sess, aim_frame_t *fr, ...) { GaimConnection *gc = sess->aux_data; struct oscar_data *od = gc->proto_data; - struct gaim_xfer *xfer; + GaimXfer *xfer; struct aim_oft_info *oft_info; va_list ap; aim_conn_t *conn; @@ -2031,7 +2031,7 @@ static int oscar_sendfile_ack(aim_session_t *sess, aim_frame_t *fr, ...) { GaimConnection *gc = sess->aux_data; struct oscar_data *od = gc->proto_data; - struct gaim_xfer *xfer; + GaimXfer *xfer; va_list ap; aim_conn_t *conn; fu8_t *cookie; @@ -2063,7 +2063,7 @@ static int oscar_sendfile_done(aim_session_t *sess, aim_frame_t *fr, ...) { GaimConnection *gc = sess->aux_data; struct oscar_data *od = gc->proto_data; - struct gaim_xfer *xfer; + GaimXfer *xfer; va_list ap; aim_conn_t *conn; fu8_t *cookie; @@ -2292,7 +2292,7 @@ /* BBB */ if (args->status == AIM_RENDEZVOUS_PROPOSE) { /* Someone wants to send a file (or files) to us */ - struct gaim_xfer *xfer; + GaimXfer *xfer; struct aim_oft_info *oft_info; if (!args->cookie || !args->port || !args->verifiedip || @@ -2353,7 +2353,7 @@ gaim_xfer_request(xfer); } else if (args->status == AIM_RENDEZVOUS_CANCEL) { /* The other user wants to cancel a file transfer */ - struct gaim_xfer *xfer; + GaimXfer *xfer; gaim_debug(GAIM_DEBUG_INFO, "oscar", "AAA - File transfer canceled by remote user\n"); if ((xfer = oscar_find_xfer_by_cookie(od->file_transfers, args->cookie))) @@ -2838,7 +2838,7 @@ /* BBB */ switch (reason) { case 3: { /* Decline sendfile. */ - struct gaim_xfer *xfer; + GaimXfer *xfer; gaim_debug(GAIM_DEBUG_INFO, "oscar", "AAA - Other user declined file transfer\n"); if ((xfer = oscar_find_xfer_by_cookie(od->file_transfers, cookie))) @@ -2957,7 +2957,7 @@ #if 0 GaimConnection *gc = sess->aux_data; struct oscar_data *od = gc->proto_data; - struct gaim_xfer *xfer; + GaimXfer *xfer; #endif va_list ap; fu16_t reason;