soc.2009.transport: 9e210a8a: Send files only if legacy user supports ...
hanzz at soc.pidgin.im
hanzz at soc.pidgin.im
Sat Aug 8 05:50:30 EDT 2009
-----------------------------------------------------------------
Revision: 9e210a8adad0a9f9758d43d244a43778c2f1c7a6
Ancestor: 62fea0cfc33153f077c6b4fef36db56f4e095291
Author: hanzz at soc.pidgin.im
Date: 2009-08-08T09:40:17
Branch: im.pidgin.soc.2009.transport
URL: http://d.pidgin.im/viewmtn/revision/info/9e210a8adad0a9f9758d43d244a43778c2f1c7a6
Modified files:
filetransfermanager.cpp
ChangeLog:
Send files only if legacy user supports it
-------------- next part --------------
============================================================
--- filetransfermanager.cpp 822d9e4ca42efe26a819f9fc5307afe5fb4c4e1b
+++ filetransfermanager.cpp 48d8234c604fe289f0ae6c1c202885b77ff475e2
@@ -36,13 +36,30 @@ void FileTransferManager::handleFTReques
std::for_each( uname.begin(), uname.end(), replaceBadJidCharacters() );
User *user = p->userManager()->getUserByJID(from.bare());
if (user) {
- Log().Get(user->jid()) << "has user";
if (user->account()){
- Log().Get(user->jid()) << "has account";
if (user->isConnected()){
- Log().Get(user->jid()) << "sending file";
- user->addFiletransfer(from, sid, SIProfileFT::FTTypeS5B, to, size);
- serv_send_file(purple_account_get_connection(user->account()), uname.c_str(), name.c_str());
+ bool send = false;
+ PurplePlugin *prpl = NULL;
+ PurplePluginProtocolInfo *prpl_info = NULL;
+ PurpleConnection *gc = purple_account_get_connection(account);
+
+ if(gc)
+ prpl = purple_connection_get_prpl(gc);
+
+ if(prpl)
+ prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
+
+ if (prpl_info && prpl_info->send_file) {
+ if (!prpl_info->can_receive_file || prpl_info->can_receive_file(gc, who)) {
+ send = true;
+ }
+ }
+ if (send) {
+ user->addFiletransfer(from, sid, SIProfileFT::FTTypeS5B, to, size);
+ serv_send_file(purple_account_get_connection(user->account()), uname.c_str(), name.c_str());
+ }
+ else
+ m_sip->acceptFT( from, to, id, gloox::SIProfileFT::FTTypeS5B );
}
}
}
More information about the Commits
mailing list