JXMainViewController.m 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574
  1. //
  2. // JXMainViewController.m
  3. //
  4. // Created by flyeagleTang on 14-4-3.
  5. // Copyright (c) 2014年 Reese. All rights reserved.
  6. //
  7. #import "JXMainViewController.h"
  8. #import "JXTabMenuView.h"
  9. #import "JXMsgViewController.h"
  10. #import "JXFriendViewController.h"
  11. #import "AppDelegate.h"
  12. #import "JXNewFriendViewController.h"
  13. #import "JXFriendObject.h"
  14. #import "PSMyViewController.h"
  15. #ifdef Live_Version
  16. #import "JXLiveViewController.h"
  17. #endif
  18. #import "WeiboViewControlle.h"
  19. #import "JXSquareViewController.h"
  20. #import "JXProgressVC.h"
  21. #import "JXGroupViewController.h"
  22. #import "OrganizTreeViewController.h"
  23. #import "JXLabelObject.h"
  24. #import "JXBlogRemind.h"
  25. #import "JXRoomPool.h"
  26. #import "JXDeviceAuthController.h"
  27. #import "CYWebAddPointVC.h"
  28. #import "CYWebBettingVC.h"
  29. @implementation JXMainViewController{
  30. NSString * _linkName1;
  31. NSString * _linkName2;
  32. NSString * _linkURL1;
  33. NSString * _linkURL2;
  34. NSString * _imgUrl1;
  35. NSString * _imgUrl2;
  36. }
  37. @synthesize tb=_tb;
  38. @synthesize btn=_btn,mainView=_mainView;
  39. @synthesize IS_HR_MODE;
  40. @synthesize psMyviewVC=_psMyviewVC;
  41. - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
  42. {
  43. self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
  44. if (self) {
  45. self.isLoadFriendAndGroup = [g_server.myself fetchAllFriends].count < 6;
  46. self.view.backgroundColor = [UIColor clearColor];
  47. if(AppStore == 1){
  48. } else {
  49. self.vcnum = (int)g_App.linkArray.count;
  50. }
  51. if (self.vcnum < 0 || self.vcnum >2) {
  52. self.vcnum = 0;
  53. }else{
  54. for (int i = 0; i < self.vcnum; i++) {
  55. if (i == 0) {
  56. _linkName1 = g_App.linkArray[i][@"desc"];
  57. _linkURL1 = g_App.linkArray[i][@"link"];
  58. _imgUrl1 = g_App.linkArray[i][@"imgUrl"];
  59. if (_linkName1.length < 1) {
  60. _linkName1 = @"百度";
  61. }
  62. if (_linkURL1.length < 1) {
  63. _linkURL1 = @"http://www.baidu.com";
  64. }
  65. }else if (i == 1){
  66. _linkName2 = g_App.linkArray[i][@"desc"];
  67. _linkURL2 = g_App.linkArray[i][@"link"];
  68. _imgUrl2 = g_App.linkArray[i][@"imgUrl"];
  69. if (_linkName2.length < 1) {
  70. _linkName2 = @"百度";
  71. }
  72. if (_linkURL2.length < 1) {
  73. _linkURL2 = @"http://www.baidu.com";
  74. }
  75. }
  76. }
  77. }
  78. // g_navigation.lastVC = nil;
  79. // [g_navigation.subViews removeAllObjects];
  80. // [g_navigation pushViewController:self animated:YES];
  81. //
  82. _topView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, JX_SCREEN_WIDTH, JX_SCREEN_TOP)];
  83. // [self.view addSubview:_topView];
  84. // [_topView release];
  85. _mainView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, JX_SCREEN_WIDTH, JX_SCREEN_HEIGHT-JX_SCREEN_BOTTOM)];
  86. [self.view addSubview:_mainView];
  87. // [_mainView release];
  88. _bottomView = [[UIImageView alloc] initWithFrame:CGRectMake(0, JX_SCREEN_HEIGHT-JX_SCREEN_BOTTOM, JX_SCREEN_WIDTH, JX_SCREEN_BOTTOM)];
  89. _bottomView.userInteractionEnabled = YES;
  90. _bottomView.backgroundColor = HEXCOLOR(0xF1F1F1);
  91. [self.view addSubview:_bottomView];
  92. // [_bottomView release];
  93. [self buildTop];
  94. #ifdef IS_SHOW_MENU
  95. _squareVC = [[JXSquareViewController alloc] init];
  96. #else
  97. if (self.vcnum == 0) {
  98. _weiboVC = [WeiboViewControlle alloc];
  99. _weiboVC.user = g_server.myself;
  100. _weiboVC = [_weiboVC init];
  101. }else if(self.vcnum == 1) {
  102. _weiboVC = [WeiboViewControlle alloc];
  103. _weiboVC.user = g_server.myself;
  104. _weiboVC = [_weiboVC init];
  105. _webAddPointVC = [[CYWebAddPointVC alloc] init];
  106. _webAddPointVC.name = _linkName1;
  107. _webAddPointVC.strURL = _linkURL1;
  108. _csHomeVc = [[JXCsHomeVc alloc] init];
  109. _csHomeVc.name = _linkName1;
  110. _csHomeVc.strURL = _linkURL1;
  111. }else if(self.vcnum == 2) {
  112. _weiboVC = [WeiboViewControlle alloc];
  113. _weiboVC.user = g_server.myself;
  114. _weiboVC = [_weiboVC init];
  115. _webAddPointVC = [[CYWebAddPointVC alloc] init];
  116. _webAddPointVC.name = _linkName1;
  117. _webAddPointVC.strURL = _linkURL1;
  118. _webBettingVC = [[CYWebBettingVC alloc] init];
  119. _webBettingVC.name = _linkName2;
  120. _webBettingVC.strURL = _linkURL2;
  121. _csHomeVc = [[JXCsHomeVc alloc] init];
  122. _csHomeVc.name = _linkName2;
  123. _csHomeVc.strURL = _linkURL2;
  124. }
  125. // _weiboVC = [WeiboViewControlle alloc];
  126. // _weiboVC.user = g_server.myself;
  127. // _weiboVC = [_weiboVC init];
  128. #endif
  129. if (g_server.isManualLogin && self.isLoadFriendAndGroup) {
  130. _groupVC = [JXGroupViewController alloc];
  131. [_groupVC scrollToPageUp];
  132. }
  133. _msgVc = [[JXMsgViewController alloc] init];
  134. _friendVC = [[JXFriendViewController alloc] init];
  135. _psMyviewVC = [[PSMyViewController alloc] init];
  136. //#ifdef Live_Version
  137. // _liveVC = [[JXLiveViewController alloc]init];
  138. //#else
  139. // _organizVC = [[OrganizTreeViewController alloc] init];
  140. //#endif
  141. //
  142. [self doSelected:0];
  143. [g_notify addObserver:self selector:@selector(loginSynchronizeFriends:) name:kXmppClickLoginNotifaction object:nil];
  144. [g_notify addObserver:self selector:@selector(appDidEnterForeground) name:kApplicationWillEnterForeground object:nil];
  145. [g_notify addObserver:self selector:@selector(getUserInfo:) name:kXMPPMessageUpadteUserInfoNotification object:nil];
  146. [g_notify addObserver:self selector:@selector(getRoomSet:) name:kXMPPMessageUpadteGroupNotification object:nil];
  147. [g_notify addObserver:self selector:@selector(onXmppLoginChanged:) name:kXmppLoginNotifaction object:nil];
  148. [g_notify addObserver:self selector:@selector(hasLoginOther:) name:kXMPPLoginOtherNotification object:nil];
  149. [g_notify addObserver:self selector:@selector(showDeviceAuth:) name:kDeviceAuthNotification object:nil];
  150. }
  151. return self;
  152. }
  153. - (void)appEnterForegroundNotif:(NSNotification *)noti {
  154. [g_server offlineOperation:(g_server.lastOfflineTime *1000 + g_server.timeDifference)/1000 toView:self];
  155. }
  156. - (void)getUserInfo:(NSNotification *)noti {
  157. JXMessageObject *msg = noti.object;
  158. [g_server getUser:msg.toUserId toView:self];
  159. }
  160. - (void)getRoomSet:(NSNotification *)noti {
  161. JXMessageObject *msg = noti.object;
  162. [g_server getRoom:msg.toUserId toView:self];
  163. }
  164. -(void)dealloc{
  165. // [_psMyviewVC.view release];
  166. // [_msgVc.view release];
  167. [g_notify removeObserver:self name:kXmppLoginNotifaction object:nil];
  168. [g_notify removeObserver:self name:kSystemLoginNotifaction object:nil];
  169. [g_notify removeObserver:self name:kXmppClickLoginNotifaction object:nil];
  170. [g_notify removeObserver:self name:kXMPPLoginOtherNotification object:nil];
  171. [g_notify removeObserver:self name:kApplicationWillEnterForeground object:nil];
  172. [g_notify removeObserver:self name:kXMPPMessageUpadteUserInfoNotification object:nil];
  173. [g_notify removeObserver:self name:kDeviceAuthNotification object:nil];
  174. // [super dealloc];
  175. }
  176. - (void)viewDidLoad
  177. {
  178. [super viewDidLoad];
  179. // Do any additional setup after loading the view.
  180. [self loginSynchronizeFriends:nil];
  181. if (g_server.isManualLogin) {
  182. if (self.isLoadFriendAndGroup) {
  183. NSArray *array = [[JXLabelObject sharedInstance] fetchAllLabelsFromLocal];
  184. if (array.count <= 0) {
  185. // 同步标签
  186. [g_server friendGroupListToView:self];
  187. }
  188. }
  189. }
  190. // 获取服务器时间
  191. [g_server getCurrentTimeToView:self];
  192. // 获取自己的用户信息
  193. [g_server getUser:MY_USER_ID toView:self];
  194. }
  195. - (void)appDidEnterForeground {
  196. // 获取服务器时间
  197. [g_server getCurrentTimeToView:self];
  198. }
  199. - (void)loginSynchronizeFriends:(NSNotification*)notification{
  200. //判断服务器好友数量是否与本地一致
  201. // _friendArray = [g_server.myself fetchAllFriendsOrNotFromLocal];
  202. // NSLog(@"%d -------%ld",[g_server.myself.friendCount intValue] , [_friendArray count]);
  203. // if ([g_server.myself.friendCount intValue] > [_friendArray count] && [g_server.myself.friendCount intValue] >0) {
  204. // [g_App showAlert:Localized(@"JXAlert_SynchFirendOK") delegate:self];
  205. if (self.isLoadFriendAndGroup) {
  206. [g_server listAttention:0 userId:MY_USER_ID toView:self];
  207. }else{
  208. [[JXXMPP sharedInstance] performSelector:@selector(login) withObject:nil afterDelay:2];//2秒后执行xmpp登录
  209. }
  210. [[JXXMPP sharedInstance] performSelector:@selector(login) withObject:nil afterDelay:2];//2秒后执行xmpp登录
  211. // }
  212. }
  213. - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
  214. if (alertView.tag == 10002) {
  215. [g_server performSelector:@selector(showLogin) withObject:nil afterDelay:0.5];
  216. return;
  217. }else if (buttonIndex == 1) {
  218. [g_server listAttention:0 userId:MY_USER_ID toView:self];
  219. }
  220. }
  221. - (void)didReceiveMemoryWarning
  222. {
  223. [super didReceiveMemoryWarning];
  224. // Dispose of any resources that can be recreated.
  225. }
  226. -(void)buildTop{
  227. _tb = [JXTabMenuView alloc];
  228. // NSString * thirdSrt;
  229. // NSString * thirdImgStr;
  230. // NSString * thiidSelectImgSrt;
  231. //#ifdef Live_Version
  232. // thirdSrt = Localized(@"JXLiveVC_Live");
  233. // thirdImgStr = @"live_normal";
  234. // thiidSelectImgSrt = @"live_press";
  235. //#else
  236. // thirdSrt = Localized(@"JX_Colleague");
  237. // thirdImgStr = @"my_organizBook";
  238. // thiidSelectImgSrt = @"my_organizBook_press";
  239. //#endif
  240. NSString *imageSelect1 = _imgUrl1;
  241. if (_imgUrl1.length<1) {
  242. _imgUrl1 = @"find_normal";
  243. imageSelect1 = @"find_press_gray";
  244. }
  245. NSString *imageSelect2 = _imgUrl2;
  246. if (_imgUrl2.length<1) {
  247. _imgUrl2 = @"find_normal";
  248. imageSelect2 = @"find_press_gray";
  249. }
  250. if (self.vcnum == 0) {
  251. _tb.items = [NSArray arrayWithObjects:Localized(@"JXMainViewController_Message"),Localized(@"JX_MailList"),@"发现",Localized(@"JX_My"),nil];
  252. _tb.imagesNormal = [NSArray arrayWithObjects:@"news_normal",@"group_chat_normal",@"find_normal",@"me_normal",nil];
  253. _tb.imagesSelect = [NSArray arrayWithObjects:@"news_press_gray",@"group_chat_press_gray",@"find_press_gray",@"me_press_gray",nil];
  254. }else if(self.vcnum == 1){
  255. _tb.items = [NSArray arrayWithObjects:_linkName1,Localized(@"JXMainViewController_Message"),Localized(@"JX_MailList"),@"发现",Localized(@"JX_My"),nil];
  256. _tb.imagesNormal = [NSArray arrayWithObjects:_imgUrl1,@"news_normal",@"group_chat_normal",@"find_normal",@"me_normal",nil];
  257. _tb.imagesSelect = [NSArray arrayWithObjects:imageSelect1,@"news_press_gray",@"group_chat_press_gray",@"find_press_gray",@"me_press_gray",nil];
  258. }else if (self.vcnum == 2){
  259. _tb.items = [NSArray arrayWithObjects:_linkName1,Localized(@"JXMainViewController_Message"),_linkName2,Localized(@"JX_MailList"),Localized(@"JX_My"),nil];
  260. _tb.imagesNormal = [NSArray arrayWithObjects:_imgUrl1,@"news_normal",_imgUrl2,@"group_chat_normal",@"me_normal",nil];
  261. _tb.imagesSelect = [NSArray arrayWithObjects:imageSelect1,@"news_press_gray",imageSelect2,@"group_chat_press_gray",@"me_press_gray",nil];
  262. }
  263. _tb.delegate = self;
  264. _tb.onDragout = @selector(onDragout:);
  265. [_tb setBackgroundImageName:@"MessageListCellBkg"];
  266. _tb.onClick = @selector(actionSegment:);
  267. _tb = [_tb initWithFrame:CGRectMake(0, 0, JX_SCREEN_WIDTH, JX_SCREEN_BOTTOM)];
  268. [_bottomView addSubview:_tb];
  269. NSMutableArray *remindArray = [[JXBlogRemind sharedInstance] doFetchUnread];
  270. [_tb setBadge:2 title:[NSString stringWithFormat:@"%ld",remindArray.count]];
  271. }
  272. -(void)actionSegment:(UIButton*)sender{
  273. [self doSelected:(int)sender.tag];
  274. }
  275. -(void)doSelected:(int)n{
  276. [_selectVC.view removeFromSuperview];
  277. switch (n){
  278. case 0:
  279. #ifdef IS_SHOW_MENU
  280. _selectVC = _squareVC;
  281. #else
  282. // _selectVC = _weiboVC;
  283. // _selectVC = _webBettingVC;
  284. if (self.vcnum == 0) {
  285. _selectVC = _msgVc;
  286. }else if(self.vcnum == 1){
  287. _selectVC = _webAddPointVC;
  288. }else if(self.vcnum == 2){
  289. _selectVC = _webAddPointVC;
  290. }
  291. #endif
  292. break;
  293. case 1:
  294. if (self.vcnum == 0) {
  295. _selectVC = _friendVC;
  296. }else if(self.vcnum == 1){
  297. _selectVC = _msgVc;
  298. }else if(self.vcnum == 2){
  299. _selectVC = _msgVc;
  300. }
  301. break;
  302. case 2:
  303. if (self.vcnum == 0) {
  304. _selectVC = _weiboVC;
  305. }else if(self.vcnum == 1){
  306. _selectVC = _friendVC;
  307. }else if(self.vcnum == 2){
  308. _selectVC = _webBettingVC;
  309. }
  310. break;
  311. case 3:
  312. if (self.vcnum == 0) {
  313. _selectVC = _psMyviewVC;
  314. }else if(self.vcnum == 1){
  315. _selectVC = _weiboVC;
  316. }else if(self.vcnum == 2){
  317. _selectVC = _friendVC;
  318. }
  319. break;
  320. case 4:
  321. if (self.vcnum == 0) {
  322. _selectVC = _psMyviewVC;
  323. }else if(self.vcnum == 1){
  324. _selectVC = _psMyviewVC;
  325. }else if(self.vcnum == 2){
  326. _selectVC = _psMyviewVC;
  327. }
  328. }
  329. [_tb selectOne:n];
  330. [_mainView addSubview:_selectVC.view];
  331. }
  332. -(void)onXmppLoginChanged:(NSNumber*)isLogin{
  333. if([JXXMPP sharedInstance].isLogined == login_status_yes){
  334. // 获取离线调用接口列表
  335. [g_server offlineOperation:(g_server.lastOfflineTime *1000 + g_server.timeDifference)/1000 toView:self];
  336. [self onAfterLogin];
  337. }
  338. switch (_tb.selected){
  339. case 0:
  340. _btn.hidden = [JXXMPP sharedInstance].isLogined;
  341. break;
  342. case 1:
  343. _btn.hidden = ![JXXMPP sharedInstance].isLogined;
  344. break;
  345. case 2:
  346. _btn.hidden = NO;
  347. break;
  348. case 3:
  349. _btn.hidden = ![JXXMPP sharedInstance].isLogined;
  350. break;
  351. }
  352. }
  353. -(void)onAfterLogin{
  354. // [_msgVc scrollToPageUp];
  355. }
  356. -(void)hasLoginOther:(NSNotification *)notifcation{
  357. [g_App showAlert:Localized(@"JXXMPP_Other") delegate:self tag:10002 onlyConfirm:YES];
  358. }
  359. - (void)showDeviceAuth:(NSNotification *)notification{
  360. JXMessageObject *msg = notification.object;
  361. JXDeviceAuthController *authCon = [[JXDeviceAuthController alloc] initWithMsg:msg];
  362. // [self presentViewController:authCon animated:YES completion:nil];
  363. UIViewController *lastVC = (UIViewController *)g_navigation.subViews.lastObject;
  364. [lastVC presentViewController:authCon animated:YES completion:nil];
  365. }
  366. -(void) didServerResultSucces:(JXConnection*)aDownload dict:(NSDictionary*)dict array:(NSArray*)array1{
  367. //更新本地好友
  368. if ([aDownload.action isEqualToString:act_AttentionList]) {
  369. JXProgressVC * pv = [JXProgressVC alloc];
  370. pv.dbFriends = (long)[_friendArray count];
  371. pv.dataArray = array1;
  372. pv = [pv init];
  373. if (array1.count > 300) {
  374. [g_navigation pushViewController:pv animated:YES];
  375. }
  376. // [self.view addSubview:pv.view];
  377. }
  378. // 同步标签
  379. if ([aDownload.action isEqualToString:act_FriendGroupList]) {
  380. for (NSInteger i = 0; i < array1.count; i ++) {
  381. NSDictionary *dict = array1[i];
  382. JXLabelObject *labelObj = [[JXLabelObject alloc] init];
  383. labelObj.groupId = dict[@"groupId"];
  384. labelObj.groupName = dict[@"groupName"];
  385. labelObj.userId = dict[@"userId"];
  386. NSArray *userIdList = dict[@"userIdList"];
  387. NSString *userIdListStr = [userIdList componentsJoinedByString:@","];
  388. if (userIdListStr.length > 0) {
  389. labelObj.userIdList = [NSString stringWithFormat:@"%@", userIdListStr];
  390. }
  391. [labelObj insert];
  392. }
  393. // 删除服务器上已经删除的
  394. NSArray *arr = [[JXLabelObject sharedInstance] fetchAllLabelsFromLocal];
  395. for (NSInteger i = 0; i < arr.count; i ++) {
  396. JXLabelObject *locLabel = arr[i];
  397. BOOL flag = NO;
  398. for (NSInteger j = 0; j < array1.count; j ++) {
  399. NSDictionary * dict = array1[j];
  400. if ([locLabel.groupId isEqualToString:dict[@"groupId"]]) {
  401. flag = YES;
  402. break;
  403. }
  404. }
  405. if (!flag) {
  406. [locLabel delete];
  407. }
  408. }
  409. }
  410. if ([aDownload.action isEqualToString:act_offlineOperation]) {
  411. for (NSDictionary *dict in array1) {
  412. if ([[dict objectForKey:@"tag"] isEqualToString:@"label"]) {
  413. [g_notify postNotificationName:kOfflineOperationUpdateLabelList object:nil];
  414. }
  415. else if ([[dict objectForKey:@"tag"] isEqualToString:@"friend"]) {
  416. [g_server getUser:[dict objectForKey:@"friendId"] toView:self];
  417. }
  418. else if ([[dict objectForKey:@"tag"] isEqualToString:@"room"]) {
  419. [g_server getRoom:[dict objectForKey:@"friendId"] toView:self];
  420. }
  421. }
  422. }
  423. if ([aDownload.action isEqualToString:act_UserGet]) {
  424. JXUserObject *user = [[JXUserObject alloc] init];
  425. [user getDataFromDict:dict];
  426. if ([user.userId intValue] == [MY_USER_ID intValue]) {
  427. [g_server doSaveUser:dict];
  428. user.bubbleFontId = [dict objectForKey:@"bubbleFontId"];
  429. user.gradeIndex = [dict objectForKey:@"gradeIndex"];
  430. // 保存自己
  431. [user insert];
  432. [user update];
  433. }else {
  434. JXUserObject *user1 = [[JXUserObject sharedInstance] getUserById:user.userId];
  435. user.content = user1.content;
  436. user.timeSend = user1.timeSend;
  437. [user update];
  438. }
  439. [g_notify postNotificationName:kOfflineOperationUpdateUserSet object:user];
  440. }
  441. if ([aDownload.action isEqualToString:act_roomGet]) {
  442. JXUserObject *user = [[JXUserObject alloc] init];
  443. [user getDataFromDict:dict];
  444. user.userId = [dict objectForKey:@"jid"];
  445. user.roomId = [dict objectForKey:@"id"];
  446. user.userNickname = [dict objectForKey:@"name"];
  447. if(![g_xmpp.roomPool getRoom:user.userId] || ![user haveTheUser]){
  448. user.userDescription = [dict objectForKey:@"desc"];
  449. user.showRead = [dict objectForKey:@"showRead"];
  450. user.showMember = [dict objectForKey:@"showMember"];
  451. user.allowSendCard = [dict objectForKey:@"allowSendCard"];
  452. user.chatRecordTimeOut = [dict objectForKey:@"chatRecordTimeOut"];
  453. user.talkTime = [dict objectForKey:@"talkTime"];
  454. user.allowInviteFriend = [dict objectForKey:@"allowInviteFriend"];
  455. user.allowUploadFile = [dict objectForKey:@"allowUploadFile"];
  456. user.allowConference = [dict objectForKey:@"allowConference"];
  457. user.allowSpeakCourse = [dict objectForKey:@"allowSpeakCourse"];
  458. user.offlineNoPushMsg = [(NSDictionary *)[dict objectForKey:@"member"] objectForKey:@"offlineNoPushMsg"];
  459. user.isNeedVerify = [dict objectForKey:@"isNeedVerify"];
  460. user.createUserId = [dict objectForKey:@"userId"];
  461. user.content = @" ";
  462. user.topTime = nil;
  463. [user insertRoom];
  464. [g_xmpp.roomPool joinRoom:user.userId title:user.userNickname lastDate:nil isNew:NO];
  465. }else {
  466. NSDictionary * groupDict = [user toDictionary];
  467. roomData * roomdata = [[roomData alloc] init];
  468. [roomdata getDataFromDict:groupDict];
  469. [roomdata getDataFromDict:dict];
  470. JXUserObject *user1 = [[JXUserObject sharedInstance] getUserById:roomdata.roomJid];
  471. user.content = user1.content;
  472. user.status = user1.status;
  473. user.offlineNoPushMsg = [NSNumber numberWithBool:roomdata.offlineNoPushMsg];
  474. user.msgsNew = user1.msgsNew;
  475. [user update];
  476. }
  477. [g_notify postNotificationName:kOfflineOperationUpdateUserSet object:user];
  478. }
  479. }
  480. -(int) didServerResultFailed:(JXConnection*)aDownload dict:(NSDictionary*)dict{
  481. return hide_error;
  482. }
  483. -(int) didServerConnectError:(JXConnection*)aDownload error:(NSError *)error{//error为空时,代表超时
  484. return hide_error;
  485. }
  486. @end