Merge branch 'dev-1.2.3' into dev-1.3.0

This commit is contained in:
mjentsch 2015-12-19 22:02:54 +01:00
commit b828460886
14 changed files with 188 additions and 83 deletions

View File

@ -152,19 +152,29 @@ Compiling with XCode is a little bit problematic, since it requires you to compi
1. Get the Adium source, compile it with XCode and copy the build output into telegram-adium/Frameworks/Adium. It should contain at least Adium.framework, AdiumLibpurple.framework and AIUitilies.framework
2. Open the Adium source code, go to ./Frameworks and copy libglib.framework and libpurple.framework into telegram-adium/Frameworks/Adium
3. Build the tgl submodule and delete libtgl.so from libs/ (it should only contain libtgl.a)
4. Install libwebp with homebrew and copy it into your project:
4. Install libwebp, libgcrypt and gnupg with homebrew:
brew install webp
cp /usr/local/Cellar/webp/0.4.3/lib/libwebp.a ./telegram-adium/Frameworks/
brew install webp
brew install libgcrypt libgpg-error
5. Install libgcrypt with homebrew and make sure that libgcrypt.dylib is present in /usr/local/lib
5. If you already downloaded libwebp/libgcrypt in previous builds make sure that the binaries are up-to-date
brew install libgcrypt
brew update
brew upgrade webp libgcrypt
6. If you already downloaded libwebp/libgcrypt in previous builds make sure that the binaries are up-to-date
6. Installwith homebrew and move it into the appropriate directory so that XCode can find them. Note that the versions might differ, use the one that is
brew update
brew upgrade webp libgcrypt
mkdir -p ./telegram-adium/Frameworks/Adium
cp /usr/local/Cellar/webp/0.4.3/lib/libwebp.a ./telegram-adium/Frameworks
cp /usr/local/Cellar/libgcrypt/1.6.4/lib/libgcrypt.20.dylib ./telegram-adium/Frameworks/Adium
cp /usr/local/Cellar/libgpg-error/1.20_1/lib/libgpg-error.0.dylib ./telegram-adium/Frameworks/Adium
7. Update the paths in the dylibs, to assure that the resulting binary will load them form within the bundle.
cd ./telegram-adium/Frameworks/Adium
install_name_tool -id "@loader_path/../Resources/libgcrypt.20.dylib" ./libgcrypt.20.dylib
install_name_tool -id "@loader_path/../Resources/libgpg-error.0.dylib" ./libgpg-error.0.dylib
install_name_tool -change "/usr/local/lib/libgpg-error.0.dylib" "@loader_path/../Resources/libgpg-error.0.dylib" ./libgcrypt.20.dylib
7. Build the XCode-Project and execute the created bundle

View File

