Skip to content

Instantly share code, notes, and snippets.

@JRHeaton
Created March 3, 2012 03:36
Show Gist options
  • Save JRHeaton/1964177 to your computer and use it in GitHub Desktop.
Save JRHeaton/1964177 to your computer and use it in GitHub Desktop.
markthatmessage mac beta
/* MarkThatMessage v0.1 beta for OS X
* Designed for use with Messages beta
*
* John Heaton
* [email protected]
* http://github.com/Gojohnnyboi
*/
#import <Foundation/Foundation.h>
#import <AppKit/AppKit.h>
#import <objc/runtime.h>
static IMP orig = NULL;
static Class _IMHeaderChatItem = NULL;
static BOOL shouldShowTS(id self, SEL _cmd, id beforeItem, id afterItem) {
if(!_IMHeaderChatItem)
return (BOOL)orig(self, _cmd, beforeItem, afterItem);
return ![afterItem isKindOfClass:_IMHeaderChatItem];
}
__attribute__((constructor))
static void initMessagesHook() {
_IMHeaderChatItem = objc_getClass("IMHeaderChatItem");
orig = method_setImplementation(class_getInstanceMethod(objc_getClass("IMChat"), @selector(shouldAppendTimestampAfterChatItem:andBeforeChatItem:)), (IMP) shouldShowTS);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment