Skip to content
This repository has been archived by the owner on Jan 24, 2022. It is now read-only.

Commit

Permalink
IMDServiceSession exists on ios 5 and 6 too. oops.
Browse files Browse the repository at this point in the history
  • Loading branch information
kirb committed Mar 2, 2014
1 parent dff8121 commit 757e960
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .theos/last_package
Original file line number Diff line number Diff line change
@@ -1 +1 @@
debs/ws.hbang.typestatus_1.1.1~beta5-3+debug_iphoneos-arm.deb
debs/ws.hbang.typestatus_1.1.1~beta5-7_iphoneos-arm.deb
2 changes: 1 addition & 1 deletion .theos/packages/ws.hbang.typestatus-1.1.1~beta5
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3
7
35 changes: 5 additions & 30 deletions IMAgentRelay.x
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ void HBTSPostMessage(HBTSStatusBarType type, NSString *name, BOOL typing) {

#pragma mark - iMessage hooks

%group JonyIveIsCool

%hook IMDServiceSession

- (void)didReceiveMessage:(FZMessage *)message forChat:(id)chat style:(unsigned char)style {
Expand All @@ -32,43 +30,20 @@ void HBTSPostMessage(HBTSStatusBarType type, NSString *name, BOOL typing) {
}
}

%group JonyIveIsCool

- (void)didReceiveMessageReadReceiptForMessageID:(NSString *)messageID date:(NSDate *)date completionBlock:(id)completion {
%orig;

FZMessage *message = [[%c(IMDMessageStore) sharedInstance] messageWithGUID:messageID];
HBTSPostMessage(HBTSStatusBarTypeRead, message.handle, NO);
HBTSPostMessage(HBTSStatusBarTypeRead, [[%c(IMDMessageStore) sharedInstance] messageWithGUID:messageID].handle, NO);
}

%end

%end

%group ForstallForTheWin

%hook IMDaemonListener

- (void)account:(id)account chat:(id)chat style:(unsigned char)style chatProperties:(id)properties messageReceived:(FZMessage *)message {
- (void)didReceiveMessageReadReceiptForMessageID:(NSString *)messageID {
%orig;

if (message.flags == FZMessageFlagsTypingBegan) {
HBTSPostMessage(HBTSStatusBarTypeTyping, message.handle, YES);
} else {
HBTSPostMessage(HBTSStatusBarTypeTypingEnded, message.handle, NO);
}
}

%end

%hook FZMessage

// todo: make this less hacky

- (void)setTimeRead:(NSDate *)timeRead {
%orig;

if (!self.sender && [[NSDate date] timeIntervalSinceDate:self.timeRead] < 1) {
HBTSPostMessage(HBTSStatusBarTypeRead, self.handle, NO);
}
HBTSPostMessage(HBTSStatusBarTypeRead, [[%c(IMDMessageStore) sharedInstance] messageWithGUID:messageID].handle, NO);
}

%end
Expand Down

0 comments on commit 757e960

Please sign in to comment.