@ -103,6 +103,19 @@
intValue]);
}
/**!
* @brief Returns the name passed to new_purple_buddy, when adding a new contact
*
* This function is called when creating a new contact from the purple GUI.
*/
- (NSString *)_UIDForAddingObject:(AIListContact *)object
{
// The contact UID in Adium was encoded with decomposoed unicode codepoints (see http://unicode.org/reports/tr15/).
// Since libtgl and libpurple (and apparently the rest of the world) encode with composed code points, the name
// needs to be converted to the composed format to prevent inequality in binary string comparison.
return [object.UID precomposedStringWithCanonicalMapping];
}
#pragma mark Action Menu
-(NSMenu*)actionMenuForChat:(AIChat*)chat
{

View File

@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="8191" systemVersion="15B42" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9060" systemVersion="15C50" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="8191"/>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9060"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="TelegramJoinChatViewController">

View File

@ -7,9 +7,9 @@
objects = {
/* Begin PBXBuildFile section */
33070C10341336CD4EC97534 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 33070D636377BD8BA47CBF63 /* InfoPlist.strings */; };
C40564871A7937C600A293B9 /* AdiumLibpurple.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C40564861A7937C600A293B9 /* AdiumLibpurple.framework */; };
C410948A19BB2D7D0083BF3F /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C410948919BB2D7D0083BF3F /* CoreFoundation.framework */; };
C410949019BB2D7D0083BF3F /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = C410948E19BB2D7D0083BF3F /* InfoPlist.strings */; };
C410949B19BB337A0083BF3F /* TelegramPlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = C410949A19BB337A0083BF3F /* TelegramPlugin.m */; };
C41D58411A16D88E00B22448 /* tgp-2prpl.c in Sources */ = {isa = PBXBuildFile; fileRef = C41D58401A16D88E00B22448 /* tgp-2prpl.c */; };
C425F9181A7069C300361AFC /* tgp-utils.c in Sources */ = {isa = PBXBuildFile; fileRef = C425F9161A7069C300361AFC /* tgp-utils.c */; };
@ -24,8 +24,10 @@
C438CE351A12C07800E1DA0F /* tgp-net.c in Sources */ = {isa = PBXBuildFile; fileRef = C438CE301A12C07800E1DA0F /* tgp-net.c */; };
C438CE361A12C07800E1DA0F /* tgp-timers.c in Sources */ = {isa = PBXBuildFile; fileRef = C438CE311A12C07800E1DA0F /* tgp-timers.c */; };
C448ADA71AB0789A001B7ECD /* tgp-msg.c in Sources */ = {isa = PBXBuildFile; fileRef = C448ADA61AB0789A001B7ECD /* tgp-msg.c */; };
C465FC211C0D0191001CCEE8 /* libgcrypt.20.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = C465FC1B1C0CF43A001CCEE8 /* libgcrypt.20.dylib */; };
C465FC231C0D01B5001CCEE8 /* libgcrypt.20.dylib in Resources */ = {isa = PBXBuildFile; fileRef = C465FC221C0D01B5001CCEE8 /* libgcrypt.20.dylib */; };
C466937819E703370036A108 /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C466937719E703370036A108 /* AppKit.framework */; };
C479A8021BB69C2100C153DF /* tgp-request.c in Sources */ = {isa = PBXBuildFile; fileRef = C479A8001BB69C2100C153DF /* tgp-request.c */; settings = {ASSET_TAGS = (); }; };
C479A8021BB69C2100C153DF /* tgp-request.c in Sources */ = {isa = PBXBuildFile; fileRef = C479A8001BB69C2100C153DF /* tgp-request.c */; };
C4877C1819BB37EA006FA91F /* TelegramService.m in Sources */ = {isa = PBXBuildFile; fileRef = C4877C1719BB37EA006FA91F /* TelegramService.m */; };
C4877C1E19BB676B006FA91F /* TelegramAccount.m in Sources */ = {isa = PBXBuildFile; fileRef = C4877C1D19BB676B006FA91F /* TelegramAccount.m */; };
C487A18C1A792E9B0044F135 /* Adium.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C487A1891A792E9B0044F135 /* Adium.framework */; };
@ -39,10 +41,11 @@
C4B4BE371AB5FB5C0064AC17 /* TelegramJoinChatViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C4B4BE351AB5FB5C0064AC17 /* TelegramJoinChatViewController.m */; };
C4B4BE391AB613950064AC17 /* TelegramJoinChatView.xib in Resources */ = {isa = PBXBuildFile; fileRef = C4B4BE381AB613950064AC17 /* TelegramJoinChatView.xib */; };
C4B57BF01B1598D4006997F4 /* libtgl.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C4B57BEF1B1598D4006997F4 /* libtgl.a */; };
C4D12DF01BC534CF00C0F6E1 /* tgp-blist.c in Sources */ = {isa = PBXBuildFile; fileRef = C4D12DEF1BC534CF00C0F6E1 /* tgp-blist.c */; settings = {ASSET_TAGS = (); }; };
C4D432D61BC2768C00561667 /* libgcrypt.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = C4D432D51BC2768C00561667 /* libgcrypt.dylib */; };
C4D12DF01BC534CF00C0F6E1 /* tgp-blist.c in Sources */ = {isa = PBXBuildFile; fileRef = C4D12DEF1BC534CF00C0F6E1 /* tgp-blist.c */; };
C4D432D81BC2783C00561667 /* tg-server.tglpub in Resources */ = {isa = PBXBuildFile; fileRef = C4D432D71BC2783C00561667 /* tg-server.tglpub */; };
C4D819061A5C862E0044CBA9 /* tgp-structs.c in Sources */ = {isa = PBXBuildFile; fileRef = C4D819041A5C862E0044CBA9 /* tgp-structs.c */; };
C4D9185B1C1C6B3900AECCA2 /* libgpg-error.0.dylib in Resources */ = {isa = PBXBuildFile; fileRef = C4D9185A1C1C6B3900AECCA2 /* libgpg-error.0.dylib */; };
C4D9185C1C1C6B9C00AECCA2 /* libgpg-error.0.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = C4D9185A1C1C6B3900AECCA2 /* libgpg-error.0.dylib */; };
C4E528111A8A907200C4B915 /* tgp-ft.c in Sources */ = {isa = PBXBuildFile; fileRef = C4E5280F1A8A907200C4B915 /* tgp-ft.c */; };
C4EA965A1B204C67006CBAD0 /* libwebp.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C4EA96591B204C67006CBAD0 /* libwebp.a */; };
C4FFD0DC1B5FC48B00939D8A /* TelegramAutocompletionDelegate.h in Sources */ = {isa = PBXBuildFile; fileRef = C4FFD0DB1B5FC48B00939D8A /* TelegramAutocompletionDelegate.h */; };
@ -50,12 +53,12 @@
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
33070918C1B3F67A227F6286 /* en */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
33070A9DBCF625AD9E07CE94 /* telegram-adium-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.info; path = "telegram-adium-Info.plist"; sourceTree = "<group>"; };
33070CD59974365A33795EAF /* telegram-adium-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "telegram-adium-Prefix.pch"; sourceTree = "<group>"; };
C40564861A7937C600A293B9 /* AdiumLibpurple.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AdiumLibpurple.framework; path = Frameworks/Adium/AdiumLibpurple.framework; sourceTree = "<group>"; };
C410948619BB2D7D0083BF3F /* telegram-adium.AdiumLibpurplePlugin */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "telegram-adium.AdiumLibpurplePlugin"; sourceTree = BUILT_PRODUCTS_DIR; };
C410948919BB2D7D0083BF3F /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; };
C410948D19BB2D7D0083BF3F /* telegram-adium-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "telegram-adium-Info.plist"; sourceTree = "<group>"; };
C410948F19BB2D7D0083BF3F /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
C410949119BB2D7D0083BF3F /* telegram-adium-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "telegram-adium-Prefix.pch"; sourceTree = "<group>"; };
C410949919BB337A0083BF3F /* TelegramPlugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TelegramPlugin.h; sourceTree = "<group>"; };
C410949A19BB337A0083BF3F /* TelegramPlugin.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TelegramPlugin.m; sourceTree = "<group>"; };
C41D583F1A16D86A00B22448 /* tgp-2prpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "tgp-2prpl.h"; path = "../tgp-2prpl.h"; sourceTree = "<group>"; };
@ -82,6 +85,8 @@
C438CE3C1A12C15100E1DA0F /* tg-server.pub */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = "tg-server.pub"; path = "../tg-server.pub"; sourceTree = "<group>"; };
C448ADA61AB0789A001B7ECD /* tgp-msg.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "tgp-msg.c"; path = "../tgp-msg.c"; sourceTree = "<group>"; };
C448ADA81AB078BB001B7ECD /* tgp-msg.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "tgp-msg.h"; path = "../tgp-msg.h"; sourceTree = "<group>"; };
C465FC1B1C0CF43A001CCEE8 /* libgcrypt.20.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libgcrypt.20.dylib; path = Frameworks/Adium/libgcrypt.20.dylib; sourceTree = "<group>"; };
C465FC221C0D01B5001CCEE8 /* libgcrypt.20.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libgcrypt.20.dylib; path = Frameworks/Adium/libgcrypt.20.dylib; sourceTree = "<group>"; };
C466937719E703370036A108 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/AppKit.framework; sourceTree = DEVELOPER_DIR; };
C479A7FE1BB1C95300C153DF /* libcrypto.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcrypto.a; path = Frameworks/libcrypto.a; sourceTree = "<group>"; };
C479A8001BB69C2100C153DF /* tgp-request.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "tgp-request.c"; path = "../tgp-request.c"; sourceTree = "<group>"; };
@ -91,7 +96,6 @@
C4877C1C19BB676B006FA91F /* TelegramAccount.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TelegramAccount.h; sourceTree = "<group>"; };
C4877C1D19BB676B006FA91F /* TelegramAccount.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TelegramAccount.m; sourceTree = "<group>"; };
C487A1781A792CD80044F135 /* libssl.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libssl.dylib; path = usr/lib/libssl.dylib; sourceTree = SDKROOT; };
C487A17A1A792CF00044F135 /* libcrypto.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libcrypto.dylib; path = usr/lib/libcrypto.dylib; sourceTree = SDKROOT; };
C487A1891A792E9B0044F135 /* Adium.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Adium.framework; path = Frameworks/Adium/Adium.framework; sourceTree = "<group>"; };
C487A18B1A792E9B0044F135 /* AIUtilities.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AIUtilities.framework; path = Frameworks/Adium/AIUtilities.framework; sourceTree = "<group>"; };
C487A18F1A792EA50044F135 /* libglib.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = libglib.framework; path = Frameworks/Adium/libglib.framework; sourceTree = "<group>"; };
@ -112,13 +116,10 @@
C4B57BEF1B1598D4006997F4 /* libtgl.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libtgl.a; path = ../libs/libtgl.a; sourceTree = "<group>"; };
C4D12DEE1BC534CF00C0F6E1 /* tgp-blist.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "tgp-blist.h"; path = "../tgp-blist.h"; sourceTree = "<group>"; };
C4D12DEF1BC534CF00C0F6E1 /* tgp-blist.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "tgp-blist.c"; path = "../tgp-blist.c"; sourceTree = "<group>"; };
C4D432D31BC2766E00561667 /* libgcrypt.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libgcrypt.dylib; path = ../../../../../usr/local/Cellar/libgcrypt/1.6.4/lib/libgcrypt.dylib; sourceTree = "<group>"; };
C4D432D51BC2768C00561667 /* libgcrypt.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libgcrypt.dylib; path = ../../../../../usr/local/lib/libgcrypt.dylib; sourceTree = "<group>"; };
C4D432D71BC2783C00561667 /* tg-server.tglpub */ = {isa = PBXFileReference; lastKnownFileType = file; name = "tg-server.tglpub"; path = "../tg-server.tglpub"; sourceTree = "<group>"; };
C4D819011A5C85FE0044CBA9 /* lodepng.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = lodepng.c; sourceTree = "<group>"; };
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>"; };
C4D9185A1C1C6B3900AECCA2 /* libgpg-error.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libgpg-error.0.dylib"; path = "Frameworks/Adium/libgpg-error.0.dylib"; 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>"; };
C4EA96591B204C67006CBAD0 /* libwebp.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libwebp.a; path = Frameworks/libwebp.a; sourceTree = "<group>"; };
@ -131,16 +132,17 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
C4D9185C1C1C6B9C00AECCA2 /* libgpg-error.0.dylib in Frameworks */,
C465FC211C0D0191001CCEE8 /* libgcrypt.20.dylib in Frameworks */,
C49A915819BBC5C5001B3DC0 /* libz.dylib in Frameworks */,
C466937819E703370036A108 /* AppKit.framework in Frameworks */,
C4B57BF01B1598D4006997F4 /* libtgl.a in Frameworks */,
C4EA965A1B204C67006CBAD0 /* libwebp.a in Frameworks */,
C49A915819BBC5C5001B3DC0 /* libz.dylib in Frameworks */,
C4D432D61BC2768C00561667 /* libgcrypt.dylib in Frameworks */,
C40564871A7937C600A293B9 /* AdiumLibpurple.framework in Frameworks */,
C487A18C1A792E9B0044F135 /* Adium.framework in Frameworks */,
C487A18E1A792E9B0044F135 /* AIUtilities.framework in Frameworks */,
C487A1911A792EA50044F135 /* libglib.framework in Frameworks */,
C487A1921A792EA50044F135 /* libpurple.framework in Frameworks */,
C466937819E703370036A108 /* AppKit.framework in Frameworks */,
C410948A19BB2D7D0083BF3F /* CoreFoundation.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -148,6 +150,24 @@
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
330704C72BA03B848124B6F7 /* telegram-adium */ = {
isa = PBXGroup;
children = (
3307063DD9566C77D08006F9 /* Supporting Files */,
);
path = "telegram-adium";
sourceTree = "<group>";
};
3307063DD9566C77D08006F9 /* Supporting Files */ = {
isa = PBXGroup;
children = (
33070A9DBCF625AD9E07CE94 /* telegram-adium-Info.plist */,
33070D636377BD8BA47CBF63 /* InfoPlist.strings */,
33070CD59974365A33795EAF /* telegram-adium-Prefix.pch */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
C410947D19BB2D7D0083BF3F = {
isa = PBXGroup;
children = (
@ -170,11 +190,11 @@
C4B4BE381AB613950064AC17 /* TelegramJoinChatView.xib */,
C4B4BE301AB393800064AC17 /* TelegramAccountViewController.h */,
C4B4BE2D1AB392F80064AC17 /* TelegramAccountView.xib */,
C465FC221C0D01B5001CCEE8 /* libgcrypt.20.dylib */,
C4D9185A1C1C6B3900AECCA2 /* libgpg-error.0.dylib */,
C4BF990319BB8B200038D507 /* telegram-purple */,
C410948B19BB2D7D0083BF3F /* telegram-adium */,
C410948819BB2D7D0083BF3F /* Frameworks */,
C410948719BB2D7D0083BF3F /* Products */,
C4D819001A5C85FE0044CBA9 /* lodepng */,
C4877C2919BB6D22006FA91F /* Resources */,
);
sourceTree = "<group>";
@ -190,8 +210,7 @@
C410948819BB2D7D0083BF3F /* Frameworks */ = {
isa = PBXGroup;
children = (
C4D432D51BC2768C00561667 /* libgcrypt.dylib */,
C4D432D31BC2766E00561667 /* libgcrypt.dylib */,
C465FC1B1C0CF43A001CCEE8 /* libgcrypt.20.dylib */,
C479A7FE1BB1C95300C153DF /* libcrypto.a */,
C4B57BEF1B1598D4006997F4 /* libtgl.a */,
C4EA96591B204C67006CBAD0 /* libwebp.a */,
@ -201,7 +220,6 @@
C487A1901A792EA50044F135 /* libpurple.framework */,
C487A1891A792E9B0044F135 /* Adium.framework */,
C487A18B1A792E9B0044F135 /* AIUtilities.framework */,
C487A17A1A792CF00044F135 /* libcrypto.dylib */,
C49A915719BBC5C5001B3DC0 /* libz.dylib */,
C487A1781A792CD80044F135 /* libssl.dylib */,
C438CE2B1A12BF3400E1DA0F /* libtgl.a */,
@ -211,24 +229,6 @@
name = Frameworks;
sourceTree = "<group>";
};
C410948B19BB2D7D0083BF3F /* telegram-adium */ = {
isa = PBXGroup;
children = (
C410948C19BB2D7D0083BF3F /* Supporting Files */,
);
path = "telegram-adium";
sourceTree = "<group>";
};
C410948C19BB2D7D0083BF3F /* Supporting Files */ = {
isa = PBXGroup;
children = (
C410948D19BB2D7D0083BF3F /* telegram-adium-Info.plist */,
C410948E19BB2D7D0083BF3F /* InfoPlist.strings */,
C410949119BB2D7D0083BF3F /* telegram-adium-Prefix.pch */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
C4877C2919BB6D22006FA91F /* Resources */ = {
isa = PBXGroup;
children = (
@ -271,20 +271,11 @@
C479A8011BB69C2100C153DF /* tgp-request.h */,
C4D12DEE1BC534CF00C0F6E1 /* tgp-blist.h */,
C4D12DEF1BC534CF00C0F6E1 /* tgp-blist.c */,
330704C72BA03B848124B6F7 /* telegram-adium */,
);
name = "telegram-purple";
sourceTree = "<group>";
};
C4D819001A5C85FE0044CBA9 /* lodepng */ = {
isa = PBXGroup;
children = (
C4D819011A5C85FE0044CBA9 /* lodepng.c */,
C4D819021A5C85FE0044CBA9 /* lodepng.h */,
);
name = lodepng;
path = ../lodepng;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@ -336,6 +327,8 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
C4D9185B1C1C6B3900AECCA2 /* libgpg-error.0.dylib in Resources */,
C465FC231C0D01B5001CCEE8 /* libgcrypt.20.dylib in Resources */,
C4D432D81BC2783C00561667 /* tg-server.tglpub in Resources */,
C438CE271A12BEAF00E1DA0F /* telegram.png in Resources */,
C4B4BE391AB613950064AC17 /* TelegramJoinChatView.xib in Resources */,
@ -343,8 +336,8 @@
C438CE281A12BEAF00E1DA0F /* telegram16.png in Resources */,
C438CE291A12BEAF00E1DA0F /* telegram22.png in Resources */,
C438CE2A1A12BEAF00E1DA0F /* telegram48.png in Resources */,
C410949019BB2D7D0083BF3F /* InfoPlist.strings in Resources */,
C4B4BE331AB4536F0064AC17 /* PurpleDefaultsTelegram.plist in Resources */,
33070C10341336CD4EC97534 /* InfoPlist.strings in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -381,10 +374,10 @@
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
C410948E19BB2D7D0083BF3F /* InfoPlist.strings */ = {
33070D636377BD8BA47CBF63 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
C410948F19BB2D7D0083BF3F /* en */,
33070918C1B3F67A227F6286 /* en */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
@ -427,7 +420,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.10;
MACOSX_DEPLOYMENT_TARGET = 10.11;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx10.11;
};
@ -466,7 +459,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.10;
MACOSX_DEPLOYMENT_TARGET = 10.11;
SDKROOT = macosx10.11;
};
name = Release;
@ -502,7 +495,7 @@
"$(PROJECT_DIR)/../libs",
"$(PROJECT_DIR)",
"$(PROJECT_DIR)/Frameworks",
/usr/local/Cellar/libgcrypt/1.6.4/lib,
"$(PROJECT_DIR)/Frameworks/Adium",
);
OTHER_CFLAGS = "-DPURPLE_STATIC_PRPL";
PRODUCT_NAME = "$(TARGET_NAME)";
@ -540,9 +533,8 @@
LIBRARY_SEARCH_PATHS = (
"$(PROJECT_DIR)",
"$(PROJECT_DIR)/../libs",
/usr/local/lib,
"$(PROJECT_DIR)/Frameworks",
/usr/local/Cellar/libgcrypt/1.6.4/lib,
"$(PROJECT_DIR)/Frameworks/Adium",
);
OTHER_CFLAGS = "-DPURPLE_STATIC_PRPL";
PRODUCT_NAME = "$(TARGET_NAME)";

View File

@ -310,6 +310,11 @@ void channel_load_photo (struct tgl_state *TLS, void *extra, int success, struct
static void on_get_dialog_list_done (struct tgl_state *TLS, void *extra, int success, int size,
tgl_peer_id_t peers[], tgl_message_id_t *last_msg_id[], int unread_count[]) {
info ("Fetched dialogue list of size: %d", size);
if (tgp_error_if_false (TLS, success, "Fetching dialogue list failed", TLS->error)) {
return;
}
// add all peers in the dialogue list to the buddy list
int i;
for (i = size - 1; i >= 0; i--) {
tgl_peer_t *UC = tgl_peer_get (TLS, peers[i]);
@ -359,6 +364,10 @@ static void on_get_dialog_list_done (struct tgl_state *TLS, void *extra, int suc
NULL);
}
}
// now that the dialogue list is loaded, handle all pending chat joins
tls_get_data (TLS)->dialogues_ready = TRUE;
tgp_chat_join_all_pending (TLS);
}
void on_user_get_info (struct tgl_state *TLS, void *info_data, int success, struct tgl_user *U) {
@ -389,7 +398,6 @@ static const char *tgprpl_list_icon (PurpleAccount *acct, PurpleBuddy *buddy) {
}
static void tgprpl_tooltip_text (PurpleBuddy *buddy, PurpleNotifyUserInfo *info, gboolean full) {
// buddy in old format that didn't migrate
if (! tgp_blist_buddy_has_id (buddy)) {
return;
@ -460,7 +468,7 @@ static void create_chat_link_done (struct tgl_state *TLS, void *extra, int succe
}
}
static void create_chat_link (PurpleBlistNode *node, gpointer data) {
static void export_chat_link_checked_gw (PurpleBlistNode *node, gpointer data) {
PurpleChat *chat = (PurpleChat*)node;
export_chat_link_checked (pbn_get_data (node)->TLS, purple_chat_get_name (chat));
}
@ -479,6 +487,13 @@ void export_chat_link_checked (struct tgl_state *TLS, const char *name) {
tgl_do_export_chat_link (TLS, C->id, create_chat_link_done, C);
}
static void leave_and_delete_chat_gw (PurpleBlistNode *node, gpointer data) {
PurpleChat *C = (PurpleChat *)node;
g_return_if_fail(tgp_chat_has_id (C));
leave_and_delete_chat (pbn_get_data (node)->TLS, tgl_peer_get (pbn_get_data (node)->TLS, tgp_chat_get_id (C)));
}
void leave_and_delete_chat (struct tgl_state *TLS, tgl_peer_t *P) {
g_return_if_fail (P);
if (P && P->chat.users_num) {
@ -507,29 +522,38 @@ void import_chat_link_checked (struct tgl_state *TLS, const char *link) {
static GList* tgprpl_blist_node_menu (PurpleBlistNode *node) {
debug ("tgprpl_blist_node_menu()");
// orphaned buddy in "old" format that didn't migrate
if (! tgp_blist_buddy_has_id ((PurpleBuddy *)node)) {
// skip orphaned buddies in "old" format that didn't migrate and don't have an ID
if (PURPLE_BLIST_NODE_IS_BUDDY(node) && ! tgp_blist_buddy_has_id ((PurpleBuddy *)node)) {
return NULL;
}
// chats that dont have a proper ID arent usable
if (PURPLE_BLIST_NODE_IS_CHAT(node) && ! tgp_chat_has_id ((PurpleChat *)node)) {
return NULL;
}
GList* menu = NULL;
if (PURPLE_BLIST_NODE_IS_BUDDY(node) &&
tgl_get_peer_type (tgp_blist_buddy_get_id ((PurpleBuddy *)node)) == TGL_PEER_USER) {
// Add encrypted chat option to the right click menu of all buddies
PurpleBuddy* buddy = (PurpleBuddy*)node;
PurpleBuddy* buddy = (PurpleBuddy *)node;
PurpleMenuAction* action = purple_menu_action_new (_("Start secret chat..."), PURPLE_CALLBACK(start_secret_chat),
buddy, NULL);
menu = g_list_append (menu, (gpointer)action);
}
if (PURPLE_BLIST_NODE_IS_CHAT(node)) {
// Generate Public Link
PurpleMenuAction* action = purple_menu_action_new (_("Invite users by link..."), PURPLE_CALLBACK(create_chat_link),
NULL, NULL);
PurpleMenuAction* action = purple_menu_action_new (_("Invite users by link..."),
PURPLE_CALLBACK(export_chat_link_checked_gw), NULL, NULL);
menu = g_list_append (menu, (gpointer)action);
}
if (PURPLE_BLIST_NODE_IS_CHAT(node)) {
// Delete self from chat
PurpleMenuAction* action = purple_menu_action_new (_("Delete and exit..."), PURPLE_CALLBACK(leave_and_delete_chat),
PurpleMenuAction* action = purple_menu_action_new (_("Delete and exit..."), PURPLE_CALLBACK(leave_and_delete_chat_gw),
NULL, NULL);
menu = g_list_append (menu, (gpointer)action);
}
@ -552,7 +576,13 @@ static void update_on_logged_in (struct tgl_state *TLS) {
static void update_on_ready (struct tgl_state *TLS) {
info ("update_on_ready(): The account is done fetching new history");
purple_connection_set_display_name (tls_get_conn (TLS), purple_account_get_username (tls_get_pa (TLS)));
tgl_peer_t *P = tgl_peer_get (TLS, TLS->our_id);
g_warn_if_fail(P);
if (P) {
purple_connection_set_display_name (tls_get_conn (TLS), P->print_name);
}
tgl_do_get_dialog_list (TLS, 200, 0, on_get_dialog_list_done, NULL);
tgl_do_update_contact_list (TLS, 0, 0);
}

View File

@ -147,6 +147,10 @@ char *tgp_blist_create_print_name (struct tgl_state *TLS, tgl_peer_id_t id, cons
// libtgl passes 0 for all unused strings, therefore the last passed string will always be followed
// by a NULL-termination as expected
gchar *name = g_strjoin (" ", a1, a2, a3, a4, NULL);
// When the user doesn't provide some input (like last name) ugly trailing or leading
// whitespaces may occur due to empty strings in the join operator
name = g_strstrip(name);
/* Assure that all print_names are unique by checking the following conditions:
1. No other peer with that print_name should exists. If those names are not unique it will not be possible

View File

@ -41,6 +41,17 @@ void p2tgl_chat_update (struct tgl_state *TLS, PurpleChat *chat, tgl_peer_id_t i
g_hash_table_replace (ht, g_strdup ("subject"), g_strdup (subject));
}
int tgp_chat_has_id (PurpleChat *C) {
const char *id = g_hash_table_lookup (purple_chat_get_components (C), "id");
return id && *id;
}
tgl_peer_id_t tgp_chat_get_id (PurpleChat *C) {
const char *id = g_hash_table_lookup (purple_chat_get_components (C), "id");
assert (id && *id);
return TGL_MK_CHAT(atoi (id));
}
void tgp_chat_on_loaded_chat_full (struct tgl_state *TLS, struct tgl_chat *C) {
PurpleChat *PC = tgp_blist_chat_find (TLS, C->id);
if (!PC) {
@ -145,6 +156,19 @@ GHashTable *tgprpl_chat_info_defaults (PurpleConnection *gc, const char *chat_na
void tgprpl_chat_join (PurpleConnection *gc, GHashTable *data) {
debug ("tgprpl_chat_join()");
g_return_if_fail(data);
// auto joins will cause chat joins at a time when the dialogue list is not ready, remember
// those chats and join them once the dialogue list is fetched
if (! gc_get_data (gc)->dialogues_ready) {
g_return_if_fail (data);
const char *id = g_hash_table_lookup (data, "id");
if (id) {
debug ("attempting to join chat %s while not ready, queue up for later", id);
gc_get_data (gc)->pending_joins = g_list_append (gc_get_data (gc)->pending_joins, g_strdup (id));
}
return;
}
// join existing chat by id when the user clicks on a chat in the buddy list
void *value = g_hash_table_lookup (data, "id");
@ -242,3 +266,17 @@ void tgprpl_roomlist_cancel (PurpleRoomlist *list) {
purple_roomlist_unref (list);
}
}
void tgp_chat_join_all_pending (struct tgl_state *TLS) {
GList *pending;
for (pending = tls_get_data (TLS)->pending_joins; pending != NULL; pending = g_list_next(pending)) {
GHashTable *data = g_hash_table_new (g_str_hash, g_str_equal);
g_hash_table_insert (data, "id", pending->data);
tgprpl_chat_join (tls_get_conn (TLS), data);
g_hash_table_destroy (data);
}
if (tls_get_data (TLS)->pending_joins) {
g_list_free (tls_get_data (TLS)->pending_joins);
tls_get_data (TLS)->pending_joins = NULL;
}
}

View File

@ -25,6 +25,9 @@
PurpleChat *p2tgl_chat_new (struct tgl_state *TLS, struct tgl_chat *chat);
tgl_peer_id_t tgp_chat_get_id (PurpleChat *C);
int tgp_chat_has_id (PurpleChat *C);
void tgp_chat_on_loaded_chat_full (struct tgl_state *TLS, struct tgl_chat *C);
PurpleConversation *tgp_chat_show (struct tgl_state *TLS, struct tgl_chat *C);
void tgp_chat_users_update (struct tgl_state *TLS, struct tgl_chat *C);
@ -35,4 +38,5 @@ GList *tgprpl_chat_join_info (PurpleConnection *gc);
PurpleRoomlist *tgprpl_roomlist_get_list (PurpleConnection *gc);
void tgprpl_roomlist_cancel (PurpleRoomlist *list);
GHashTable *tgprpl_chat_info_defaults (PurpleConnection *gc, const char *chat_name);
void tgp_chat_join_all_pending (struct tgl_state *TLS);
#endif

View File

@ -55,7 +55,7 @@ static char *tgp_strdup_determine_filename (const char *mime, const char *captio
type = "bin";
}
}
return g_strdup_printf ("%" G_GINT64_MODIFIER "d.%s", ABS(hash), type);
return g_strdup_printf ("%" G_GINT64_MODIFIER "d.%s", (gint64) ABS(hash), type);
}
static void tgprpl_xfer_recv_on_finished (struct tgl_state *TLS, void *_data, int success, const char *filename) {

View File

@ -269,8 +269,14 @@ static void net_on_connected (gpointer arg, gint fd, const gchar *error_message)
static void net_on_connected_assert_success (gpointer arg, gint fd, const gchar *error_message) {
struct connection *c = arg;
struct tgl_state *TLS = c->TLS;
if (c->fail_ev >= 0) {
purple_timeout_remove (c->fail_ev);
c->fail_ev = -1;
}
if (fd == -1) {
struct tgl_state *TLS = c->TLS;
info ("Connection to main data center (%d) %s:%d not possible\n", c->dc->id, c->ip, c->port);
purple_connection_error_reason (tls_get_conn (TLS), PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Cannot connect to main server"));
return;
@ -302,7 +308,7 @@ struct connection *tgln_create_connection (struct tgl_state *TLS, const char *ho
c->methods = methods;
c->prpl_data = purple_proxy_connect (tls_get_conn (TLS), tls_get_pa (TLS), host, port,
TLS->dc_working_num == dc->id ? net_on_connected_assert_success : net_on_connected, c);
TLS->dc_working_num == dc->id ? net_on_connected_assert_success : net_on_connected, c);
start_fail_timer (c);
@ -317,7 +323,8 @@ static void restart_connection (struct connection *c) {
return;
}
purple_proxy_connect_cancel (c->prpl_data);
c->prpl_data = purple_proxy_connect (tls_get_conn (c->TLS), tls_get_pa (c->TLS), c->ip, c->port, net_on_connected, c);
c->prpl_data = purple_proxy_connect (tls_get_conn (c->TLS), tls_get_pa (c->TLS), c->ip, c->port,
c->TLS->dc_working_num == c->dc->id ? net_on_connected_assert_success : net_on_connected, c);
}
static void fail_connection (struct connection *c) {
@ -358,7 +365,6 @@ static void fail_connection (struct connection *c) {
_("Lost connection to the server..."));
}
//extern FILE *log_net_f;
static void try_write (struct connection *c) {
// debug ("try write: fd = %d\n", c->fd);
int x = 0;

View File

@ -114,12 +114,14 @@ void *connection_data_free (connection_data *conn) {
tgp_g_queue_free_full (conn->new_messages, tgp_msg_loading_free);
tgp_g_queue_free_full (conn->out_messages, tgp_msg_sending_free);
tgp_g_list_free_full (conn->used_images, used_image_free);
tgp_g_list_free_full (conn->pending_joins, g_free);
g_hash_table_destroy (conn->pending_reads);
g_hash_table_destroy (conn->pending_chat_info);
g_hash_table_destroy (conn->id_to_purple_name);
tgprpl_xfer_free_all (conn);
tgl_free_all (conn->TLS);
g_free (conn->TLS->base_path);
tgl_free_all (conn->TLS);
free (conn);
return NULL;
}

View File

@ -45,6 +45,8 @@ typedef struct {
PurpleRoomlist *roomlist;
GHashTable *pending_chat_info;
GHashTable *id_to_purple_name;
GList *pending_joins;
int dialogues_ready;
} connection_data;
typedef struct {

View File

@ -31,6 +31,7 @@ struct tgl_timer {
static int timer_alarm (gpointer arg) {
struct tgl_timer *t = arg;
t->fd = -1;
t->cb (t->TLS, t->arg);
return FALSE;
}

View File

@ -93,8 +93,10 @@ void tgp_g_queue_free_full (GQueue *queue, GDestroyNotify free_func) {
}
void tgp_g_list_free_full (GList *list, GDestroyNotify free_func) {
g_list_foreach (list, (GFunc)free_func, NULL);
g_list_free (list);
if (list) {
g_list_foreach (list, (GFunc)free_func, NULL);
g_list_free (list);
}
}
const char *tgp_mime_to_filetype (const char *mime) {