Show
Ignore:
Timestamp:
07/24/08 04:08:58 (4 months ago)
Author:
flynd
Message:

Use a const pointer for user objects that are only fetched for read access. Fixed some places where we changed the user even though we just had a read lock.

Location:
trunk/qt4-gui/src/dialogs
Files:
15 modified

Legend:

Unmodified
Added
Removed
  • trunk/qt4-gui/src/dialogs/adduserdlg.cpp

    r6315 r6463  
    9999  if (!id.isEmpty()) 
    100100  { 
    101     ICQUser* u = gUserManager.FetchUser(id, ppid, LOCK_R); 
     101    const ICQUser* u = gUserManager.FetchUser(id, ppid, LOCK_R); 
    102102 
    103103    if (u == NULL) 
     
    105105    else 
    106106    { 
    107       if (u->NotInList()) 
     107      bool notInList = u->NotInList(); 
     108      gUserManager.DropUser(u); 
     109 
     110      if (notInList) 
    108111      { 
    109         u->Unlock(); 
    110112        gUserManager.SetUserInGroup(id, ppid, GROUPS_USER, group, true, true); 
    111         u->Lock(LOCK_W); 
    112         u->SetPermanent(); 
     113        ICQUser* user = gUserManager.FetchUser(id, ppid, LOCK_W); 
     114        user->SetPermanent(); 
     115        gUserManager.DropUser(user); 
    113116        added = true; 
    114117      } 
    115       gUserManager.DropUser(u); 
    116118    } 
    117119  } 
  • trunk/qt4-gui/src/dialogs/authuserdlg.cpp

    r6352 r6463  
    7070    toplay->addWidget(lblUin); 
    7171    QString userName = myId; 
    72     ICQUser* u = gUserManager.FetchUser(myId.toLatin1(), myPpid, LOCK_R); 
     72    const ICQUser* u = gUserManager.FetchUser(myId.toLatin1(), myPpid, LOCK_R); 
    7373    if (u != NULL) 
    7474    { 
  • trunk/qt4-gui/src/dialogs/customautorespdlg.cpp

    r6124 r6463  
    7373  lay->addWidget(buttons); 
    7474 
    75   ICQUser* u = gUserManager.FetchUser(myId.toLatin1(), myPpid, LOCK_R); 
     75  const ICQUser* u = gUserManager.FetchUser(myId.toLatin1(), myPpid, LOCK_R); 
    7676 
    7777  if (u == NULL) 
  • trunk/qt4-gui/src/dialogs/forwarddlg.cpp

    r6352 r6463  
    164164  m_nPPID = nPPID; 
    165165 
    166   ICQUser* u = gUserManager.FetchUser(myId.toLatin1(), m_nPPID, LOCK_R); 
     166  const ICQUser* u = gUserManager.FetchUser(myId.toLatin1(), m_nPPID, LOCK_R); 
    167167  if (u == NULL) 
    168168    return; 
  • trunk/qt4-gui/src/dialogs/gpgkeymanager.cpp

    r6352 r6463  
    193193  if (!found) 
    194194  { 
    195     ICQUser* u = gUserManager.FetchUser(id.toLatin1(), ppid, LOCK_R); 
     195    const ICQUser* u = gUserManager.FetchUser(id.toLatin1(), ppid, LOCK_R); 
    196196    if (u == NULL) 
    197197      return; 
     
    266266 
    267267// KEYLISTITEM 
    268 KeyListItem::KeyListItem(QTreeWidget* parent, ICQUser* u) 
     268KeyListItem::KeyListItem(QTreeWidget* parent, const ICQUser* u) 
    269269  : QTreeWidgetItem(parent), 
    270270    szId(u->IdString()), 
     
    275275} 
    276276 
    277 void KeyListItem::updateText(ICQUser* u) 
     277void KeyListItem::updateText(const ICQUser* u) 
    278278{ 
    279279  setText(0, QString::fromUtf8(u->GetAlias())); 
     
    293293void KeyListItem::slot_done() 
    294294{ 
    295   ICQUser* u = gUserManager.FetchUser(szId.toLatin1(), nPPID, LOCK_R); 
     295  const ICQUser* u = gUserManager.FetchUser(szId.toLatin1(), nPPID, LOCK_R); 
    296296  keySelect = NULL; 
    297297 
  • trunk/qt4-gui/src/dialogs/gpgkeymanager.h

    r6219 r6463  
    7171 
    7272public: 
    73   KeyListItem(QTreeWidget* parent, ICQUser* u); 
     73  KeyListItem(QTreeWidget* parent, const ICQUser* u); 
    7474 
    7575  void edit(); 
     
    8383  unsigned long nPPID; 
    8484  GPGKeySelect* keySelect; 
    85   void updateText(ICQUser* u); 
     85  void updateText(const ICQUser* u); 
    8686 
    8787private slots: 
  • trunk/qt4-gui/src/dialogs/gpgkeyselect.cpp

    r5837 r6463  
    5656  Support::setWidgetProps(this, "GPGKeySelectDialog"); 
    5757 
    58   ICQUser* u = gUserManager.FetchUser(szId.toLatin1(), nPPID, LOCK_R); 
     58  const ICQUser* u = gUserManager.FetchUser(szId.toLatin1(), nPPID, LOCK_R); 
    5959  if (u == NULL) 
    6060    return; 
     
    224224} 
    225225 
    226 void KeyView::testViewItem(QTreeWidgetItem* item, ICQUser* u) 
     226void KeyView::testViewItem(QTreeWidgetItem* item, const ICQUser* u) 
    227227{ 
    228228  int val = 0; 
     
    253253  gpgme_new(&mCtx); 
    254254 
    255   ICQUser* u = gUserManager.FetchUser(szId.toLatin1(), nPPID, LOCK_R); 
     255  const ICQUser* u = gUserManager.FetchUser(szId.toLatin1(), nPPID, LOCK_R); 
    256256  maxItemVal = -1; 
    257257  maxItem = NULL; 
  • trunk/qt4-gui/src/dialogs/gpgkeyselect.h

    r5837 r6463  
    4242  QString szId; 
    4343  unsigned long nPPID; 
    44   void testViewItem(QTreeWidgetItem* item, ICQUser* u); 
     44  void testViewItem(QTreeWidgetItem* item, const ICQUser* u); 
    4545  int maxItemVal; 
    4646  QTreeWidgetItem* maxItem; 
  • trunk/qt4-gui/src/dialogs/historydlg.cpp

    r6448 r6463  
    161161  show(); 
    162162 
    163   ICQUser* u = gUserManager.FetchUser(myId.toLatin1(), myPpid, LOCK_R); 
     163  const ICQUser* u = gUserManager.FetchUser(myId.toLatin1(), myPpid, LOCK_R); 
    164164 
    165165  QString name = tr("INVALID USER"); 
     
    277277  if (signal->SubSignal() == USER_EVENTS) 
    278278  { 
    279     ICQUser* u = gUserManager.FetchUser(myId.toLatin1(), myPpid, LOCK_R); 
     279    const ICQUser* u = gUserManager.FetchUser(myId.toLatin1(), myPpid, LOCK_R); 
    280280    if (u == NULL) 
    281281      return; 
  • trunk/qt4-gui/src/dialogs/keyrequestdlg.cpp

    r6294 r6463  
    4949  setAttribute(Qt::WA_DeleteOnClose, true); 
    5050 
    51   ICQUser* u = gUserManager.FetchUser(myId.toLatin1(), myPpid, LOCK_R); 
     51  const ICQUser* u = gUserManager.FetchUser(myId.toLatin1(), myPpid, LOCK_R); 
    5252  setWindowTitle(tr("Licq - Secure Channel with %1") 
    5353      .arg(QString::fromUtf8(u->GetAlias()))); 
  • trunk/qt4-gui/src/dialogs/mmsenddlg.cpp

    r6430 r6463  
    168168    case ICQ_CMDxSUB_MSG: 
    169169    { 
    170       ICQUser* u = gUserManager.FetchUser(myId.toLatin1(), m_nPPID, LOCK_R); 
     170      const ICQUser* u = gUserManager.FetchUser(myId.toLatin1(), m_nPPID, LOCK_R); 
    171171      if (u == NULL) return; 
    172172      QTextCodec* codec = UserCodec::codecForICQUser(u); 
     
    239239    case ICQ_CMDxSUB_URL: 
    240240    { 
    241       ICQUser* u = gUserManager.FetchUser(myId.toLatin1(), m_nPPID, LOCK_R); 
     241      const ICQUser* u = gUserManager.FetchUser(myId.toLatin1(), m_nPPID, LOCK_R); 
    242242      if (u == NULL) return; 
    243243      grpSending->setTitle(tr("Sending mass URL to %1...").arg(QString::fromUtf8(u->GetAlias()))); 
     
    252252    case ICQ_CMDxSUB_CONTACTxLIST: 
    253253    { 
    254       ICQUser* u = gUserManager.FetchUser(myId.toLatin1(), m_nPPID, LOCK_R); 
     254      const ICQUser* u = gUserManager.FetchUser(myId.toLatin1(), m_nPPID, LOCK_R); 
    255255      if (u == NULL) return; 
    256256      grpSending->setTitle(tr("Sending mass list to %1...").arg(QString::fromUtf8(u->GetAlias()))); 
  • trunk/qt4-gui/src/dialogs/refusedlg.cpp

    r6133 r6463  
    4545  QVBoxLayout* lay = new QVBoxLayout(this); 
    4646 
    47   ICQUser* u = gUserManager.FetchUser(id.toLatin1(), ppid, LOCK_R); 
     47  const ICQUser* u = gUserManager.FetchUser(id.toLatin1(), ppid, LOCK_R); 
    4848  QLabel* lbl = new QLabel(tr("Refusal message for %1 with ").arg(t) + QString::fromUtf8(u->GetAlias()) + ":"); 
    4949  lay->addWidget(lbl); 
  • trunk/qt4-gui/src/dialogs/showawaymsgdlg.cpp

    r6352 r6463  
    8181  lay->addWidget(buttons); 
    8282 
    83   ICQUser* u = gUserManager.FetchUser(myId.toLatin1(), myPpid, LOCK_R); 
     83  const ICQUser* u = gUserManager.FetchUser(myId.toLatin1(), myPpid, LOCK_R); 
    8484  QTextCodec* codec = UserCodec::codecForICQUser(u); 
    8585  chkShowAgain->setChecked(u->ShowAwayMsg()); 
     
    165165       e->SNAC() == MAKESNAC(ICQ_SNACxFAM_LOCATION, ICQ_SNACxLOC_INFOxREQ))) 
    166166  { 
    167     ICQUser* u = gUserManager.FetchUser(myId.toLatin1(), myPpid, LOCK_R); 
     167    const ICQUser* u = gUserManager.FetchUser(myId.toLatin1(), myPpid, LOCK_R); 
    168168    QTextCodec* codec = UserCodec::codecForICQUser(u); 
    169169    const char* szAutoResp = 
  • trunk/qt4-gui/src/dialogs/userinfodlg.cpp

    r6374 r6463  
    179179  lay->addLayout(l); 
    180180 
    181   ICQUser* u = gUserManager.FetchUser(myId.toLatin1(), m_nPPID, LOCK_R); 
     181  const ICQUser* u = gUserManager.FetchUser(myId.toLatin1(), m_nPPID, LOCK_R); 
    182182  if (u == NULL) 
    183183  { 
     
    348348} 
    349349 
    350 void UserInfoDlg::SetGeneralInfo(ICQUser* u) 
     350void UserInfoDlg::SetGeneralInfo(const ICQUser* u) 
    351351{ 
    352352  tabList[GeneralInfo].loaded = true; 
     
    587587} 
    588588 
    589 void UserInfoDlg::SetMoreInfo(ICQUser* u) 
     589void UserInfoDlg::SetMoreInfo(const ICQUser* u) 
    590590{ 
    591591  tabList[MoreInfo].loaded = true; 
     
    848848} 
    849849 
    850 void UserInfoDlg::SetMore2Info(ICQUser* u) 
    851 { 
    852   ICQUserCategory* cat; 
     850void UserInfoDlg::SetMore2Info(const ICQUser* u) 
     851{ 
     852  const ICQUserCategory* cat; 
    853853  bool drop = false; 
    854854  int i; 
     
    896896} 
    897897 
    898 void UserInfoDlg::UpdateMore2Info(QTextCodec* codec, ICQUserCategory* cat) 
     898void UserInfoDlg::UpdateMore2Info(QTextCodec* codec, const ICQUserCategory* cat) 
    899899{ 
    900900  QTreeWidgetItem* lvi = NULL; 
     
    10731073} 
    10741074 
    1075 void UserInfoDlg::SetWorkInfo(ICQUser* u) 
     1075void UserInfoDlg::SetWorkInfo(const ICQUser* u) 
    10761076{ 
    10771077  tabList[WorkInfo].loaded = true; 
     
    11831183} 
    11841184 
    1185 void UserInfoDlg::SetAbout(ICQUser* u) 
     1185void UserInfoDlg::SetAbout(const ICQUser* u) 
    11861186{ 
    11871187  tabList[AboutInfo].loaded = true; 
     
    12641264} 
    12651265 
    1266 void UserInfoDlg::SetPhoneBook(ICQUser* u) 
     1266void UserInfoDlg::SetPhoneBook(const ICQUser* u) 
    12671267{ 
    12681268  tabList[PhoneInfo].loaded = true; 
     
    14441444} 
    14451445 
    1446 void UserInfoDlg::SetPicture(ICQUser* u) 
     1446void UserInfoDlg::SetPicture(const ICQUser* u) 
    14471447{ 
    14481448  if (!m_bOwner || !tabList[PictureInfo].loaded) 
     
    15561556} 
    15571557 
    1558 void UserInfoDlg::SetLastCountersInfo(ICQUser* u) 
     1558void UserInfoDlg::SetLastCountersInfo(const ICQUser* u) 
    15591559{ 
    15601560  tabList[LastCountersInfo].loaded = true; 
     
    16121612} 
    16131613 
    1614 void UserInfoDlg::SetKABCInfo(ICQUser* u) 
     1614void UserInfoDlg::SetKABCInfo(const ICQUser* u) 
    16151615{ 
    16161616#ifdef USE_KABC 
     
    17211721  } 
    17221722 
    1723   ICQUser* u = gUserManager.FetchUser(myId.toLatin1(), m_nPPID, LOCK_R); 
     1723  const ICQUser* u = gUserManager.FetchUser(myId.toLatin1(), m_nPPID, LOCK_R); 
    17241724  if (u == NULL) 
    17251725    return; 
     
    17321732void UserInfoDlg::PhoneBookUpdated(struct PhoneBookEntry pbe, int entryNum) 
    17331733{ 
    1734   ICQUser* u = gUserManager.FetchUser(myId.toLatin1(), m_nPPID, LOCK_R); 
     1734  const ICQUser* u = gUserManager.FetchUser(myId.toLatin1(), m_nPPID, LOCK_R); 
    17351735  if (u == NULL) 
    17361736    return; 
     
    17761776  m_PhoneBook->SetActive(index - 1); 
    17771777 
    1778   ICQUser* u = gUserManager.FetchUser(myId.toLatin1(), m_nPPID, LOCK_R); 
     1778  const ICQUser* u = gUserManager.FetchUser(myId.toLatin1(), m_nPPID, LOCK_R); 
    17791779  if (u == NULL) 
    17801780    return; 
     
    19711971      // save current status of "chkKeepAliasOnUpdate" 
    19721972      // and the alias 
    1973       ICQUser* u = gUserManager.FetchUser(myId.toLatin1(), m_nPPID, LOCK_R); 
     1973      ICQUser* u = gUserManager.FetchUser(myId.toLatin1(), m_nPPID, LOCK_W); 
    19741974      if (u == NULL) return; 
    19751975      u->SetEnableSave(false); 
     
    19971997    case PhoneInfo: 
    19981998    { 
    1999       ICQUser* u = gUserManager.FetchUser(myId.toLatin1(), m_nPPID, LOCK_R); 
     1999      const ICQUser* u = gUserManager.FetchUser(myId.toLatin1(), m_nPPID, LOCK_R); 
    20002000      if (u == NULL) return; 
    20012001      bool bSendServer = (u->SocketDesc(ICQ_CHNxINFO) < 0); 
     
    22252225  if (m_nPPID != sig->PPID() || myId != sig->Id()) return; 
    22262226 
    2227   ICQUser* u = gUserManager.FetchUser(myId.toLatin1(), m_nPPID, LOCK_R); 
     2227  const ICQUser* u = gUserManager.FetchUser(myId.toLatin1(), m_nPPID, LOCK_R); 
    22282228  if (u == NULL) return; 
    22292229 
  • trunk/qt4-gui/src/dialogs/userinfodlg.h

    r6093 r6463  
    192192  QString m_kabcID; 
    193193 
    194   void SetGeneralInfo(ICQUser*); 
    195   void SetMoreInfo(ICQUser*); 
    196   void SetMore2Info(ICQUser*); 
    197   void UpdateMore2Info(QTextCodec*, ICQUserCategory*); 
    198   void SetWorkInfo(ICQUser*); 
    199   void SetAbout(ICQUser*); 
    200   void SetPhoneBook(ICQUser*); 
    201   void UpdatePhoneBook(QTextCodec*); 
    202   void SetPicture(ICQUser*); 
    203   void SetLastCountersInfo(ICQUser*); 
    204   void SetKABCInfo(ICQUser*); 
     194  void SetGeneralInfo(const ICQUser* u); 
     195  void SetMoreInfo(const ICQUser* u); 
     196  void SetMore2Info(const ICQUser* u); 
     197  void UpdateMore2Info(QTextCodec* codec, const ICQUserCategory* cat); 
     198  void SetWorkInfo(const ICQUser* u); 
     199  void SetAbout(const ICQUser* u); 
     200  void SetPhoneBook(const ICQUser* u); 
     201  void UpdatePhoneBook(QTextCodec* u); 
     202  void SetPicture(const ICQUser* u); 
     203  void SetLastCountersInfo(const ICQUser* u); 
     204  void SetKABCInfo(const ICQUser* u); 
    205205  void UpdateKABCInfo(); 
    206206  void SaveGeneralInfo();