--- a/jingle-filetransfer/filetransfer.c Fri Aug 13 18:39:25 2010 +0200
+++ b/jingle-filetransfer/filetransfer.c Fri Aug 13 20:34:44 2010 +0200
@@ -179,6 +179,12 @@
GIOStatus status;
gsize bytes_written = 0;
+ if (jft->md5 == NULL) {
+ jft->md5 = g_checksum_new(G_CHECKSUM_MD5);
+ }
+
+ g_checksum_update(jft->md5, (guchar*)data, (gsize)len);
+
// TODO: check if the file already exist or if it was created
// during the call to jingle_ft_check and handle_data
if (jft->outfile == NULL) {
@@ -404,14 +410,28 @@
jft->md5 = g_checksum_new(G_CHECKSUM_MD5);
+ scr_LogPrint(LPRINT_LOGNORM, "Jingle File Transfer: Transfer start (%s)",
+ jft->name);
+
sc2->appfuncs->send(sc, size);
}
+// When we got a session-terminate
void jingle_ft_stop(gconstpointer data)
{
JingleFT *jft = (JingleFT*)data;
- scr_LogPrint(LPRINT_LOGNORM, "Jingle File Transfer: transfer finish (%s)", jft->name);
+ if (jft->hash != NULL) {
+ if (g_strcmp0(jft->hash, g_checksum_get_string(jft->md5))) {
+ scr_LogPrint(LPRINT_LOGNORM, "Jingle File Transfer: File corrupt (%s)", jft->name);
+ } else {
+ scr_LogPrint(LPRINT_LOGNORM, "Jingle File Transfer: transfer finish (%s) and verified", jft->name);
+ }
+ } else {
+ scr_LogPrint(LPRINT_LOGNORM, "Jingle File Transfer: transfer finish (%s) but not verified", jft->name);
+ }
+
+ g_checksum_free(jft->md5);
g_io_channel_flush(jft->outfile, NULL);
--- a/jingle-ibb/ibb.c Fri Aug 13 18:39:25 2010 +0200
+++ b/jingle-ibb/ibb.c Fri Aug 13 20:34:44 2010 +0200
@@ -183,10 +183,8 @@
int jingle_ibb_check_session(gconstpointer data, gconstpointer session)
{
const JingleIBB *ibb1 = data, *ibb2 = session;
- if(!g_strcmp0(ibb1->sid, ibb2->sid) && ibb1->seq == ibb2->seq + 1) {
- // TODO: change the seq in the session
+ if(!g_strcmp0(ibb1->sid, ibb2->sid) && ibb1->seq == ibb2->seq + 1)
return 0;
- }
return 1;
}
--- a/jingle/send.c Fri Aug 13 18:39:25 2010 +0200
+++ b/jingle/send.c Fri Aug 13 20:34:44 2010 +0200
@@ -45,12 +45,10 @@
"action", "session-terminate",
"sid", js->sid,
NULL);
- lm_message_node_add_child(node, "reason", NULL);
- node = lm_message_node_get_child(node, "reason");
-
if (r == NULL) return;
if (reason != NULL) {
+ lm_message_node_add_child(node, "reason", NULL);
node = lm_message_node_get_child(node, "reason");
lm_message_node_add_child(node, reason, NULL);
}