Changeset 6430
- Timestamp:
- 07/06/08 20:30:57 (5 months ago)
- Location:
- trunk
- Files:
-
- 15 modified
-
licq/include/licq_icqd.h (modified) (3 diffs)
-
licq/include/licq_packets.h (modified) (4 diffs)
-
licq/include/licq_user.h (modified) (1 diff)
-
licq/src/icqd-srv.cpp (modified) (19 diffs)
-
licq/src/icqd-tcp.cpp (modified) (3 diffs)
-
licq/src/icqpacket.cpp (modified) (12 diffs)
-
qt-gui/src/mainwin.cpp (modified) (3 diffs)
-
qt-gui/src/mmsenddlg.cpp (modified) (2 diffs)
-
qt-gui/src/mmsenddlg.h (modified) (2 diffs)
-
qt-gui/src/usereventdlg.cpp (modified) (3 diffs)
-
qt4-gui/src/core/licqgui.cpp (modified) (3 diffs)
-
qt4-gui/src/dialogs/mmsenddlg.cpp (modified) (2 diffs)
-
qt4-gui/src/dialogs/mmsenddlg.h (modified) (2 diffs)
-
qt4-gui/src/userevents/usersendcommon.cpp (modified) (2 diffs)
-
qt4-gui/src/userevents/usersendcontactevent.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/licq/include/licq_icqd.h
r6421 r6430 61 61 } 62 62 63 typedef std::list<std::string> StringList; 64 63 65 /* Forward declarations for friend functions */ 64 66 void *Ping_tep(void *p); … … 348 350 bool bMultipleRecipients = false, CICQColor *pColor = NULL); 349 351 // Contact List 350 unsigned long icqSendContactList(const char *szId, UserStringList &users,352 unsigned long icqSendContactList(const char *szId, const StringList& users, 351 353 bool bOnline, unsigned short nLevel, bool bMultipleRecipients = false, 352 354 CICQColor *pColor = NULL); … … 467 469 void icqRenameGroup(const char *_szNewName, unsigned short _nGSID); 468 470 void icqRenameUser(const char *_szId); 469 void icqExportUsers( UserStringList &, unsigned short);471 void icqExportUsers(const StringList& users, unsigned short); 470 472 void icqExportGroups(const GroupNameMap& groups); 471 473 void icqUpdateServerGroups(); -
trunk/licq/include/licq_packets.h
r6405 r6430 9 9 class CBuffer; 10 10 class INetSocket; 11 12 typedef std::list<std::string> StringList; 11 13 12 14 // values of extra info to identify plugin request … … 375 377 public: 376 378 CPU_GenericUinList(const char *szId, unsigned short Family, unsigned short Subtype); 377 CPU_GenericUinList( UserStringList &, unsigned short, unsigned short);379 CPU_GenericUinList(const StringList& users, unsigned short, unsigned short); 378 380 CPU_GenericUinList(unsigned long _nUin, unsigned short Family, unsigned short Subtype); 379 381 }; … … 401 403 { 402 404 public: 403 CPU_ExportToServerList( UserStringList &, unsigned short);405 CPU_ExportToServerList(const StringList& users, unsigned short); 404 406 }; 405 407 … … 453 455 { 454 456 public: 455 CPU_ClearServerList( UserStringList &, unsigned short);457 CPU_ClearServerList(const StringList& users, unsigned short); 456 458 }; 457 459 -
trunk/licq/include/licq_user.h
r6420 r6430 241 241 typedef std::map<unsigned short, std::string> GroupNameMap; 242 242 typedef std::list<unsigned long> UinList; 243 typedef std::list<char *> UserStringList;244 243 typedef std::vector <class CUserEvent *> UserEventList; 245 244 -
trunk/licq/src/icqd-srv.cpp
r6405 r6430 133 133 134 134 // Just upload all of the users now 135 UserStringList doneUsers;136 UserStringList users;135 StringList doneUsers; 136 StringList users; 137 137 FOR_EACH_PROTO_USER_START(LICQ_PPID, LOCK_R) 138 138 { … … 141 141 if (pUser->GetSID() == 0 && !pUser->IgnoreList()) 142 142 { 143 UserStringList::const_iterator p = std::find(doneUsers.begin(), doneUsers.end(),143 StringList::const_iterator p = std::find(doneUsers.begin(), doneUsers.end(), 144 144 pUser->IdString()); 145 145 … … 147 147 { 148 148 // Keep track of who has been done 149 users.push_back( strdup(pUser->IdString()));150 doneUsers.push_back( strdup(pUser->IdString()));149 users.push_back(pUser->IdString()); 150 doneUsers.push_back(pUser->IdString()); 151 151 } 152 152 } … … 159 159 icqUpdateServerGroups(); 160 160 } 161 162 UserStringList::iterator it;163 for (it = doneUsers.begin(); it != doneUsers.end(); ++it)164 free(*it);165 161 166 162 // Export visible/invisible/ignore list 167 UserStringList visibleUsers, invisibleUsers, ignoredUsers;163 StringList visibleUsers, invisibleUsers, ignoredUsers; 168 164 FOR_EACH_PROTO_USER_START(LICQ_PPID, LOCK_R) 169 165 { 170 166 if (pUser->IgnoreList() && pUser->GetSID() == 0) 171 167 { 172 ignoredUsers.push_back( strdup(pUser->IdString()));168 ignoredUsers.push_back(pUser->IdString()); 173 169 } 174 170 else … … 176 172 if (pUser->InvisibleList() && pUser->GetInvisibleSID() == 0) 177 173 { 178 invisibleUsers.push_back( strdup(pUser->IdString()));174 invisibleUsers.push_back(pUser->IdString()); 179 175 } 180 176 181 177 if (pUser->VisibleList() && pUser->GetVisibleSID() == 0) 182 178 { 183 visibleUsers.push_back( strdup(pUser->IdString()));179 visibleUsers.push_back(pUser->IdString()); 184 180 } 185 181 } … … 198 194 199 195 //-----icqExportUsers---------------------------------------------------------- 200 void CICQDaemon::icqExportUsers( UserStringList &users, unsigned short _nType)196 void CICQDaemon::icqExportUsers(const StringList& users, unsigned short _nType) 201 197 { 202 198 if (!UseServerContactList()) return; … … 1226 1222 { 1227 1223 unsigned short n = 0; 1228 UserStringList users;1224 StringList users; 1229 1225 FOR_EACH_PROTO_USER_START(LICQ_PPID, LOCK_W) 1230 1226 { 1231 1227 n++; 1232 users.push_back( strdup(pUser->IdString()));1228 users.push_back(pUser->IdString()); 1233 1229 if (n == m_nMaxUsersPerPacket) 1234 1230 { … … 1236 1232 gLog.Info(tr("%sUpdating contact list (#%hu)...\n"), L_SRVxSTR, p->Sequence()); 1237 1233 SendEvent_Server(p); 1238 users. erase(users.begin(), users.end());1234 users.clear(); 1239 1235 n = 0; 1240 1236 } … … 1273 1269 // Go through the entire list of users, checking if each one is on 1274 1270 // the visible list 1275 UserStringList users;1271 StringList users; 1276 1272 FOR_EACH_PROTO_USER_START(LICQ_PPID, LOCK_R) 1277 1273 { 1278 1274 if (pUser->GetInGroup(GROUPS_SYSTEM, GROUP_VISIBLE_LIST) ) 1279 users.push_back( strdup(pUser->IdString()));1275 users.push_back(pUser->IdString()); 1280 1276 } 1281 1277 FOR_EACH_PROTO_USER_END … … 1289 1285 void CICQDaemon::icqSendInvisibleList() 1290 1286 { 1291 UserStringList users;1287 StringList users; 1292 1288 FOR_EACH_PROTO_USER_START(LICQ_PPID, LOCK_R) 1293 1289 { 1294 1290 if (pUser->GetInGroup(GROUPS_SYSTEM, GROUP_INVISIBLE_LIST) ) 1295 users.push_back( strdup(pUser->IdString()));1291 users.push_back(pUser->IdString()); 1296 1292 } 1297 1293 FOR_EACH_PROTO_USER_END … … 1583 1579 { 1584 1580 if (!UseServerContactList()) return; 1585 1581 1586 1582 unsigned short n = 0; 1587 UserStringList users;1588 1583 StringList users; 1584 1589 1585 // Delete all the users in groups 1590 1586 FOR_EACH_PROTO_USER_START(LICQ_PPID, LOCK_W) 1591 1587 { 1592 1588 n++; 1593 users.push_back( strdup(pUser->IdString()));1589 users.push_back(pUser->IdString()); 1594 1590 if (n == m_nMaxUsersPerPacket) 1595 1591 { … … 1598 1594 gLog.Info(tr("%sDeleting server list users (#%hu)...\n"), L_SRVxSTR, p->Sequence()); 1599 1595 SendEvent_Server(p); 1600 users. erase(users.begin(), users.end());1596 users.clear(); 1601 1597 n = 0; 1602 1598 } 1603 1599 } 1604 1600 FOR_EACH_PROTO_USER_END 1605 1601 1606 1602 if (n != 0) 1607 1603 { … … 1610 1606 SendEvent_Server(p); 1611 1607 } 1612 1608 1613 1609 // Delete all the groups 1614 1610 1615 1611 1616 1612 // Delete invisible users 1617 1613 n = 0; 1618 users. erase(users.begin(), users.end());1619 1614 users.clear(); 1615 1620 1616 FOR_EACH_PROTO_USER_START(LICQ_PPID, LOCK_W) 1621 1617 { … … 1623 1619 { 1624 1620 n++; 1625 users.push_back( strdup(pUser->IdString()));1626 } 1627 1621 users.push_back(pUser->IdString()); 1622 } 1623 1628 1624 if (n == m_nMaxUsersPerPacket) 1629 1625 { … … 1633 1629 L_SRVxSTR, p->Sequence()); 1634 1630 SendEvent_Server(p); 1635 users. erase(users.begin(), users.end());1631 users.clear(); 1636 1632 n = 0; 1633 continue; 1637 1634 } 1638 1635 } 1639 1636 FOR_EACH_PROTO_USER_END 1640 1637 1641 1638 if (n != 0) 1642 1639 { … … 1646 1643 SendEvent_Server(p); 1647 1644 } 1648 1645 1649 1646 // Delete visible users 1650 1647 n = 0; 1651 users. erase(users.begin(), users.end());1652 1648 users.clear(); 1649 1653 1650 FOR_EACH_PROTO_USER_START(LICQ_PPID, LOCK_W) 1654 1651 { … … 1656 1653 { 1657 1654 n++; 1658 users.push_back( strdup(pUser->IdString()));1659 } 1660 1655 users.push_back(pUser->IdString()); 1656 } 1657 1661 1658 if (n == m_nMaxUsersPerPacket) 1662 1659 { … … 1666 1663 L_SRVxSTR, p->Sequence()); 1667 1664 SendEvent_Server(p); 1668 users. erase(users.begin(), users.end());1665 users.clear(); 1669 1666 n = 0; 1667 continue; 1670 1668 } 1671 1669 } 1672 1670 FOR_EACH_PROTO_USER_END 1673 1671 1674 1672 if (n != 0) 1675 1673 { … … 1678 1676 L_SRVxSTR, p->Sequence()); 1679 1677 SendEvent_Server(p); 1680 } 1681 1678 } 1682 1679 } 1683 1680 -
trunk/licq/src/icqd-tcp.cpp
r6405 r6430 457 457 //-----CICQDaemon::sendContactList------------------------------------------- 458 458 unsigned long CICQDaemon::icqSendContactList(const char *szId, 459 UserStringList &users, bool online, unsigned short nLevel,459 const StringList& users, bool online, unsigned short nLevel, 460 460 bool bMultipleRecipients, CICQColor *pColor) 461 461 { … … 467 467 468 468 ICQUser *u = NULL; 469 UserStringList::iterator iter;469 StringList::const_iterator iter; 470 470 for (iter = users.begin(); iter != users.end(); ++iter) 471 471 { 472 u = gUserManager.FetchUser( *iter, LICQ_PPID, LOCK_R);473 p += sprintf(&m[p], "%s%c%s%c", *iter, char(0xFE),472 u = gUserManager.FetchUser(iter->c_str(), LICQ_PPID, LOCK_R); 473 p += sprintf(&m[p], "%s%c%s%c", iter->c_str(), char(0xFE), 474 474 u == NULL ? "" : u->GetAlias(), char(0xFE)); 475 vc.push_back(new CContact( *iter, LICQ_PPID, u == NULL ? "" : u->GetAlias()));475 vc.push_back(new CContact(iter->c_str(), LICQ_PPID, u == NULL ? "" : u->GetAlias())); 476 476 gUserManager.DropUser(u); 477 477 } … … 532 532 CICQColor *pColor) 533 533 { 534 UserStringList users;534 StringList users; 535 535 char szUin[24]; 536 536 -
trunk/licq/src/icqpacket.cpp
r6405 r6430 1300 1300 1301 1301 //-----GenericUinList----------------------------------------------------------- 1302 CPU_GenericUinList::CPU_GenericUinList( UserStringList &users, unsigned short family, unsigned short Subtype)1302 CPU_GenericUinList::CPU_GenericUinList(const StringList& users, unsigned short family, unsigned short Subtype) 1303 1303 : CPU_CommonFamily(family, Subtype) 1304 1304 { … … 1306 1306 len[1] = '\0'; 1307 1307 int nLen = 0; 1308 UserStringList::iterator it;1308 StringList::const_iterator it; 1309 1309 for (it = users.begin(); it != users.end(); ++it) 1310 nLen += strlen(*it)+1;1310 nLen += it->size() + 1; 1311 1311 1312 1312 char *contacts = new char[nLen+1]; … … 1314 1314 1315 1315 for (it = users.begin(); it != users.end(); ++it) { 1316 len[0] = strlen(*it);1316 len[0] = it->size(); 1317 1317 strcat(contacts, len); 1318 strcat(contacts, *it); 1319 free (*it); 1318 strcat(contacts, it->c_str()); 1320 1319 } 1321 1320 … … 2747 2746 2748 2747 //-----ExportToServerList------------------------------------------------------- 2749 CPU_ExportToServerList::CPU_ExportToServerList( UserStringList &users,2748 CPU_ExportToServerList::CPU_ExportToServerList(const StringList& users, 2750 2749 unsigned short _nType) 2751 2750 : CPU_CommonFamily(ICQ_SNACxFAM_LIST, ICQ_SNACxLIST_ROSTxADD) … … 2755 2754 int nSize = 0; 2756 2755 2757 UserStringList::iterator i;2756 StringList::const_iterator i; 2758 2757 for (i = users.begin(); i != users.end(); ++i) 2759 2758 { 2760 ICQUser *pUser = gUserManager.FetchUser(*i, LICQ_PPID, LOCK_R);2759 ICQUser* pUser = gUserManager.FetchUser(i->c_str(), LICQ_PPID, LOCK_R); 2761 2760 if (pUser) 2762 2761 { 2763 nSize += strlen(*i);2762 nSize += i->size(); 2764 2763 nSize += 10; 2765 2764 … … 2786 2785 2787 2786 // Save the SID 2788 ICQUser *u = gUserManager.FetchUser(*i, LICQ_PPID, LOCK_W);2787 ICQUser* u = gUserManager.FetchUser(i->c_str(), LICQ_PPID, LOCK_W); 2789 2788 switch (_nType) 2790 2789 { … … 2836 2835 SetExtraInfo(m_nGSID); 2837 2836 2838 nLen = strlen(*i);2837 nLen = i->size(); 2839 2838 buffer->PackUnsignedShortBE(nLen); 2840 buffer->Pack( *i, nLen);2839 buffer->Pack(i->c_str(), nLen); 2841 2840 buffer->PackUnsignedShortBE(m_nGSID); 2842 2841 buffer->PackUnsignedShortBE(m_nSID); … … 2855 2854 if (szUnicodeName) 2856 2855 free(szUnicodeName); 2857 2858 free(*i);2859 2856 } 2860 2857 } … … 3176 3173 3177 3174 //-----ClearServerList------------------------------------------------------ 3178 CPU_ClearServerList::CPU_ClearServerList( UserStringList &uins,3175 CPU_ClearServerList::CPU_ClearServerList(const StringList& uins, 3179 3176 unsigned short _nType) 3180 3177 : CPU_CommonFamily(ICQ_SNACxFAM_LIST, ICQ_SNACxLIST_ROSTxREM) 3181 3178 { 3182 3179 int nSize = 0; 3183 UserStringList::iterator i;3184 3180 StringList::const_iterator i; 3181 3185 3182 if (_nType == ICQ_ROSTxGROUP) 3186 {3187 3188 3189 3183 return; 3190 }3191 3192 3184 3193 3185 for (i = uins.begin(); i != uins.end(); ++i) 3194 3186 { 3195 ICQUser *pUser = gUserManager.FetchUser(*i, LICQ_PPID, LOCK_R);3187 ICQUser* pUser = gUserManager.FetchUser(i->c_str(), LICQ_PPID, LOCK_R); 3196 3188 if (pUser) 3197 3189 { 3198 nSize += strlen(*i) + 2;3190 nSize += i->size() + 2; 3199 3191 nSize += 8; 3200 3192 if (pUser->GetAwaitingAuth()) … … 3203 3195 } 3204 3196 } 3205 3197 3206 3198 m_nSize += nSize; 3207 3199 InitBuffer(); 3208 3200 3209 3201 for (i = uins.begin(); i != uins.end(); i++) 3210 3202 { 3211 ICQUser *pUser = gUserManager.FetchUser(*i, LICQ_PPID, LOCK_W);3203 ICQUser* pUser = gUserManager.FetchUser(i->c_str(), LICQ_PPID, LOCK_W); 3212 3204 if (pUser) 3213 3205 { … … 3217 3209 if (_nType == ICQ_ROSTxNORMAL) 3218 3210 nGSID = pUser->GetGSID(); 3219 3220 buffer->PackUnsignedShortBE( strlen(*i));3221 buffer->Pack( *i, strlen(*i));3211 3212 buffer->PackUnsignedShortBE(i->size()); 3213 buffer->Pack(i->c_str(), i->size()); 3222 3214 buffer->PackUnsignedShortBE(nGSID); 3223 3215 buffer->PackUnsignedShortBE(pUser->GetSID()); … … 3245 3237 gUserManager.DropUser(pUser); 3246 3238 } 3247 free(*i);3248 3239 } 3249 3240 } -
trunk/qt-gui/src/mainwin.cpp
r6391 r6430 22 22 #include "config.h" 23 23 #endif 24 25 #include <cctype> 26 #include <cstdio> 27 #include <cstring> 28 #include <list> 29 #include <map> 24 30 25 31 #ifdef USE_KDE … … 136 142 } 137 143 138 #include <map> 139 #include <cctype> 140 141 using std::isdigit; 144 using namespace std; 142 145 143 146 #undef Bool … … 4810 4813 } 4811 4814 4812 UserStringList users; 4813 std::list<unsigned long> ppids; 4815 list<pair<QString, unsigned long> > users; 4814 4816 FOR_EACH_USER_START(LOCK_R) 4815 4817 { 4816 4818 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())); 4821 4820 } 4822 4821 FOR_EACH_USER_END 4823 4822 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); 4829 4826 } 4830 4827 -
trunk/qt-gui/src/mmsenddlg.cpp
r5328 r6430 104 104 105 105 106 int CMMSendDlg::go_contact( UserStringList &_users)106 int CMMSendDlg::go_contact(StringList& users) 107 107 { 108 108 m_nEventType = ICQ_CMDxSUB_CONTACTxLIST; 109 users = &_users;109 myUsers = &users; 110 110 111 111 setCaption(tr("Multiple Recipient Contact List")); … … 257 257 gUserManager.DropUser(u); 258 258 259 icqEventTag = server->icqSendContactList(m_szId, * users, false,259 icqEventTag = server->icqSendContactList(m_szId, *myUsers, false, 260 260 ICQ_TCPxMSG_NORMAL); 261 261 break; -
trunk/qt-gui/src/mmsenddlg.h
r5328 r6430 29 29 30 30 #include "licqdialog.h" 31 #include "licq_ user.h"31 #include "licq_icqd.h" 32 32 33 33 class QPushButton; … … 51 51 int go_message(QString); 52 52 int go_url(QString, QString); 53 int go_contact( UserStringList &_users);53 int go_contact(StringList& users); 54 54 55 55 protected: 56 56 QString s1, s2; 57 UserStringList *users;57 StringList* myUsers; 58 58 59 59 unsigned long m_nEventType; -
trunk/qt-gui/src/usereventdlg.cpp
r6406 r6430 2545 2545 CEventContactList* ue = (CEventContactList *) e->UserEvent(); 2546 2546 const ContactList& clist = ue->Contacts(); 2547 UserStringList users;2547 StringList users; 2548 2548 2549 2549 // ContactList is const but string list holds "char*" so we have to copy each string 2550 2550 for(ContactList::const_iterator i = clist.begin(); i != clist.end(); i++) 2551 users.push_back( strdup((*i)->IdString()));2551 users.push_back((*i)->IdString()); 2552 2552 2553 2553 if(users.size() == 0) … … 2556 2556 icqEventTag = server->icqSendContactList(m_lUsers.front().c_str(), 2557 2557 users, bOnline, nLevel, false, &icqColor); 2558 2559 // Free the strings in the list2560 for (UserStringList::iterator i = users.begin(); i != users.end(); ++i)
