📄 user.mm
字号:
- (BOOL)hasPet { return [self checkFlagEx:kQQFlagExPet] || [self checkFlagEx:kQQFlagExPetEx];}- (BOOL)hasRing { return (m_userFlag & kQQFlagRing) != 0;}- (BOOL)hasSpace { return [self checkFlagEx:kQQFlagExSpace];}- (BOOL)hasTang { return [self checkFlagEx:kQQFlagExTang];}- (BOOL)isCreator:(Cluster*)cluster { return m_QQ == [[cluster info] creator];}- (BOOL)isAdmin:(Cluster*)cluster { ClusterSpecificInfo* info = [m_clusterSpecificInfos objectForKey:[NSNumber numberWithUnsignedInt:[cluster internalId]]]; return [info isAdmin];}- (BOOL)isStockholder:(Cluster*)cluster { ClusterSpecificInfo* info = [m_clusterSpecificInfos objectForKey:[NSNumber numberWithUnsignedInt:[cluster internalId]]]; return [info isStockholder];}- (BOOL)isManaged:(Cluster*)cluster { ClusterSpecificInfo* info = [m_clusterSpecificInfos objectForKey:[NSNumber numberWithUnsignedInt:[cluster internalId]]]; return [info isManaged];}- (BOOL)isSuperUser:(Cluster*)cluster { ClusterSpecificInfo* info = [m_clusterSpecificInfos objectForKey:[NSNumber numberWithUnsignedInt:[cluster internalId]]]; return [[cluster info] creator] == m_QQ || [info isAdmin] || [info isStockholder];}- (void)increaseMessageCount { m_messageCount++; [[NSNotificationCenter defaultCenter] postNotificationName:kModelMessageCountChangedNotificationName object:self userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInt:(m_messageCount - 1)], kUserInfoOldMessageCount, [NSNumber numberWithInt:m_messageCount], kUserInfoNewMessageCount, m_domain, kUserInfoDomain, nil]];}- (void)increaseTempSessionMessageCount { m_tempSessionMessageCount++; [[NSNotificationCenter defaultCenter] postNotificationName:kModelMessageCountChangedNotificationName object:self userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInt:(m_tempSessionMessageCount - 1)], kUserInfoOldMessageCount, [NSNumber numberWithInt:m_tempSessionMessageCount], kUserInfoNewMessageCount, m_domain, kUserInfoDomain, nil]];}- (void)increaseMobileMessageCount { m_mobileMessageCount++; [[NSNotificationCenter defaultCenter] postNotificationName:kModelMessageCountChangedNotificationName object:self userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInt:(m_mobileMessageCount - 1)], kUserInfoOldMessageCount, [NSNumber numberWithInt:m_mobileMessageCount], kUserInfoNewMessageCount, m_domain, kUserInfoDomain, nil]];}- (BOOL)isOffline { return m_status == kQQStatusOffline;}- (BOOL)isVisible { return m_status == kQQStatusAway || m_status == kQQStatusOnline || m_status == kQQStatusQMe || m_status == kQQStatusBusy || m_status == kQQStatusMute;}- (NSString*)remarkOrNickOrQQ { NSString* dname = [self remarkName]; if([dname isEmpty]) dname = [self nick]; if([dname isEmpty]) dname = [[NSNumber numberWithUnsignedInt:m_QQ] description]; return dname;}#pragma mark -#pragma mark getter and setter- (ContactInfo*)contact { return m_contact;}- (void)setContact:(ContactInfo*)contact { [contact retain]; [m_contact release]; m_contact = contact; if(m_contact) { [self setHead:[m_contact head]]; [self setNick:[m_contact nick]]; [self setName:[m_contact name]]; [self setUserFlag:[m_contact userFlag]]; [self setMM:[m_contact isMM]]; }}- (UInt32)QQ { return m_QQ;}- (UInt16)head { return m_head;}- (void)setHead:(UInt16)head { m_head = head; if(m_contact) [m_contact setHead:head];}- (char)age { return m_contact ? [m_contact age] : 0;}- (void)setAge:(char)age { if(m_contact) [m_contact setAge:age];}- (BOOL)isMM { return m_gender == kQQGenderFemale;}- (void)setMM:(BOOL)mm { m_gender = mm ? kQQGenderFemale : kQQGenderMale;}- (int)level { return m_level;}- (void)setLevel:(int)level { m_level = level;}- (int)upgradeDays { return m_upgradeDays;}- (void)setUpgradeDays:(int)days { m_upgradeDays = days;}- (int)userFlag { return m_userFlag;}- (void)setUserFlag:(int)flag { m_userFlag = flag; if(m_contact) [m_contact setUserFlag:flag];}- (NSString*)nick { return m_nick ? m_nick : kStringEmpty;}- (void)setNick:(NSString*)nick { [nick retain]; [m_nick release]; m_nick = nick;}- (NSString*)name { return m_name ? m_name : kStringEmpty;}- (void)setName:(NSString*)name { [name retain]; [m_name release]; m_name = name; if(m_contact) [m_contact setName:name];}- (NSString*)remarkName { return m_remarkName ? m_remarkName : kStringEmpty;}- (void)setRemarkName:(NSString*)remarkName { [remarkName retain]; [m_remarkName release]; m_remarkName = remarkName;}- (NSString*)signature { return m_signature ? m_signature : kStringEmpty;}- (void)setSignature:(NSString*)signature { [signature retain]; [m_signature release]; m_signature = signature;}- (char)status { return m_status;}- (void)setStatus:(char)status { m_status = status;}- (NSData*)userFlagEx { return m_userFlagEx;}- (void)setUserFlagEx:(NSData*)userFlagEx { [userFlagEx retain]; [m_userFlagEx release]; m_userFlagEx = userFlagEx;}- (UInt32)signatureModifiedTime { return m_signatureModifiedTime;}- (void)setSignatureModifiedTime:(UInt32)time { m_signatureModifiedTime = time;}- (int)groupIndex { return m_groupIndex;}- (void)setGroupIndex:(int)groupIndex { m_groupIndex = groupIndex;}- (ClusterSpecificInfo*)getClusterSpecificInfo:(UInt32)internalId { ClusterSpecificInfo* info = [m_clusterSpecificInfos objectForKey:[NSNumber numberWithUnsignedInt:internalId]]; if(info == nil) { info = [[ClusterSpecificInfo alloc] init]; [m_clusterSpecificInfos setObject:info forKey:[NSNumber numberWithUnsignedInt:internalId]]; } else [info retain]; return [info autorelease];}- (void)setRoleFlag:(UInt32)internalId role:(UInt32)role { ClusterSpecificInfo* info = [self getClusterSpecificInfo:internalId]; [info setRoleFlag:role];}- (void)setOrganization:(UInt32)internalId organization:(UInt32)organization { ClusterSpecificInfo* info = [self getClusterSpecificInfo:internalId]; [info setOrganization:organization];}- (UInt8)organization:(UInt32)internalId { ClusterSpecificInfo* info = [self getClusterSpecificInfo:internalId]; return [info organization];}- (ClusterNameCard*)nameCard:(UInt32)internalId { ClusterSpecificInfo* info = [self getClusterSpecificInfo:internalId]; return [info nameCard];}- (void)setNameCard:(UInt32)internalId card:(ClusterNameCard*)card { ClusterSpecificInfo* info = [self getClusterSpecificInfo:internalId]; [info setNameCard:card];}- (UInt32)lastTalkTime:(UInt32)internalId { ClusterSpecificInfo* info = [self getClusterSpecificInfo:internalId]; return [info lastTalkTime];}- (void)setLastTalkTime:(UInt32)internalId time:(UInt32)time { ClusterSpecificInfo* info = [self getClusterSpecificInfo:internalId]; [info setLastTalkTime:time];}- (const char*)ip { return m_ip;}- (void)setIp:(const char*)ip { memcpy(m_ip, ip, 4 * sizeof(char));}- (UInt16)port { return m_port;}- (void)setPort:(UInt16)port { m_port = port;}- (UInt32)messageCount { return m_messageCount;}- (void)setMessageCount:(UInt32)count { NSNumber* oldCount = [NSNumber numberWithInt:m_messageCount]; m_messageCount = count; [[NSNotificationCenter defaultCenter] postNotificationName:kModelMessageCountChangedNotificationName object:self userInfo:[NSDictionary dictionaryWithObjectsAndKeys:oldCount, kUserInfoOldMessageCount, [NSNumber numberWithInt:count], kUserInfoNewMessageCount, m_domain, kUserInfoDomain, nil]];}- (UInt32)tempSessionMessageCount { return m_tempSessionMessageCount;}- (void)setTempSessionMessageCount:(UInt32)count { NSNumber* oldCount = [NSNumber numberWithInt:m_tempSessionMessageCount]; m_tempSessionMessageCount = count; [[NSNotificationCenter defaultCenter] postNotificationName:kModelMessageCountChangedNotificationName object:self userInfo:[NSDictionary dictionaryWithObjectsAndKeys:oldCount, kUserInfoOldMessageCount, [NSNumber numberWithInt:count], kUserInfoNewMessageCount, m_domain, kUserInfoDomain, nil]];}- (UInt32)mobileMessageCount { return m_mobileMessageCount;}- (void)setMobileMessageCount:(UInt32)count { NSNumber* oldCount = [NSNumber numberWithInt:m_mobileMessageCount]; m_mobileMessageCount = count; [[NSNotificationCenter defaultCenter] postNotificationName:kModelMessageCountChangedNotificationName object:self userInfo:[NSDictionary dictionaryWithObjectsAndKeys:oldCount, kUserInfoOldMessageCount, [NSNumber numberWithInt:count], kUserInfoNewMessageCount, m_domain, kUserInfoDomain, nil]];}- (int*)frameArray { return m_frame;}- (void)setFrame:(int)frame index:(int)index { m_frame[index] = frame;}- (void)setOnlining:(BOOL)flag { m_onlining = flag;}- (BOOL)onlining { return m_onlining;}- (float)inputBoxProportion { return m_inputBoxProportion;}- (void)setInputBoxProportion:(float)proportion { m_inputBoxProportion = proportion;}- (MainWindowController*)domain { return m_domain;}- (void)setDomain:(MainWindowController*)domain { [domain retain]; [m_domain release]; m_domain = domain;}- (BOOL)mobileChatting { return m_mobileChatting;}- (void)setMobileChatting:(BOOL)value { m_mobileChatting = value;}- (NSString*)statusMessage { return m_statusMessage;}- (void)setStatusMessage:(NSString*)statusMessage { [statusMessage retain]; [m_statusMessage release]; m_statusMessage = statusMessage;}- (CustomHead*)customHead { return m_customHead;}- (void)setCustomHead:(CustomHead*)head { [head retain]; [m_customHead release]; m_customHead = head;}@end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -