diff --git a/telegram-adium/TelegramAccountView.xib b/telegram-adium/TelegramAccountView.xib
index ad88634..694497a 100644
--- a/telegram-adium/TelegramAccountView.xib
+++ b/telegram-adium/TelegramAccountView.xib
@@ -49,7 +49,7 @@
-
+
@@ -84,7 +84,7 @@
-
+
@@ -154,7 +154,7 @@
-
+
diff --git a/telegram-adium/TelegramJoinChatView.xib b/telegram-adium/TelegramJoinChatView.xib
new file mode 100644
index 0000000..816fc7a
--- /dev/null
+++ b/telegram-adium/TelegramJoinChatView.xib
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/telegram-adium/TelegramJoinChatViewController.h b/telegram-adium/TelegramJoinChatViewController.h
new file mode 100644
index 0000000..2cd1564
--- /dev/null
+++ b/telegram-adium/TelegramJoinChatViewController.h
@@ -0,0 +1,25 @@
+/*
+ * Adium is the legal property of its developers, whose names are listed in the copyright file included
+ * with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License as published by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+ * Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with this program; if not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#import
+
+@class AIAccount, AICompletingTextField;
+
+@interface TelegramJoinChatViewController : DCJoinChatViewController {
+ IBOutlet NSTextField *textField_roomName;
+}
+
+@end
\ No newline at end of file
diff --git a/telegram-adium/TelegramJoinChatViewController.m b/telegram-adium/TelegramJoinChatViewController.m
new file mode 100644
index 0000000..1b0b190
--- /dev/null
+++ b/telegram-adium/TelegramJoinChatViewController.m
@@ -0,0 +1,51 @@
+/*
+ * Adium is the legal property of its developers, whose names are listed in the copyright file included
+ * with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License as published by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+ * Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with this program; if not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include
+#include "TelegramJoinChatViewController.h"
+
+#import
+#import
+#import
+#import
+
+@interface NSObject (JointChatViewDelegate)
+- (void)setJoinChatEnabled:(BOOL)enabled;
+@end
+
+@implementation TelegramJoinChatViewController
+
+- (void)joinChatWithAccount:(AIAccount *)inAccount
+{
+ NSString *room = [textField_roomName stringValue];
+
+ NSDictionary *chatCreationInfo = [NSDictionary
+ dictionaryWithObjectsAndKeys:room, @"subject", nil];
+
+ [self doJoinChatWithName:room
+ onAccount:inAccount
+ chatCreationInfo:chatCreationInfo
+ invitingContacts:@[]
+ withInvitationMessage:@""];
+}
+
+- (NSString *)nibName
+{
+ return @"TelegramJoinChatView";
+}
+
+
+@end
diff --git a/telegram-adium/TelegramService.m b/telegram-adium/TelegramService.m
index 7220672..0154f8d 100644
--- a/telegram-adium/TelegramService.m
+++ b/telegram-adium/TelegramService.m
@@ -19,6 +19,7 @@
#import "TelegramService.h"
#import "AdiumTelegramAccount.h"
#import "TelegramAccountViewController.h"
+#import "TelegramJoinChatViewController.h"
#import
#import
@@ -32,6 +33,11 @@
- (AIAccountViewController *)accountViewController{
return [TelegramAccountViewController accountViewController];
}
+
+- (DCJoinChatViewController *)joinChatView{
+ return [TelegramJoinChatViewController joinChatView];
+}
+
//Service Description
- (NSString *)serviceCodeUniqueID{
return @"prpl-telegram";
diff --git a/telegram-adium/telegram-adium.xcodeproj/project.pbxproj b/telegram-adium/telegram-adium.xcodeproj/project.pbxproj
index 8f9dc10..722bbc8 100644
--- a/telegram-adium/telegram-adium.xcodeproj/project.pbxproj
+++ b/telegram-adium/telegram-adium.xcodeproj/project.pbxproj
@@ -38,6 +38,8 @@
C4B4BE2E1AB392F80064AC17 /* TelegramAccountView.xib in Resources */ = {isa = PBXBuildFile; fileRef = C4B4BE2D1AB392F80064AC17 /* TelegramAccountView.xib */; };
C4B4BE311AB393800064AC17 /* TelegramAccountViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C4B4BE2F1AB393800064AC17 /* TelegramAccountViewController.m */; };
C4B4BE331AB4536F0064AC17 /* PurpleDefaultsTelegram.plist in Resources */ = {isa = PBXBuildFile; fileRef = C4B4BE321AB4536F0064AC17 /* PurpleDefaultsTelegram.plist */; };
+ C4B4BE371AB5FB5C0064AC17 /* TelegramJoinChatViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C4B4BE351AB5FB5C0064AC17 /* TelegramJoinChatViewController.m */; };
+ C4B4BE391AB613950064AC17 /* TelegramJoinChatView.xib in Resources */ = {isa = PBXBuildFile; fileRef = C4B4BE381AB613950064AC17 /* TelegramJoinChatView.xib */; };
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 */; };
@@ -92,6 +94,9 @@
C4B4BE2F1AB393800064AC17 /* TelegramAccountViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TelegramAccountViewController.m; sourceTree = ""; };
C4B4BE301AB393800064AC17 /* TelegramAccountViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TelegramAccountViewController.h; sourceTree = ""; };
C4B4BE321AB4536F0064AC17 /* PurpleDefaultsTelegram.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = PurpleDefaultsTelegram.plist; sourceTree = ""; };
+ C4B4BE351AB5FB5C0064AC17 /* TelegramJoinChatViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TelegramJoinChatViewController.m; sourceTree = ""; };
+ C4B4BE361AB5FB5C0064AC17 /* TelegramJoinChatViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TelegramJoinChatViewController.h; sourceTree = ""; };
+ C4B4BE381AB613950064AC17 /* TelegramJoinChatView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = TelegramJoinChatView.xib; sourceTree = ""; };
C4D819011A5C85FE0044CBA9 /* lodepng.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = lodepng.c; sourceTree = ""; };
C4D819021A5C85FE0044CBA9 /* lodepng.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lodepng.h; sourceTree = ""; };
C4D819041A5C862E0044CBA9 /* tgp-structs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "tgp-structs.c"; path = "../tgp-structs.c"; sourceTree = ""; };
@@ -135,6 +140,9 @@
C4877C1719BB37EA006FA91F /* TelegramService.m */,
C4877C1C19BB676B006FA91F /* AdiumTelegramAccount.h */,
C4877C1D19BB676B006FA91F /* AdiumTelegramAccount.m */,
+ C4B4BE361AB5FB5C0064AC17 /* TelegramJoinChatViewController.h */,
+ C4B4BE351AB5FB5C0064AC17 /* TelegramJoinChatViewController.m */,
+ C4B4BE381AB613950064AC17 /* TelegramJoinChatView.xib */,
C4B4BE301AB393800064AC17 /* TelegramAccountViewController.h */,
C4B4BE2F1AB393800064AC17 /* TelegramAccountViewController.m */,
C4B4BE2D1AB392F80064AC17 /* TelegramAccountView.xib */,
@@ -290,6 +298,7 @@
buildActionMask = 2147483647;
files = (
C438CE271A12BEAF00E1DA0F /* telegram.png in Resources */,
+ C4B4BE391AB613950064AC17 /* TelegramJoinChatView.xib in Resources */,
C4B4BE2E1AB392F80064AC17 /* TelegramAccountView.xib in Resources */,
C438CE281A12BEAF00E1DA0F /* telegram16.png in Resources */,
C438CE291A12BEAF00E1DA0F /* telegram22.png in Resources */,
@@ -310,6 +319,7 @@
C438CE321A12C07800E1DA0F /* msglog.c in Sources */,
C438CE351A12C07800E1DA0F /* tgp-net.c in Sources */,
C438CE331A12C07800E1DA0F /* telegram-base.c in Sources */,
+ C4B4BE371AB5FB5C0064AC17 /* TelegramJoinChatViewController.m in Sources */,
C438CE341A12C07800E1DA0F /* telegram-purple.c in Sources */,
C4877C1819BB37EA006FA91F /* TelegramService.m in Sources */,
C448ADA71AB0789A001B7ECD /* tgp-msg.c in Sources */,
diff --git a/telegram-purple.c b/telegram-purple.c
index 5b211de..4815c1a 100755
--- a/telegram-purple.c
+++ b/telegram-purple.c
@@ -645,11 +645,24 @@ static void tgprpl_remove_buddy (PurpleConnection * gc, PurpleBuddy * buddy, Pur
static void tgprpl_chat_join (PurpleConnection * gc, GHashTable * data) {
debug ("tgprpl_chat_join()");
-
+ const char *subject = NULL;
+ gpointer value;
connection_data *conn = purple_connection_get_protocol_data (gc);
- gpointer value = g_hash_table_lookup (data, "id");
+
+ value = g_hash_table_lookup (data, "id");
if (value && atoi (value)) {
chat_show (conn->gc, atoi (value));
+ return;
+ }
+
+ subject = g_hash_table_lookup(data, "subject");
+ if (str_not_empty (subject)) {
+ tgl_peer_t *P = tgl_peer_get_by_name (conn->TLS, subject);
+ if (P && tgl_get_peer_type (P->id) == TGL_PEER_CHAT) {
+ chat_show (conn->gc, tgl_get_peer_id (P->id));
+ return;
+ }
+ debug ("Peer with name %s not found or not a chat.", subject);
}
}