Implement file transfer in Adium Plugin
Implement file transfer protocol in Plugin and fix a few things that stopped old file handling from working with Adium.
This commit is contained in:
parent
64e0a7f35f
commit
9fca523161
4 changed files with 36 additions and 7 deletions
|
@ -16,7 +16,7 @@
|
|||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import <AdiumLibpurple/CBPurpleAccount.h>
|
||||
#import <Adium/AIAccount.h>
|
||||
|
||||
@interface AdiumTelegramAccount : CBPurpleAccount
|
||||
|
||||
@interface AdiumTelegramAccount : CBPurpleAccount<AIAccount_Files>
|
||||
@end
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
|
||||
#import "AdiumTelegramAccount.h"
|
||||
#import <libpurple/conversation.h>
|
||||
#import <Adium/ESFileTransfer.h>
|
||||
#import <Adium/AIListContact.h>
|
||||
#import "tgp-ft.h"
|
||||
|
||||
@implementation AdiumTelegramAccount
|
||||
|
||||
|
@ -44,4 +47,24 @@
|
|||
return YES;
|
||||
}
|
||||
|
||||
- (void)beginSendOfFileTransfer:(ESFileTransfer *)fileTransfer
|
||||
{
|
||||
[super _beginSendOfFileTransfer:fileTransfer];
|
||||
}
|
||||
|
||||
- (void)acceptFileTransferRequest:(ESFileTransfer *)fileTransfer
|
||||
{
|
||||
[super acceptFileTransferRequest:fileTransfer];
|
||||
}
|
||||
|
||||
- (void)rejectFileReceiveRequest:(ESFileTransfer *)fileTransfer
|
||||
{
|
||||
[super rejectFileReceiveRequest:fileTransfer];
|
||||
}
|
||||
|
||||
- (void)cancelFileTransfer:(ESFileTransfer *)fileTransfer
|
||||
{
|
||||
[super cancelFileTransfer:fileTransfer];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
C49A915819BBC5C5001B3DC0 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = C49A915719BBC5C5001B3DC0 /* libz.dylib */; };
|
||||
C4D819031A5C85FE0044CBA9 /* lodepng.c in Sources */ = {isa = PBXBuildFile; fileRef = C4D819011A5C85FE0044CBA9 /* lodepng.c */; };
|
||||
C4D819061A5C862E0044CBA9 /* tgp-structs.c in Sources */ = {isa = PBXBuildFile; fileRef = C4D819041A5C862E0044CBA9 /* tgp-structs.c */; };
|
||||
C4E528111A8A907200C4B915 /* tgp-ft.c in Sources */ = {isa = PBXBuildFile; fileRef = C4E5280F1A8A907200C4B915 /* tgp-ft.c */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
|
@ -85,6 +86,8 @@
|
|||
C4D819021A5C85FE0044CBA9 /* lodepng.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lodepng.h; sourceTree = "<group>"; };
|
||||
C4D819041A5C862E0044CBA9 /* tgp-structs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "tgp-structs.c"; path = "../tgp-structs.c"; sourceTree = "<group>"; };
|
||||
C4D819051A5C862E0044CBA9 /* tgp-structs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "tgp-structs.h"; path = "../tgp-structs.h"; sourceTree = "<group>"; };
|
||||
C4E5280F1A8A907200C4B915 /* tgp-ft.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "tgp-ft.c"; path = "../tgp-ft.c"; sourceTree = "<group>"; };
|
||||
C4E528101A8A907200C4B915 /* tgp-ft.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "tgp-ft.h"; path = "../tgp-ft.h"; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
|
@ -203,6 +206,8 @@
|
|||
C41D58401A16D88E00B22448 /* tgp-2prpl.c */,
|
||||
C431EB7B1A76C737006521CB /* tgp-chat.c */,
|
||||
C431EB7C1A76C737006521CB /* tgp-chat.h */,
|
||||
C4E5280F1A8A907200C4B915 /* tgp-ft.c */,
|
||||
C4E528101A8A907200C4B915 /* tgp-ft.h */,
|
||||
);
|
||||
name = "telegram-purple";
|
||||
sourceTree = "<group>";
|
||||
|
@ -289,6 +294,7 @@
|
|||
C438CE331A12C07800E1DA0F /* telegram-base.c in Sources */,
|
||||
C438CE341A12C07800E1DA0F /* telegram-purple.c in Sources */,
|
||||
C4877C1819BB37EA006FA91F /* TelegramService.m in Sources */,
|
||||
C4E528111A8A907200C4B915 /* tgp-ft.c in Sources */,
|
||||
C438CE361A12C07800E1DA0F /* tgp-timers.c in Sources */,
|
||||
C410949B19BB337A0083BF3F /* TelegramPlugin.m in Sources */,
|
||||
C4877C1E19BB676B006FA91F /* AdiumTelegramAccount.m in Sources */,
|
||||
|
|
10
tgp-ft.c
10
tgp-ft.c
|
@ -166,6 +166,11 @@ PurpleXfer *tgprpl_new_xfer (PurpleConnection * gc, const char *who) {
|
|||
connection_data *conn = purple_connection_get_protocol_data (gc);
|
||||
|
||||
PurpleXfer *X = purple_xfer_new (conn->pa, PURPLE_XFER_SEND, who);
|
||||
if (X) {
|
||||
purple_xfer_set_init_fnc (X, tgprpl_xfer_send_init);
|
||||
purple_xfer_set_cancel_send_fnc (X, tgprpl_xfer_canceled);
|
||||
tgprpl_xfer_init_data (X, purple_connection_get_protocol_data (gc), NULL);
|
||||
}
|
||||
|
||||
return (PurpleXfer *)X;
|
||||
}
|
||||
|
@ -179,7 +184,6 @@ void tgprpl_recv_file (PurpleConnection * gc, const char *who, struct tgl_docume
|
|||
purple_xfer_set_filename (X, D->caption);
|
||||
purple_xfer_set_init_fnc (X, tgprpl_xfer_recv_init);
|
||||
purple_xfer_set_cancel_recv_fnc (X, tgprpl_xfer_canceled);
|
||||
|
||||
tgprpl_xfer_init_data (X, purple_connection_get_protocol_data (gc), D);
|
||||
|
||||
purple_xfer_request (X);
|
||||
|
@ -189,8 +193,6 @@ void tgprpl_send_file (PurpleConnection * gc, const char *who, const char *file)
|
|||
debug ("tgprpl_send_file()");
|
||||
|
||||
PurpleXfer *X = tgprpl_new_xfer (gc, who);
|
||||
purple_xfer_set_init_fnc (X, tgprpl_xfer_send_init);
|
||||
purple_xfer_set_cancel_send_fnc (X, tgprpl_xfer_canceled);
|
||||
|
||||
if (file) {
|
||||
purple_xfer_request_accepted (X, file);
|
||||
|
@ -198,7 +200,5 @@ void tgprpl_send_file (PurpleConnection * gc, const char *who, const char *file)
|
|||
} else {
|
||||
purple_xfer_request (X);
|
||||
}
|
||||
|
||||
tgprpl_xfer_init_data (X, purple_connection_get_protocol_data (gc), NULL);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue