Changeset 6430 for trunk/qt-gui

Show
Ignore:
Timestamp:
07/06/08 20:30:57 (5 months ago)
Author:
flynd
Message:

Redefined UserStringList? to use std::string instead of char* so we don't have to keep track of freeing the strings when we're done.

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

Legend:

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

    r6391 r6430  
    2222#include "config.h" 
    2323#endif 
     24 
     25#include <cctype> 
     26#include <cstdio> 
     27#include <cstring> 
     28#include <list> 
     29#include <map> 
    2430 
    2531#ifdef USE_KDE 
     
    136142} 
    137143 
    138 #include <map> 
    139 #include <cctype> 
    140  
    141 using std::isdigit; 
     144using namespace std; 
    142145 
    143146#undef Bool 
     
    48104813  } 
    48114814 
    4812   UserStringList users; 
    4813   std::list<unsigned long> ppids; 
     4815  list<pair<QString, unsigned long> > users; 
    48144816  FOR_EACH_USER_START(LOCK_R) 
    48154817  { 
    48164818    if (pUser->NewMessages() > 0) 
    4817     { 
    4818       users.push_back(pUser->IdString()); 
    4819       ppids.push_back(pUser->PPID()); 
    4820     } 
     4819      users.push_back(pair<QString, unsigned long>(pUser->IdString(), pUser->PPID())); 
    48214820  } 
    48224821  FOR_EACH_USER_END 
    48234822 
    4824   for (UserStringList::iterator iter = users.begin(); iter != users.end(); iter++) 
    4825   { 
    4826     callDefaultFunction(*iter, ppids.front()); 
    4827     ppids.pop_front(); 
    4828   } 
     4823  list<pair<QString, unsigned long> >::iterator iter; 
     4824  for (iter = users.begin(); iter != users.end(); iter++) 
     4825    callDefaultFunction(iter->first, iter->second); 
    48294826} 
    48304827 
  • trunk/qt-gui/src/mmsenddlg.cpp

    r5328 r6430  
    104104 
    105105 
    106 int CMMSendDlg::go_contact(UserStringList &_users) 
     106int CMMSendDlg::go_contact(StringList& users) 
    107107{ 
    108108  m_nEventType = ICQ_CMDxSUB_CONTACTxLIST; 
    109   users = &_users; 
     109  myUsers = &users; 
    110110 
    111111  setCaption(tr("Multiple Recipient Contact List")); 
     
    257257      gUserManager.DropUser(u); 
    258258 
    259       icqEventTag = server->icqSendContactList(m_szId, *users, false, 
     259      icqEventTag = server->icqSendContactList(m_szId, *myUsers, false, 
    260260        ICQ_TCPxMSG_NORMAL); 
    261261      break; 
  • trunk/qt-gui/src/mmsenddlg.h

    r5328 r6430  
    2929 
    3030#include "licqdialog.h" 
    31 #include "licq_user.h" 
     31#include "licq_icqd.h" 
    3232 
    3333class QPushButton; 
     
    5151  int go_message(QString); 
    5252  int go_url(QString, QString); 
    53   int go_contact(UserStringList &_users); 
     53  int go_contact(StringList& users); 
    5454 
    5555protected: 
    5656  QString s1, s2; 
    57   UserStringList *users; 
     57  StringList* myUsers; 
    5858 
    5959  unsigned long m_nEventType; 
  • trunk/qt-gui/src/usereventdlg.cpp

    r6406 r6430  
    25452545      CEventContactList* ue = (CEventContactList *) e->UserEvent(); 
    25462546      const ContactList& clist = ue->Contacts(); 
    2547       UserStringList users; 
     2547      StringList users; 
    25482548 
    25492549      // ContactList is const but string list holds "char*" so we have to copy each string 
    25502550      for(ContactList::const_iterator i = clist.begin(); i != clist.end(); i++) 
    2551         users.push_back(strdup((*i)->IdString())); 
     2551        users.push_back((*i)->IdString()); 
    25522552 
    25532553      if(users.size() == 0) 
     
    25562556      icqEventTag = server->icqSendContactList(m_lUsers.front().c_str(), 
    25572557          users, bOnline, nLevel, false, &icqColor); 
    2558  
    2559       // Free the strings in the list 
    2560       for (UserStringList::iterator i = users.begin(); i != users.end(); ++i) 
    2561         free(*i); 
    25622558 
    25632559      break; 
     
    33943390  tmrSendTyping->stop(); 
    33953391  server->ProtoTypingNotification(m_lUsers.front().c_str(), m_nPPID, false, m_nConvoId); 
    3396    
     3392 
    33973393  CMMUserViewItem *i = static_cast<CMMUserViewItem*>(lstContacts->firstChild()); 
    3398   UserStringList users; 
     3394  StringList users; 
    33993395 
    34003396  while (i)