comparison libpurple/protocols/oscar/odc.c @ 20300:96a6a9eef15b

applied changes from 2ab75e32c52e94c674d0b5a396d224da7e9d509e through 3829f989342d787500e9abe363c89909db102f4b
author Luke Schierer <lschiere@pidgin.im>
date Fri, 19 Oct 2007 16:27:50 +0000
parents 44b4e8bd759b
children 35b4f1dc4c8d
comparison
equal deleted inserted replaced
20299:62d0c7885618 20300:96a6a9eef15b
24 24
25 /* From Purple */ 25 /* From Purple */
26 #include "conversation.h" 26 #include "conversation.h"
27 #include "imgstore.h" 27 #include "imgstore.h"
28 #include "util.h" 28 #include "util.h"
29
30 #define DIRECTIM_MAX_FILESIZE 52428800
29 31
30 /** 32 /**
31 * Free any ODC related data and print a message to the conversation 33 * Free any ODC related data and print a message to the conversation
32 * window based on conn->disconnect_reason. 34 * window based on conn->disconnect_reason.
33 */ 35 */
585 serv_got_typing_stopped(gc, conn->sn); 587 serv_got_typing_stopped(gc, conn->sn);
586 } 588 }
587 589
588 if (frame->payload.len > 0) 590 if (frame->payload.len > 0)
589 { 591 {
592 if (frame->payload.len > DIRECTIM_MAX_FILESIZE)
593 {
594 gchar *tmp, *size1, *size2;
595 PurpleAccount *account;
596 PurpleConversation *conv;
597
598 size1 = purple_str_size_to_units(frame->payload.len);
599 size2 = purple_str_size_to_units(DIRECTIM_MAX_FILESIZE);
600 tmp = g_strdup_printf(_("%s tried to send you a %s file, but we only allow files up to %s over Direct IM. Try using file transfer instead.\n"), conn->sn, size1, size2);
601 g_free(size1);
602 g_free(size2);
603
604 account = purple_connection_get_account(conn->od->gc);
605 conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, conn->sn);
606 purple_conversation_write(conv, NULL, tmp, PURPLE_MESSAGE_SYSTEM, time(NULL));
607 g_free(tmp);
608
609 peer_connection_destroy(conn, OSCAR_DISCONNECT_LOCAL_CLOSED, NULL);
610 return;
611 }
612
590 /* We have payload data! Switch to the ODC watcher to read it. */ 613 /* We have payload data! Switch to the ODC watcher to read it. */
591 frame->payload.data = g_new(guint8, frame->payload.len); 614 frame->payload.data = g_new(guint8, frame->payload.len);
592 frame->payload.offset = 0; 615 frame->payload.offset = 0;
593 conn->frame = frame; 616 conn->frame = frame;
594 purple_input_remove(conn->watcher_incoming); 617 purple_input_remove(conn->watcher_incoming);