Update adium wrapper settings

This commit is contained in:
mjentsch 2014-10-05 12:19:15 +02:00
parent 8bc8d2477e
commit cc03e5d059
7 changed files with 125 additions and 90 deletions

View file

@ -1270,11 +1270,11 @@ static PurplePluginInfo plugin_info = {
PURPLE_PRIORITY_DEFAULT,
PLUGIN_ID,
"Telegram",
"0.1",
"Telegram protocol",
"Support for the protocol of the Telegram messenger.",
"Christopher Althaus <althaus.christopher@gmail.com>, Markus Endres <endresma45241@th-nuernberg.de>, Matthias Jentsch <mtthsjntsch@gmail.com>",
"https://bitbucket.org/telegrampurple/telegram-purple",
TG_VERSION,
"Telegram",
TG_DESCRIPTION,
TG_AUTHOR,
"https://github.com/majn/telegram-purple",
NULL, // on load
NULL, // on unload
NULL, // on destroy

View file

@ -16,10 +16,14 @@
#ifndef __TG_PURPLE_H__
#define __TG_PURPLE_H__
#define PLUGIN_ID "prpl-telegram"
#define PLUGIN_ID "prpl-telegram"
#define TELEGRAM_AUTH_MODE_PHONE "phone"
#define TELEGRAM_AUTH_MODE_SMS "sms"
#define TG_AUTHOR "Christopher Althaus <althaus.christopher@gmail.com>, Markus Endres <endresma45241@th-nuernberg.de>, Matthias Jentsch <mtthsjntsch@gmail.com>"
#define TG_DESCRIPTION "A protocol plugin that adds support for the Telegram messenger."
#define TG_VERSION "0.2.0"
#define TG_BUILD "2"
#include <glib.h>
#include "notify.h"

View file

@ -15,14 +15,9 @@
return "prpl-telegram";
}
- (BOOL)connectivityBasedOnNetworkReachability
{
return YES;
}
- (NSString *)host
{
return @"173.240.5.1";
return @"149.154.167.50";
}
- (int)port
@ -30,32 +25,9 @@
return 443;
}
/*
- (NSString *)encodedAttributedString:(NSAttributedString *)inAttributedString forListObject:(AIListObject *)inListObject
{
NSString *temp = [AIHTMLDecoder encodeHTML:inAttributedString
headers:YES
fontTags:NO
includingColorTags:NO
closeFontTags:NO
styleTags:NO
closeStyleTagsOnFontChange:NO
encodeNonASCII:NO
encodeSpaces:NO
imagesPath:nil
attachmentsAsText:YES
onlyIncludeOutgoingImages:NO
simpleTagsOnly:YES
bodyBackground:NO
allowJavascriptURLs:NO];
return temp;
}
*/
- (BOOL)canSendOfflineMessageToContact:(AIListContact *)inContact
{
return YES;
}
@end

View file

@ -6,11 +6,10 @@
// Copyright (c) 2014 Matthias Jentsch. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <Adium/AIPlugin.h>
#import <AdiumLibpurple/AILibpurplePlugin.h>
@interface TelegramPlugin : NSObject <AIPlugin> {
id service;
@interface TelegramPlugin : AIPlugin <AILibpurplePlugin> {
}
@end

View file

@ -6,21 +6,45 @@
// Copyright (c) 2014 Matthias Jentsch. All rights reserved.
//
#import "telegram-purple.h"
#import "TelegramPlugin.h"
#import "TelegramService.h"
#import "telegram-purple.h"
extern void purple_init_telegram_plugin();
@implementation TelegramPlugin
- (void) installPlugin
{
purple_init_telegram();
service = [[TelegramService alloc] init];
purple_init_telegram_plugin();
[TelegramService registerService];
}
- (void) installLibpurplePlugin
{
}
- (void) loadLibpurplePlugin
{
}
- (void) uninstallPlugin
{
service = nil;
}
- (NSString *)pluginAuthor
{
return @TG_AUTHOR;
}
-(NSString *)pluginVersion
{
return @TG_VERSION;
}
-(NSString *)pluginDescription
{
return @"Telegram";
}
@end

View file

@ -9,6 +9,8 @@
#import <Foundation/Foundation.h>
#import <AdiumLibpurple/PurpleService.h>
@interface TelegramService : PurpleService
@interface TelegramService : PurpleService {
}
@end

View file

@ -9,17 +9,40 @@
#import "TelegramService.h"
#import "AdiumTelegramAccount.h"
#import <Adium/AIStatusControllerProtocol.h>
#import <AIUtilities/AIImageAdditions.h>
@implementation TelegramService
- (Class)accountClass{
return [AdiumOkCupidAccount class];
return [AdiumTelegramAccount class];
}
/*
- (AIAccountViewController *)accountViewController {
return [OkCupidAccountViewController accountViewController];
//Service Description
- (NSString *)serviceCodeUniqueID{
return @"prpl-telegram";
}
- (NSString *)serviceID{
return @"Telegram";
}
- (NSString *)serviceClass{
return @"Telegram";
}
- (NSString *)shortDescription{
return @"Telegram";
}
- (NSString *)longDescription{
return @"Telegram";
}
- (NSString *)userNameLabel
{
return @"Phone Number";
}
*/
- (BOOL)supportsProxySettings{
return YES;
@ -32,67 +55,78 @@
- (BOOL)requiresPassword
{
return NO;
return NO;
}
- (BOOL)canCreateGroupChats
{
return YES;
}
- (NSString *)UIDPlaceholder
{
return @"Telegram";
}
//Service Description
- (NSString *)serviceCodeUniqueID{
return @"prpl-telegram";
}
- (NSString *)serviceID{
return @"Telegram";
}
- (NSString *)serviceClass{
return @"Telegram";
}
- (NSString *)shortDescription{
return @"Telegram";
}
- (NSString *)longDescription{
return @"Support for the protocol of the Telegram messenger.";
return @"e.g. +49157123456";
}
- (BOOL)isSocialNetworkingService
{
return NO;
return YES;
}
- (AIServiceImportance)serviceImportance{
return AIServiceSecondary;
}
- (NSCharacterSet *)allowedCharacters{
return [[NSCharacterSet illegalCharacterSet] invertedSet];
}
- (NSCharacterSet *)ignoredCharacters{
return [NSCharacterSet characterSetWithCharactersInString:@""];
- (NSCharacterSet *)allowedCharactersForAccountName
{
return ([NSCharacterSet characterSetWithCharactersInString: @"+1234567890"]);
}
- (NSUInteger)allowedLengthForAccountName
{
return 16;
}
- (NSCharacterSet *)ignoredCharacters{
return [NSCharacterSet characterSetWithCharactersInString:@"/-"];
}
- (BOOL)caseSensitive{
return NO;
}
- (AIServiceImportance)serviceImportance{
return AIServiceSecondary;
}
- (NSImage *)defaultServiceIconOfType:(AIServiceIconType)iconType
{
NSImage *image;
NSString *imagename;
NSSize imagesize;
if (iconType == AIServiceIconLarge)
{
imagename = @"telegram";
imagesize = NSMakeSize(48,48);
} else {
imagename = @"telegram16";
imagesize = NSMakeSize(16,16);
}
image = [NSImage imageNamed:(imagename)]; // TODO: forClass:[self class] loadLazily:YES]
[image setSize:imagesize];
return image;
if ((iconType == AIServiceIconSmall) || (iconType == AIServiceIconList)) {
return [NSImage imageNamed:@"telegram16" forClass:[self class] loadLazily:YES];
} else {
return [NSImage imageNamed:@"telegram" forClass:[self class] loadLazily:YES];
}
}
- (NSString *)pathForDefaultServiceIconOfType:(AIServiceIconType)iconType
{
if ((iconType == AIServiceIconSmall) || (iconType == AIServiceIconList)) {
return [[NSBundle bundleForClass:[self class]] pathForImageResource:@"telegram16"];
}
return [[NSBundle bundleForClass:[self class]] pathForImageResource:@"telegram"];
}
- (void)registerStatuses {
#define ADDSTATUS(name, type) \
[adium.statusController registerStatus:name \
withDescription:[adium.statusController localizedDescriptionForCoreStatusName:name] \
ofType:type forService:self]
[adium.statusController registerStatus:STATUS_NAME_AVAILABLE withDescription:[adium.statusController localizedDescriptionForCoreStatusName:STATUS_NAME_AVAILABLE] ofType:AIAvailableStatusType forService:self];
ADDSTATUS(STATUS_NAME_AVAILABLE, AIAvailableStatusType);
ADDSTATUS(STATUS_NAME_NOT_AVAILABLE, AIAvailableStatusType);
ADDSTATUS(STATUS_NAME_OFFLINE, AIOfflineStatusType);
}
@end