diff src/protocols/msn/transaction.c @ 9193:502707ca1836

[gaim-migrate @ 9988] Patch by Felipe Contreras to add MSN file transfer and buddy icons. Please test and report any bugs! committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Sun, 06 Jun 2004 02:39:08 +0000
parents c30d81b4dd22
children ab6636c5a136
line wrap: on
line diff
--- a/src/protocols/msn/transaction.c	Sun Jun 06 02:16:08 2004 +0000
+++ b/src/protocols/msn/transaction.c	Sun Jun 06 02:39:08 2004 +0000
@@ -90,6 +90,47 @@
 }
 
 void
+msn_transaction_queue_cmd(MsnTransaction *trans, MsnCommand *cmd)
+{
+	gaim_debug_info("msn", "queueing command.\n");
+	trans->pendent_cmd = cmd;
+	msn_command_ref(cmd);
+}
+
+void
+msn_transaction_unqueue_cmd(MsnTransaction *trans, MsnCmdProc *cmdproc)
+{
+	gaim_debug_info("msn", "unqueueing command.\n");
+	MsnCommand *cmd = trans->pendent_cmd;
+	g_return_if_fail(cmd != NULL);
+
+	msn_cmdproc_process_cmd(cmdproc, cmd);
+	msn_command_unref(cmd);
+
+	trans->pendent_cmd = NULL;
+}
+
+#if 0
+void
+msn_transaction_queue(MsnTransaction *trans, MsnTransaction *elem)
+{
+	if (trans->queue == NULL)
+		trans->queue = g_queue_new();
+
+	g_queue_push_tail(trans->queue, elem);
+}
+
+void
+msn_transaction_unqueue(MsnTransaction *trans, MsnCmdProc *cmdproc)
+{
+	MsnTransaction *elem;
+
+	while ((elem = g_queue_pop_head(trans->queue)) != NULL)
+		msn_cmdproc_send_trans(cmdproc, elem);
+}
+#endif
+
+void
 msn_transaction_set_payload(MsnTransaction *trans,
 							const char *payload, int payload_len)
 {
@@ -99,3 +140,26 @@
 	trans->payload = g_strdup(payload);
 	trans->payload_len = payload_len ? payload_len : strlen(trans->payload);
 }
+
+void
+msn_transaction_set_data(MsnTransaction *trans, void *data)
+{
+	g_return_if_fail(trans != NULL);
+
+	trans->data = data;
+}
+
+void
+msn_transaction_add_cb(MsnTransaction *trans, char *answer,
+					   MsnTransCb cb, void *data)
+{
+	g_return_if_fail(trans  != NULL);
+	g_return_if_fail(answer != NULL);
+
+	if (trans->callbacks == NULL)
+		trans->callbacks = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL);
+
+	g_hash_table_insert(trans->callbacks, answer, cb);
+
+	trans->data = data;
+}