Changeset 6381

Show
Ignore:
Timestamp:
07/01/08 17:03:38 (3 months ago)
Author:
flynd
Message:

Use the new DropOwner? function to properly specify which owner to unlock.

Location:
trunk/qt-gui/src
Files:
14 modified

Legend:

Unmodified
Added
Removed
  • trunk/qt-gui/src/awaymsgdlg.cpp

    r6367 r6381  
    152152  mnuSelect->insertItem(tr("&Edit Items"), 999); 
    153153 
    154   ICQOwner *o = gUserManager.FetchOwner(LOCK_R); 
     154  ICQOwner* o = gUserManager.FetchOwner(LICQ_PPID, LOCK_R); 
    155155  if (o == 0) return; 
    156156  setCaption(QString(tr("Set %1 Response for %2")) 
     
    165165                           "(%m messages pending from you).") 
    166166                        .arg(Strings::getStatus(m_nStatus, false))); 
    167   gUserManager.DropOwner(); 
     167  gUserManager.DropOwner(o); 
    168168 
    169169  mleAwayMsg->setFocus(); 
     
    203203    s.truncate(s.length()-1); 
    204204 
    205   ICQOwner *o = gUserManager.FetchOwner(LOCK_W); 
     205  ICQOwner* o = gUserManager.FetchOwner(LICQ_PPID, LOCK_W); 
    206206  if (o == 0) 
    207207  { 
     
    211211  QTextCodec *codec = UserCodec::defaultEncoding(); 
    212212  o->SetAutoResponse(codec->fromUnicode(s)); 
    213   gUserManager.DropOwner(); 
     213  gUserManager.DropOwner(o); 
    214214  close(); 
    215215} 
  • trunk/qt-gui/src/catdlg.cpp

    r4800 r6381  
    113113void EditCategoryDlg::ok() 
    114114{ 
    115   ICQOwner* o = gUserManager.FetchOwner(LOCK_R); 
     115  ICQOwner* o = gUserManager.FetchOwner(LICQ_PPID, LOCK_R); 
    116116  if (o == NULL) 
    117117  { 
     
    120120  } 
    121121  QTextCodec *codec = UserCodec::codecForICQUser(o); 
    122   gUserManager.DropOwner(); 
     122  gUserManager.DropOwner(o); 
    123123 
    124124  ICQUserCategory *cat = new ICQUserCategory(m_uc); 
  • trunk/qt-gui/src/ewidgets.cpp

    r6367 r6381  
    10921092      QTextCodec *ownerCodec = UserCodec::codecForICQUser(o); 
    10931093      contactName = ownerCodec->toUnicode(o->GetAlias()); 
    1094       gUserManager.DropOwner(m_nPPID); 
     1094      gUserManager.DropOwner(o); 
    10951095    } 
    10961096  } 
  • trunk/qt-gui/src/licqkimiface.cpp

    r6305 r6381  
    9696QStringList LicqKIMIface::reachableContacts() 
    9797{ 
    98     ICQOwner* owner = gUserManager.FetchOwner(LOCK_R); 
     98    ICQOwner* owner = gUserManager.FetchOwner(LICQ_PPID, LOCK_R); 
    9999    bool offline = owner->StatusOffline(); 
    100     gUserManager.DropOwner(); 
     100    gUserManager.DropOwner(owner); 
    101101 
    102102    if (offline) 
  • trunk/qt-gui/src/mainwin.cpp

    r6368 r6381  
    620620  m_nRealHeight = hVal; 
    621621 
    622   ICQOwner *o = gUserManager.FetchOwner(LOCK_R); 
     622  ICQOwner* o = gUserManager.FetchOwner(LICQ_PPID, LOCK_R); 
    623623  if (o != NULL) 
    624624  { 
    625625    m_szCaption = tr("Licq (%1)").arg(QString::fromUtf8(o->GetAlias())); 
    626     gUserManager.DropOwner(); 
     626    gUserManager.DropOwner(o); 
    627627  } 
    628628  else 
     
    791791   { 
    792792     // Do we need to get a password 
    793      o = gUserManager.FetchOwner(LOCK_R); 
     793     o = gUserManager.FetchOwner(LICQ_PPID, LOCK_R); 
    794794     if (o != NULL) 
    795795     { 
    796796      if(o->Password()[0] == '\0') 
    797797      { 
    798         gUserManager.DropOwner(); 
     798        gUserManager.DropOwner(o); 
    799799        (void) new UserSelectDlg(licqDaemon); 
    800800      } 
    801801      else 
    802         gUserManager.DropOwner(); 
     802        gUserManager.DropOwner(o); 
    803803     } 
    804804   } 
     
    808808   { 
    809809    mnuPFM->setItemChecked(o->PhoneFollowMeStatus(), true); 
    810     gUserManager.DropOwner(); 
     810    gUserManager.DropOwner(o); 
    811811   } 
    812812 
     
    14051405          } 
    14061406          else 
    1407           {   
     1407          { 
    14081408            s = o->Status(); 
    1409             gUserManager.DropOwner(nPPID); 
     1409            gUserManager.DropOwner(o); 
    14101410          } 
    14111411          if (s == ICQ_STATUS_ONLINE || s == ICQ_STATUS_FREEFORCHAT) 
     
    14641464        { 
    14651465          m_szCaption = tr("Licq (%1)").arg(QString::fromUtf8(o->GetAlias())); 
    1466           gUserManager.DropOwner(nPPID); 
     1466          gUserManager.DropOwner(o); 
    14671467        } 
    14681468        else 
     
    20932093    else 
    20942094    { 
    2095       gUserManager.DropOwner(nPPID); 
    2096        
     2095      gUserManager.DropOwner(o); 
     2096 
    20972097      // Show multiple icons for each protocol 
    20982098      lblStatus->clearPrependPixmap(); 
    20992099      lblStatus->setText(""); 
    21002100      lblStatus->clearPixmaps(); 
    2101        
     2101 
    21022102      vector<unsigned long>::iterator it; 
    21032103      for (it = m_lnProtMenu.begin(); it != m_lnProtMenu.end(); it++) 
     
    21082108          lblStatus->addPixmap(CMainWindow::iconForStatus(o->StatusFull(), 
    21092109            o->IdString(), *it)); 
    2110           gUserManager.DropOwner(*it); 
     2110          gUserManager.DropOwner(o); 
    21112111        } 
    21122112      } 
     
    21332133      setIcon(CMainWindow::iconForStatus(o->StatusFull())); 
    21342134#endif   // USE_KDE 
    2135    
    2136       gUserManager.DropOwner(nPPID); 
     2135 
     2136      gUserManager.DropOwner(o); 
    21372137    } 
    21382138   } 
     
    21512151         lblStatus->addPixmap(CMainWindow::iconForStatus(o->StatusFull(), 
    21522152           o->IdString(), *it)); 
    2153          gUserManager.DropOwner(*it); 
     2153         gUserManager.DropOwner(o); 
    21542154       } 
    21552155     } 
    2156       
     2156 
    21572157     lblStatus->update(); 
    21582158   } 
     
    21682168{ 
    21692169  //TODO iterate all owners that support fetching away message 
    2170   ICQOwner* o = gUserManager.FetchOwner(LOCK_R); 
     2170  ICQOwner* o = gUserManager.FetchOwner(LICQ_PPID, LOCK_R); 
    21712171  if (o == NULL) 
    21722172    return; 
    21732173 
    21742174  unsigned short status = o->Status(); 
    2175   gUserManager.DropOwner(); 
     2175  gUserManager.DropOwner(o); 
    21762176  showAwayMsgDlg(status); 
    21772177} 
     
    22962296    ICQOwner *o = gUserManager.FetchOwner(nPPID, LOCK_R); 
    22972297    if (o == NULL) continue; 
    2298                
     2298 
    22992299    if (id == ICQ_STATUS_OFFLINE) 
    23002300    { 
    2301       gUserManager.DropOwner(nPPID); 
     2301      gUserManager.DropOwner(o); 
    23022302      licqDaemon->ProtoLogoff(nPPID); 
    23032303      continue; 
     
    23132313      if (o->StatusOffline()) 
    23142314      { 
    2315         gUserManager.DropOwner(nPPID); 
     2315        gUserManager.DropOwner(o); 
    23162316        continue; 
    23172317      } 
     
    23422342    // call the right function 
    23432343    bool b = o->StatusOffline(); 
    2344     gUserManager.DropOwner(nPPID); 
     2344    gUserManager.DropOwner(o); 
    23452345    if (b) 
    23462346      licqDaemon->ProtoLogon(nPPID, newStatus); 
     
    24492449      szId = strdup(o->IdString()); 
    24502450      unsigned short nNumMsg = o->NewMessages(); 
    2451       gUserManager.DropOwner((*_ppit)->PPID()); 
    2452        
     2451      gUserManager.DropOwner(o); 
     2452 
    24532453      if (nNumMsg > 0) 
    24542454        callFunction(index, szId, (*_ppit)->PPID()); 
     
    24692469        if (o == 0) continue; 
    24702470        szId = strdup(o->IdString()); 
    2471         gUserManager.DropOwner((*_ppit)->PPID()); 
     2471        gUserManager.DropOwner(o); 
    24722472        callInfoTab(index, szId, (*_ppit)->PPID()); 
    24732473        free(szId); 
     
    30023002      if (o == 0) continue; // just in case 
    30033003      unsigned short nNumMsg = o->NewMessages(); 
    3004       gUserManager.DropOwner((*_ppit)->PPID()); 
     3004      gUserManager.DropOwner(o); 
    30053005      if (nNumMsg > 0) 
    30063006      { 
     
    35863586void CMainWindow::aboutBox() 
    35873587{ 
    3588   ICQOwner *o = gUserManager.FetchOwner(LOCK_R); 
    3589    
     3588  ICQOwner* o = gUserManager.FetchOwner(LICQ_PPID, LOCK_R); 
     3589 
    35903590  // We might have no owner 
    35913591  QString m_Alias = (o == 0) ? QString(tr("(Error! No owner set)")) : QString::fromUtf8(o->GetAlias()); 
    35923592  QString id = (o == 0) ? "" : o->IdString(); 
    3593    
     3593 
    35943594  QString about(tr("Licq version %1%8.\n" 
    35953595                   "Qt GUI plugin version %2.\n" 
     
    36113611#endif 
    36123612                   .arg(__DATE__).arg(CICQDaemon::CryptoEnabled() ? "/SSL" : "")); 
    3613   gUserManager.DropOwner(); 
     3613  gUserManager.DropOwner(o); 
    36143614  InformUser(this, about); 
    36153615} 
     
    47974797 
    47984798  // Do system messages first 
    4799   ICQOwner *o = gUserManager.FetchOwner(LOCK_R); 
     4799  ICQOwner* o = gUserManager.FetchOwner(LICQ_PPID, LOCK_R); 
    48004800  unsigned short nNumMsg = 0; 
    48014801  if (o) 
    48024802  { 
    48034803    nNumMsg = o->NewMessages(); 
    4804     gUserManager.DropOwner(); 
    4805   } 
    4806    
     4804    gUserManager.DropOwner(o); 
     4805  } 
     4806 
    48074807  if (nNumMsg > 0) 
    48084808  { 
  • trunk/qt-gui/src/optionsdlg.cpp

    r6367 r6381  
    458458   oem->Unlock(); 
    459459   //TODO make general for all plugins 
    460    ICQOwner *o = gUserManager.FetchOwner(LOCK_R); 
     460   ICQOwner* o = gUserManager.FetchOwner(LICQ_PPID, LOCK_R); 
    461461   if (o) 
    462462   { 
     
    465465     chkOEOccupied->setChecked(o->AcceptInOccupied()); 
    466466     chkOEDND->setChecked(o->AcceptInDND()); 
    467      gUserManager.DropOwner(); 
     467     gUserManager.DropOwner(o); 
    468468   } 
    469469   chkAlwaysOnlineNotify->setChecked(mainwin->licqDaemon->AlwaysOnlineNotify()); 
     
    722722  oem->SetParameters(txtSndPlayer.latin1(), oemparams); 
    723723  //TODO Make general for all plugins 
    724   ICQOwner *o = gUserManager.FetchOwner(LOCK_W); 
     724  ICQOwner* o = gUserManager.FetchOwner(LICQ_PPID, LOCK_W); 
    725725  if (o) 
    726726  { 
     
    732732    o->SetEnableSave(true); 
    733733    o->SaveLicqInfo(); 
    734     gUserManager.DropOwner(); 
     734    gUserManager.DropOwner(o); 
    735735  } 
    736736  mainwin->licqDaemon->SetAlwaysOnlineNotify(chkAlwaysOnlineNotify->isChecked()); 
  • trunk/qt-gui/src/ownermanagerdlg.cpp

    r6187 r6381  
    8787        cmbProtocol->insertItem((*it)->Name(), n++); 
    8888      else 
    89         gUserManager.DropOwner((*it)->PPID()); 
     89        gUserManager.DropOwner(o); 
    9090    } 
    9191  } 
    92    
     92 
    9393  // Set the fields 
    9494  if (szId && nPPID) 
     
    9999    { 
    100100      edtPassword->setText(o->Password()); 
    101       gUserManager.DropOwner(nPPID); 
     101      gUserManager.DropOwner(o); 
    102102    } 
    103      
     103 
    104104    n = 0; 
    105105    for (it = pl.begin(); it != pl.end(); it++, n++) 
     
    188188      o->SetPassword(szPassword); 
    189189  } 
    190    
    191   gUserManager.DropOwner(nPPID); 
     190 
     191  gUserManager.DropOwner(o); 
    192192  server->SaveConf(); 
    193    
     193 
    194194  close(); 
    195195} 
     
    333333void OwnerManagerDlg::slot_registerClicked() 
    334334{ 
    335   if (gUserManager.OwnerUin() != 0) 
     335  if (!gUserManager.OwnerId(LICQ_PPID).empty()) 
    336336  { 
    337337    QString buf = tr("You are currently registered as\n" 
     
    340340                    "Rerun licq with the -b option to select a new\n" 
    341341                    "base directory and then register a new user.") 
    342                     .arg(gUserManager.OwnerUin()).arg(BASE_DIR); 
     342                    .arg(gUserManager.OwnerId(LICQ_PPID).c_str()).arg(BASE_DIR); 
    343343    InformUser(this, buf); 
    344344    return; 
     
    376376    updateOwners(); 
    377377 
    378     char sz[20]; 
    379378    //TODO which owner 
    380     sprintf(sz, "%lu", gUserManager.OwnerUin()); 
     379    QString id = gUserManager.OwnerId(LICQ_PPID); 
    381380    InformUser(this, tr("Successfully registered, your user identification\n" 
    382381                        "number (UIN) is %1.\n" 
    383                         "Now set your personal information.").arg(gUserManager.OwnerUin())); 
    384     mainwin->callInfoTab(mnuUserGeneral, sz, LICQ_PPID); 
     382                        "Now set your personal information.").arg(id)); 
     383    mainwin->callInfoTab(mnuUserGeneral, id, LICQ_PPID); 
    385384  } 
    386385  else 
  • trunk/qt-gui/src/phonedlg.cpp

    r4699 r6381  
    4545  : QDialog(parent, "EditPhoneDlg", true, WDestructiveClose) 
    4646{ 
    47   ICQOwner* o = gUserManager.FetchOwner(LOCK_R); 
     47  ICQOwner* o = gUserManager.FetchOwner(LICQ_PPID, LOCK_R); 
    4848  if (o == NULL) 
    4949  { 
     
    5252  } 
    5353  QTextCodec *codec = UserCodec::codecForICQUser(o); 
    54   gUserManager.DropOwner(); 
     54  gUserManager.DropOwner(o); 
    5555 
    5656  m_nEntry = nEntry; 
     
    230230  } 
    231231 
    232   ICQOwner* o = gUserManager.FetchOwner(LOCK_R); 
     232  ICQOwner* o = gUserManager.FetchOwner(LICQ_PPID, LOCK_R); 
    233233  if (o == NULL) 
    234234  { 
     
    237237  } 
    238238  QTextCodec *codec = UserCodec::codecForICQUser(o); 
    239   gUserManager.DropOwner(); 
     239  gUserManager.DropOwner(o); 
    240240 
    241241  struct PhoneBookEntry pbe; 
  • trunk/qt-gui/src/randomchatdlg.cpp

    r4699 r6381  
    216216      lstGroups->setCurrentItem(0); break; 
    217217  } 
    218   gUserManager.DropOwner(); 
     218  gUserManager.DropOwner(o); 
    219219 
    220220  show(); 
  • trunk/qt-gui/src/securitydlg.cpp

    r5328 r6381  
    4949  ePasswordChange = 0; 
    5050 
    51   unsigned long nUin = gUserManager.OwnerUin(); 
    52   QString strUin; 
    53   if (nUin) 
    54     strUin.setNum(nUin); 
     51  QString strUin = gUserManager.OwnerId(LICQ_PPID);; 
    5552 
    5653  QVBoxLayout *lay = new QVBoxLayout(this, 8); 
     
    9289  // UIN 
    9390  edtUin->setValidator(new QIntValidator(10000, 2147483647, edtUin)); 
    94   if (nUin)  
    95     edtUin->setText(strUin); 
     91  edtUin->setText(strUin); 
    9692 
    9793  // Owner password 
    98   ICQOwner *o = gUserManager.FetchOwner(LOCK_R); 
     94  ICQOwner* o = gUserManager.FetchOwner(LICQ_PPID, LOCK_R); 
    9995  if (o != NULL) 
    10096  { 
     
    149145    chkWebAware->setChecked(o->WebAware()); 
    150146    chkHideIp->setChecked(o->HideIp()); 
    151     gUserManager.DropOwner(); 
     147    gUserManager.DropOwner(o); 
    152148  } 
    153149  else 
     
    193189void SecurityDlg::ok() 
    194190{ 
    195   ICQOwner* o = gUserManager.FetchOwner(LOCK_R); 
     191  ICQOwner* o = gUserManager.FetchOwner(LICQ_PPID, LOCK_R); 
    196192  if(o == 0) return; 
    197193  unsigned short status = o->Status(); 
    198   gUserManager.DropOwner(); 
     194  gUserManager.DropOwner(o); 
    199195 
    200196  // validate password 
     
    247243    if (chkOnlyLocal->isChecked()) 
    248244    { 
    249       o = gUserManager.FetchOwner(LOCK_W); 
     245      o = gUserManager.FetchOwner(LICQ_PPID, LOCK_W); 
    250246      gUserManager.SetOwnerUin(edtUin->text().toULong()); 
    251247      o->SetPassword(edtFirst->text().latin1()); 
    252       gUserManager.DropOwner(); 
     248      gUserManager.DropOwner(o); 
    253249      close(); 
    254250    } 
  • trunk/qt-gui/src/usereventdlg.cpp

    r6366 r6381  
    16051605        { 
    16061606          ownerName = QString::fromUtf8(o->GetAlias()); 
    1607           gUserManager.DropOwner(m_nPPID); 
     1607          gUserManager.DropOwner(o); 
    16081608        } 
    16091609        else 
    16101610          ownerName = QString(tr("Error! no owner set")); 
    16111611        QDateTime date; 
    1612          
     1612 
    16131613        // Iterate through each message to add 
    16141614        // Only show old messages as recent ones. Don't show duplicates. 
  • trunk/qt-gui/src/userinfodlg.cpp

    r6305 r6381  
    15001500  o->SetEnableSave(true); 
    15011501  o->SavePictureInfo(); 
    1502   gUserManager.DropOwner(); 
     1502  gUserManager.DropOwner(o); 
    15031503 
    15041504  server->icqUpdatePictureTimestamp(); 
     
    20002000    QTextCodec *ownerCodec = UserCodec::codecForICQUser(o); 
    20012001    ownerName = ownerCodec->toUnicode(o->GetAlias()); 
    2002     gUserManager.DropOwner(m_nPPID); 
     2002    gUserManager.DropOwner(o); 
    20032003  } 
    20042004 
     
    22852285  unsigned short status = o->Status(); 
    22862286  QTextCodec *codec = UserCodec::codecForICQUser(o); 
    2287   gUserManager.DropOwner(m_nPPID); 
    2288    
     2287  gUserManager.DropOwner(o); 
     2288 
    22892289  if (m_bOwner && currentTab == PhoneInfo) 
    22902290  { 
     
    23872387    unsigned short status = o->Status(); 
    23882388    codec = UserCodec::codecForICQUser(o); 
    2389     gUserManager.DropOwner(m_nPPID); 
     2389    gUserManager.DropOwner(o); 
    23902390 
    23912391    if(status == ICQ_STATUS_OFFLINE) { 
  • trunk/qt-gui/src/userselectdlg.cpp

    r6305 r6381  
    8282 
    8383    // For now, just have one owner 
    84     ICQOwner *o = gUserManager.FetchOwner(LOCK_R); 
     84  ICQOwner* o = gUserManager.FetchOwner(LICQ_PPID, LOCK_R); 
    8585  if (o == 0) 
    8686  { 
     
    9090    cmbUser->insertItem(QString("%1 (%2)").arg(o->GetAlias()).arg(o->IdString())); 
    9191    edtPassword->setText(o->Password()); 
    92     gUserManager.DropOwner(); 
     92  gUserManager.DropOwner(o); 
    9393 
    9494        exec(); // this is different from show(), exec() does not return  
     
    102102void UserSelectDlg::slot_ok() 
    103103{ 
    104   ICQOwner *o = gUserManager.FetchOwner(LOCK_W); 
     104  ICQOwner* o = gUserManager.FetchOwner(LICQ_PPID, LOCK_W); 
    105105  if (o == 0) 
    106106  { 
     
    110110  o->SetSavePassword(chkSavePassword->isChecked()); 
    111111  o->SetPassword(edtPassword->text().latin1()); 
    112   gUserManager.DropOwner(); 
     112  gUserManager.DropOwner(o); 
    113113 
    114114  close(); 
  • trunk/qt-gui/src/wharf.cpp

    </
    r5514 r6381  
    219219{ 
    220220  QPixmap m; 
    221   ICQOwner *o = gUserManager.FetchOwner(LOCK_R); 
     221  ICQOwner* o = gUserManager.FetchOwner(LICQ_PPID, LOCK_R); 
    222222  if (o == 0) return; 
    223223  switch (o->Status()) 
     
    232232  } 
    233233  if (o->StatusInvisible()) m = QPixmap((const char **)iconInvisible_xpm); 
    234   gUserManager.DropOwner(); 
     234  gUserManager.DropOwner(o); 
    235235  QPainter painter(wharfIcon->vis); 
    236236  if (!m_bFortyEight)