NIMUsrInfoData.m 1005 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. //
  2. // UsrInfoData.m
  3. // NIM
  4. //
  5. // Created by Xuhui on 15/3/19.
  6. // Copyright (c) 2015年 Netease. All rights reserved.
  7. //
  8. #import "NIMUsrInfoData.h"
  9. #import "NIMSpellingCenter.h"
  10. #import "NIMKit.h"
  11. @implementation NIMUsrInfo
  12. - (BOOL)isFriend {
  13. NSArray *friends = [NIMSDK sharedSDK].userManager.myFriends;
  14. for (NIMUser *user in friends) {
  15. if ([user.userId isEqualToString:self.info.infoId]) {
  16. return YES;
  17. }
  18. }
  19. return NO;
  20. }
  21. - (NSString *)groupTitle {
  22. NSString *title = [[NIMSpellingCenter sharedCenter] firstLetter:self.info.showName].capitalizedString;
  23. unichar character = [title characterAtIndex:0];
  24. if (character >= 'A' && character <= 'Z') {
  25. return title;
  26. }else{
  27. return @"#";
  28. }
  29. }
  30. - (NSString *)memberId{
  31. return self.info.infoId;
  32. }
  33. - (NSString *)showName{
  34. return self.info.showName;
  35. }
  36. - (id)sortKey {
  37. return [[NIMSpellingCenter sharedCenter] spellingForString:self.info.showName].shortSpelling;
  38. }
  39. @end