From e24d06d9b8d750f9160d1a2845506b0609c32abe Mon Sep 17 00:00:00 2001 From: Victor Igumnov Date: Tue, 22 May 2018 10:33:36 -0700 Subject: [PATCH] Plugin is now working... --- slack4adium/PurpleSlackAccount.m | 17 ++++++----------- slack4adium/PurpleSlackService.m | 23 ++++++++++------------- 2 files changed, 16 insertions(+), 24 deletions(-) diff --git a/slack4adium/PurpleSlackAccount.m b/slack4adium/PurpleSlackAccount.m index a98fe12..d06162f 100644 --- a/slack4adium/PurpleSlackAccount.m +++ b/slack4adium/PurpleSlackAccount.m @@ -12,7 +12,7 @@ @implementation PurpleSlackAccount - (const char*)protocolPlugin { - return "prpl-slackweb"; + return "prpl-slack"; } - (NSString *)host @@ -20,7 +20,7 @@ - (NSString *)host return @"slack.com"; } -/* + - (const char *)purpleStatusIDForStatus:(AIStatus *)statusState arguments:(NSMutableDictionary *)arguments { @@ -28,22 +28,17 @@ - (const char *)purpleStatusIDForStatus:(AIStatus *)statusState switch (statusState.statusType) { case AIAvailableStatusType: - statusID = "Online"; + statusID = "active"; break; case AIAwayStatusType: - statusID = "Away"; - break; - - case AIInvisibleStatusType: - statusID = "Hidden"; + statusID = "away"; break; - case AIOfflineStatusType: - statusID = "Offline"; + statusID = "offline"; break; } return statusID; -}*/ +} @end diff --git a/slack4adium/PurpleSlackService.m b/slack4adium/PurpleSlackService.m index bd6e395..b8d22f5 100644 --- a/slack4adium/PurpleSlackService.m +++ b/slack4adium/PurpleSlackService.m @@ -28,7 +28,7 @@ - (NSString *) serviceCodeUniqueID { return @"libpurple-slackweb"; } - (NSString *) serviceID { return @"Slack"; } - (NSString *) serviceClass { return @"Slack"; } - (NSString *) shortDescription { return @"Slack"; } -- (NSString *) longDescription { return @"Slack Web API"; } +- (NSString *) longDescription { return @"Slack API"; } - (NSUInteger) allowedLength { return 64; } - (BOOL) requiresPassword { return YES; } - (BOOL) supportsPassword { return YES; } @@ -52,18 +52,15 @@ - (NSString *)pathForDefaultServiceIconOfType:(AIServiceIconType)iconType return [[NSBundle bundleForClass:[self class]] pathForImageResource:@"slack48"]; } -- (void)registerStatus:(NSString*) status_name ofType:(AIStatusType) status_type -{ - [adium.statusController registerStatus:status_name - withDescription:[adium.statusController localizedDescriptionForCoreStatusName:status_name] - ofType:status_type forService:self]; -} - -- (void)registerStatuses { - [self registerStatus: STATUS_NAME_AVAILABLE ofType:AIAvailableStatusType]; - [self registerStatus: STATUS_NAME_AWAY ofType:AIAwayStatusType]; - [self registerStatus: STATUS_NAME_BUSY ofType:AIAwayStatusType]; - [self registerStatus: STATUS_NAME_OFFLINE ofType:AIOfflineStatusType]; +- (void) registerStatuses { +#define ADDSTATUS(name, type) \ +[adium.statusController registerStatus:name \ +withDescription:[adium.statusController localizedDescriptionForCoreStatusName:name] \ +ofType:type forService:self] + + ADDSTATUS(STATUS_NAME_AVAILABLE, AIAvailableStatusType); + ADDSTATUS(STATUS_NAME_AWAY, AIAwayStatusType); + ADDSTATUS(STATUS_NAME_OFFLINE, AIOfflineStatusType); } @end