Changeset 6279 for trunk/qt4-gui/src/core/usermenu.cpp
- Timestamp:
- 06/13/08 03:40:47 (6 months ago)
- Files:
-
- 1 modified
-
trunk/qt4-gui/src/core/usermenu.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/qt4-gui/src/core/usermenu.cpp
r6097 r6279 537 537 { 538 538 unsigned int gid = action->data().toUInt(); 539 540 ICQUser* u = gUserManager.FetchUser(myId.toLatin1(), myPpid, LOCK_W); 541 542 if (u == NULL) 543 return; 544 545 // Don't let the user to be deleted from local group 546 // if he is a member of the same server group 547 if (!action->isChecked() && // delete 548 u->GetSID() && // server-side 549 gUserManager.GetGroupFromID(u->GetGSID()) == gid) // same group 550 { 551 gUserManager.DropUser(u); 552 return; 553 } 554 555 u->SetInGroup(GROUPS_USER, gid, action->isChecked()); 556 557 gUserManager.DropUser(u); 539 gUserManager.SetUserInGroup(myId.toLatin1(), myPpid, GROUPS_USER, gid, 540 action->isChecked(), false); 558 541 559 542 // The daemon does not send an update when group membership changes … … 566 549 unsigned int gid = action->data().toUInt(); 567 550 568 ICQUser* u = NULL; 569 if (gid == GROUP_NEW_USERS || gid == GROUP_ONLINE_NOTIFY || gid == GROUP_IGNORE_LIST) 570 { 571 u = gUserManager.FetchUser(myId.toLatin1(), myPpid, LOCK_W); 551 if (gid == GROUP_IGNORE_LIST && !action->isChecked()) 552 { 553 ICQUser* u = gUserManager.FetchUser(myId.toLatin1(), myPpid, LOCK_R); 572 554 if (u == NULL) 573 555 return; 574 } 575 576 switch (gid) 577 { 578 case GROUP_NEW_USERS: 579 u->SetNewUser(action->isChecked()); 580 break; 581 582 case GROUP_ONLINE_NOTIFY: 583 u->SetOnlineNotify(action->isChecked()); 584 break; 585 586 case GROUP_VISIBLE_LIST: 587 gLicqDaemon->ProtoToggleVisibleList(myId.toLatin1(), myPpid); 588 break; 589 590 case GROUP_INVISIBLE_LIST: 591 gLicqDaemon->ProtoToggleInvisibleList(myId.toLatin1(), myPpid); 592 break; 593 594 case GROUP_IGNORE_LIST: 595 if (!action->isChecked() || 596 QueryYesNo(this, tr("Do you really want to add\n%1 (%2)\nto your ignore list?") 597 .arg(QString::fromUtf8(u->GetAlias())).arg(myId))) 598 { 599 u->SetIgnoreList(action->isChecked()); 600 gUserManager.DropUser(u); 601 u = NULL; 602 gLicqDaemon->icqToggleIgnoreList(myId.toLatin1(), myPpid); // network only 603 } 604 break; 605 } 606 607 if (u != NULL) 556 557 QString alias = QString::fromUtf8(u->GetAlias()); 608 558 gUserManager.DropUser(u); 559 560 if(!QueryYesNo(this, tr("Do you really want to add\n%1 (%2)\nto your ignore list?") 561 .arg(alias).arg(myId))) 562 return; 563 } 564 565 gUserManager.SetUserInGroup(myId.toLatin1(), myPpid, GROUPS_SYSTEM, gid, 566 action->isChecked(), true); 609 567 610 568 // The daemon does not send an update when group membership changes … … 615 573 void UserMenu::setServerGroup(QAction* action) 616 574 { 617 gUserManager.AddUserToGroup(myId.toLatin1(), myPpid, action->data().toUInt()); 575 unsigned int gid = action->data().toUInt(); 576 gUserManager.SetUserInGroup(myId.toLatin1(), myPpid, GROUPS_USER, gid, true, true); 618 577 619 578 // The daemon does not send an update when group membership changes
