1
0
mirror of https://github.com/danog/Telegram.git synced 2024-12-02 09:27:55 +01:00
Telegram/legacy/TelegraphKit/TGChangePeerBlockStatusFutureAction.m
2015-10-01 19:19:52 +03:00

44 lines
916 B
Objective-C

#import "TGChangePeerBlockStatusFutureAction.h"
@implementation TGChangePeerBlockStatusFutureAction
@synthesize block = _block;
- (id)initWithPeerId:(int64_t)peerId block:(bool)block
{
self = [super initWithType:TGChangePeerBlockStatusFutureActionType];
if (self != nil)
{
self.uniqueId = peerId;
_block = block;
}
return self;
}
- (NSData *)serialize
{
NSMutableData *data = [[NSMutableData alloc] init];
int block = _block ? 1 : 0;
[data appendBytes:&block length:4];
return data;
}
- (TGFutureAction *)deserialize:(NSData *)data
{
TGChangePeerBlockStatusFutureAction *action = nil;
int ptr = 0;
int block = 0;
[data getBytes:&block range:NSMakeRange(ptr, 4)];
ptr += 4;
action = [[TGChangePeerBlockStatusFutureAction alloc] initWithPeerId:0 block:block != 0 ? true : false];
return action;
}
@end