-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGCDAsyncSocketDelegate-didReadData.xm
More file actions
32 lines (20 loc) · 1.08 KB
/
Copy pathGCDAsyncSocketDelegate-didReadData.xm
File metadata and controls
32 lines (20 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
%hook XMPPStream
- (void)socket:(id)sock didReadData:(NSData *)data withTag:(long)tag {
NSString* xml = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
NSUInteger length = [xml length];
int divide_factor = 900;
if(length > divide_factor) {
NSString *isFirst = @"-start";
NSMutableString *mutatingXmlStr = [xml mutableCopy];
while (mutatingXmlStr.length) {
NSString* substring = [mutatingXmlStr substringWithRange:NSMakeRange(0, MIN(divide_factor, mutatingXmlStr.length))];
mutatingXmlStr = [[mutatingXmlStr stringByReplacingCharactersInRange:NSMakeRange(0, MIN(divide_factor, mutatingXmlStr.length)) withString:@""] mutableCopy];
NSLog(@"XMPPFramework receive-partial%@: %@\n", isFirst, substring);
isFirst = @"-contd";
}
} else {
NSLog(@"XMPPFramework receive: %@", xml);
}
%orig;
}
%end