adium 4112:e5792c806ab3: Added "Message received (Away)" and "Me...

commits at adium.im commits at adium.im
Wed Aug 3 18:26:22 UTC 2011


details:	http://hg.adium.im/adium/rev/e5792c806ab3
revision:	4112:e5792c806ab3
branch:		(none)
author:		Adrian Godoroja <robotive at me.com>
date:		Wed Aug 03 21:21:16 2011 +0300

Added "Message received (Away)" and "Message received (Away Group Chat)" events. Refs #13278.

diffs (141 lines):

diff -r 2d4963d11438 -r e5792c806ab3 ChangeLogs/Changes.txt
--- a/ChangeLogs/Changes.txt	Wed Aug 03 15:50:33 2011 +0300
+++ b/ChangeLogs/Changes.txt	Wed Aug 03 21:21:16 2011 +0300
@@ -37,6 +37,7 @@
  Events and Notifications
   * Added a "Do Nothing" event. (#3590).
   * Added a "Message sent (Group chat)" event. (Will Bowling) (#12316)
+  * Added "Message received (Away)" and "Message received (Away Group Chat)" events. (#13278)
   * Added Regex support for mentions. (#12832)
 
  Get Info window
diff -r 2d4963d11438 -r e5792c806ab3 Frameworks/Adium Framework/Source/AIAdiumProtocol.h
--- a/Frameworks/Adium Framework/Source/AIAdiumProtocol.h	Wed Aug 03 15:50:33 2011 +0300
+++ b/Frameworks/Adium Framework/Source/AIAdiumProtocol.h	Wed Aug 03 21:21:16 2011 +0300
@@ -89,7 +89,9 @@
 #define CONTENT_MESSAGE_RECEIVED_GROUP		@"Content_MessageReceivedGroup"
 #define CONTENT_MESSAGE_RECEIVED_FIRST		@"Content_MessageReceivedFirst"
 #define CONTENT_MESSAGE_RECEIVED_BACKGROUND	@"Content_MessageReceivedBackground"
-#define CONTENT_MESSAGE_RECEIVED_BACKGROUND_GROUP		@"Content_MessageReceivedBackgroundGroup"
+#define CONTENT_MESSAGE_RECEIVED_BACKGROUND_GROUP @"Content_MessageReceivedBackgroundGroup"
+#define CONTENT_MESSAGE_RECEIVED_AWAY		@"Content_MessageReceivedAway"
+#define CONTENT_MESSAGE_RECEIVED_AWAY_GROUP	@"Content_MessageReceivedAwayGroup"
 #define CONTENT_NUDGE_BUZZ_OCCURED			@"Content_NudgeBuzzOccured"
 #define CONTENT_CONTACT_JOINED_CHAT			@"Content_ContactJoinedChat"
 #define CONTENT_CONTACT_LEFT_CHAT			@"Content_ContactLeftChat"
diff -r 2d4963d11438 -r e5792c806ab3 Source/AIContentController.m
--- a/Source/AIContentController.m	Wed Aug 03 15:50:33 2011 +0300
+++ b/Source/AIContentController.m	Wed Aug 03 21:21:16 2011 +0300
@@ -546,6 +546,14 @@
 				}
 				[chat setHasSentOrReceivedContent:YES];
 			}
+
+			if ([chat.account.statusState statusType] != AIAvailableStatusType) {
+				//If the account is not available, generate CONTENT_MESSAGE_RECEIVED_AWAY
+				previouslyPerformedActionIDs = [adium.contactAlertsController generateEvent:(chat.isGroupChat ? CONTENT_MESSAGE_RECEIVED_AWAY_GROUP : CONTENT_MESSAGE_RECEIVED_AWAY)
+																				forListObject:listObject
+																					 userInfo:userInfo
+																 previouslyPerformedActionIDs:previouslyPerformedActionIDs];					
+			}
 			
 			if (chat != adium.interfaceController.activeChat) {
 				//If the chat is not currently active, generate CONTENT_MESSAGE_RECEIVED_BACKGROUND
diff -r 2d4963d11438 -r e5792c806ab3 Source/AdiumMessageEvents.m
--- a/Source/AdiumMessageEvents.m	Wed Aug 03 15:50:33 2011 +0300
+++ b/Source/AdiumMessageEvents.m	Wed Aug 03 21:21:16 2011 +0300
@@ -50,6 +50,8 @@
 	[adium.contactAlertsController registerEventID:CONTENT_MESSAGE_RECEIVED_BACKGROUND withHandler:self inGroup:AIMessageEventHandlerGroup globalOnly:NO];
 	[adium.contactAlertsController registerEventID:CONTENT_MESSAGE_RECEIVED_GROUP withHandler:self inGroup:AIMessageEventHandlerGroup globalOnly:NO];
 	[adium.contactAlertsController registerEventID:CONTENT_MESSAGE_RECEIVED_BACKGROUND_GROUP withHandler:self inGroup:AIMessageEventHandlerGroup globalOnly:NO];
+	[adium.contactAlertsController registerEventID:CONTENT_MESSAGE_RECEIVED_AWAY withHandler:self inGroup:AIMessageEventHandlerGroup globalOnly:NO];
+    [adium.contactAlertsController registerEventID:CONTENT_MESSAGE_RECEIVED_AWAY_GROUP withHandler:self inGroup:AIMessageEventHandlerGroup globalOnly:NO];
 	[adium.contactAlertsController registerEventID:CONTENT_GROUP_CHAT_MENTION withHandler:self inGroup:AIMessageEventHandlerGroup globalOnly:NO];
 	
 	//Observe chat changes
@@ -179,6 +181,10 @@
 		description = AILocalizedString(@"Sends a message in a group chat",nil);
 	} else if ([eventID isEqualToString:CONTENT_MESSAGE_RECEIVED_BACKGROUND_GROUP]) {
 		description = AILocalizedString(@"Sends a message in a background group chat",nil);
+	} else if ([eventID isEqualToString:CONTENT_MESSAGE_RECEIVED_AWAY]) {
+		description = AILocalizedString(@"Sends a message while away",nil);
+	} else if ([eventID isEqualToString:CONTENT_MESSAGE_RECEIVED_AWAY_GROUP]) {
+		description = AILocalizedString(@"Sends a message in a group chat while away",nil);
 	} else if ([eventID isEqualToString:CONTENT_GROUP_CHAT_MENTION]) {
 		description = AILocalizedString(@"Is mentioned in a group chat message", nil);
 	} else {
@@ -206,6 +212,10 @@
 		description = AILocalizedString(@"Message received (Group Chat)",nil);
 	} else if ([eventID isEqualToString:CONTENT_MESSAGE_RECEIVED_BACKGROUND_GROUP]) {
 		description = AILocalizedString(@"Message received (Background Group Chat)",nil);
+	} else if ([eventID isEqualToString:CONTENT_MESSAGE_RECEIVED_AWAY]) {
+		description = AILocalizedString(@"Message received (Away)",nil);
+	} else if ([eventID isEqualToString:CONTENT_MESSAGE_RECEIVED_AWAY_GROUP]) {
+		description = AILocalizedString(@"Message received (Away Group Chat)",nil);
 	} else if ([eventID isEqualToString:CONTENT_GROUP_CHAT_MENTION]) {
 		description = AILocalizedString(@"You are mentioned (Group Chat)", nil);
 	} else {
@@ -235,6 +245,10 @@
 		description = @"Message Received (Group Chat)";
 	} else if ([eventID isEqualToString:CONTENT_MESSAGE_RECEIVED_BACKGROUND_GROUP]) {
 		description = @"Message Received (Background Group Chat)";
+	} else if ([eventID isEqualToString:CONTENT_MESSAGE_RECEIVED_AWAY]) {
+		description = @"Message Received (Away)";
+	} else if ([eventID isEqualToString:CONTENT_MESSAGE_RECEIVED_AWAY_GROUP]) {
+		description = @"Message Received (Away Group Chat)";
 	} else if ([eventID isEqualToString:CONTENT_GROUP_CHAT_MENTION]) {
 		description = @"You Are Mentioned (Group Chat)";
 	} else {
@@ -266,6 +280,10 @@
 			format = AILocalizedString(@"When %@ sends a message to you in a group chat",nil);
 		} else if ([eventID isEqualToString:CONTENT_MESSAGE_RECEIVED_BACKGROUND_GROUP]) {
 			format = AILocalizedString(@"When %@ sends a message to you in a background group chat",nil);
+		} else if ([eventID isEqualToString:CONTENT_MESSAGE_RECEIVED_AWAY]) {
+			format = AILocalizedString(@"When %@ sends a message to you while you are away",nil);
+		} else if ([eventID isEqualToString:CONTENT_MESSAGE_RECEIVED_AWAY_GROUP]) {
+			format = AILocalizedString(@"When %@ sends a message to you in a group chat while you are way",nil);
 		} else if ([eventID isEqualToString:CONTENT_GROUP_CHAT_MENTION]) {
 			format = AILocalizedString(@"When %@ sends a message that mentions your name in a group chat", nil);
 		} else {
@@ -295,6 +313,10 @@
 			description = AILocalizedString(@"When you receive a message in a group chat",nil);
 		} else if ([eventID isEqualToString:CONTENT_MESSAGE_RECEIVED_BACKGROUND_GROUP]) {
 			description = AILocalizedString(@"When you receive a message in a background group chat",nil);
+		} else if ([eventID isEqualToString:CONTENT_MESSAGE_RECEIVED_AWAY]) {
+			description = AILocalizedString(@"When you receive a message while away",nil);
+		} else if ([eventID isEqualToString:CONTENT_MESSAGE_RECEIVED_AWAY_GROUP]) {
+			description = AILocalizedString(@"When you receive a message in a group chat while away",nil);
 		} else if ([eventID isEqualToString:CONTENT_GROUP_CHAT_MENTION]) {
 			description = AILocalizedString(@"When you receive a message that mentions your name in a group chat", nil);
 		} else {
@@ -340,7 +362,9 @@
 			
 		} else if ([eventID isEqualToString:CONTENT_MESSAGE_RECEIVED] ||
 				   [eventID isEqualToString:CONTENT_MESSAGE_RECEIVED_FIRST] ||
-				   [eventID isEqualToString:CONTENT_MESSAGE_RECEIVED_BACKGROUND]) {
+				   [eventID isEqualToString:CONTENT_MESSAGE_RECEIVED_BACKGROUND] ||
+				   [eventID isEqualToString:CONTENT_MESSAGE_RECEIVED_AWAY] ||
+                   [eventID isEqualToString:CONTENT_MESSAGE_RECEIVED_AWAY_GROUP]) {
 			displayName = contentObject.source.displayName;
 			
 			if (messageText && [messageText length]) {
@@ -365,6 +389,8 @@
 				[eventID isEqualToString:CONTENT_MESSAGE_RECEIVED_BACKGROUND] ||
 				[eventID isEqualToString:CONTENT_MESSAGE_RECEIVED_GROUP] ||
 				[eventID isEqualToString:CONTENT_MESSAGE_RECEIVED_BACKGROUND_GROUP] || 
+				[eventID isEqualToString:CONTENT_MESSAGE_RECEIVED_AWAY] ||
+                [eventID isEqualToString:CONTENT_MESSAGE_RECEIVED_AWAY_GROUP] ||
 				[eventID isEqualToString:CONTENT_GROUP_CHAT_MENTION]) {
 				//Use the message received text for all message received events if we don't have a message
 				description = [self globalShortDescriptionForEventID:CONTENT_MESSAGE_RECEIVED];
@@ -426,7 +452,9 @@
 			   [eventID isEqualToString:CONTENT_MESSAGE_RECEIVED_FIRST] ||
 			   [eventID isEqualToString:CONTENT_MESSAGE_RECEIVED_BACKGROUND] ||
 			   [eventID isEqualToString:CONTENT_MESSAGE_RECEIVED_GROUP] ||
-			   [eventID isEqualToString:CONTENT_MESSAGE_RECEIVED_BACKGROUND_GROUP]) {
+			   [eventID isEqualToString:CONTENT_MESSAGE_RECEIVED_BACKGROUND_GROUP] ||
+			   [eventID isEqualToString:CONTENT_MESSAGE_RECEIVED_AWAY] ||
+               [eventID isEqualToString:CONTENT_MESSAGE_RECEIVED_AWAY_GROUP]) {
 		format = AILocalizedString(@"%u messages received", nil);
 	} else if ([eventID isEqualToString:CONTENT_GROUP_CHAT_MENTION]) {
 		format = AILocalizedString(@"%u mentions received", nil);



More information about the commits mailing list