Show
Ignore:
Timestamp:
07/01/08 03:07:09 (5 months ago)
Author:
flynd
Message:

Removed the user list since there is no need to have both a list and a map.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/licq/include/licq_user.h

    r6363 r6364  
    3333  {                                                      \ 
    3434    ICQUser *pUser;                                      \ 
    35     UserList *_ul_ = gUserManager.LockUserList(LOCK_R); \ 
    36     for (UserList::iterator _i_ = _ul_->begin();         \ 
     35    const UserMap* _ul_ = gUserManager.LockUserList(LOCK_R); \ 
     36    for (UserMap::const_iterator _i_ = _ul_->begin();    \ 
    3737         _i_ != _ul_->end(); _i_++)                      \ 
    3838    {                                                    \ 
    39       pUser = *_i_;                                      \ 
     39      pUser = _i_->second;                               \ 
    4040      pUser->Lock(x);                                    \ 
    4141      { 
     
    4444  {                                                      \ 
    4545    ICQUser *pUser;                                      \ 
    46     UserList *_ul_ = gUserManager.LockUserList(LOCK_R); \ 
    47     for (UserList::iterator _i_ = _ul_->begin();         \ 
     46    const UserMap* _ul_ = gUserManager.LockUserList(LOCK_R); \ 
     47    for (UserMap::const_iterator _i_ = _ul_->begin();    \ 
    4848         _i_ != _ul_->end(); _i_++)                      \ 
    4949    {                                                    \ 
    50       pUser = *_i_;                                      \ 
    51       if (pUser->PPID() == x)                            \ 
    52       {                                                  \ 
    53         pUser->Lock(y);                                  \ 
    54         { 
     50      if (_i_->first.second != x)                        \ 
     51        continue;                                        \ 
     52      pUser = _i_->second;                               \ 
     53      pUser->Lock(y);                                    \ 
     54      { 
    5555 
    5656#define FOR_EACH_OWNER_START(x)                           \ 
     
    8585  } 
    8686 
    87 #define FOR_EACH_PROTO_USER_END        \ 
    88         }                                \ 
    89         pUser->Unlock();                 \ 
    90       }                                  \ 
    91     }                                    \ 
    92     gUserManager.UnlockUserList();       \ 
    93   } 
     87#define FOR_EACH_PROTO_USER_END FOR_EACH_USER_END 
    9488 
    9589#define FOR_EACH_USER_BREAK              \ 
     
    178172  {                                                      \ 
    179173    unsigned long nUin;                                  \ 
    180     UserList *_ul_ = gUserManager.LockUserList(LOCK_R); \ 
    181     for (UserList::iterator _i_ = _ul_->begin();         \ 
     174    const UserMap* _ul_ = gUserManager.LockUserList(LOCK_R); \ 
     175    for (UserMap::const_iterator _i_ = _ul_->begin();    \ 
    182176         _i_ != _ul_->end(); _i_++)                      \ 
    183177    {                                                    \ 
    184       nUin = (*_i_)->Uin();                              \ 
     178      nUin = _i_->second->Uin();                         \ 
    185179      { 
    186180 
     
    188182  {                                                      \ 
    189183    char *szId;                                          \ 
    190     UserList *_ul_ = gUserManager.LockUserList(LOCK_R);  \ 
    191     for (UserList::iterator _i_ = _ul_->begin();         \ 
     184    UserMap* _ul_ = gUserManager.LockUserList(LOCK_R);   \ 
     185    for (UserMap::const_iterator _i_ = _ul_->begin();    \ 
    192186         _i_ != _ul_->end(); _i_++)                      \ 
    193187    {                                                    \ 
    194       if ((*_i_)->PPID() == x)                           \ 
    195       {                                                  \ 
    196         szId = (*_i_)->IdString();                       \ 
    197         { 
     188      if (_i_->first.second != x)                        \ 
     189        continue;                                        \ 
     190      szId = (*_i_)->IdString();                         \ 
     191      { 
    198192 
    199193#define FOR_EACH_UIN_END                 \ 
     
    203197  } 
    204198 
    205 #define FOR_EACH_PROTO_ID_END            \ 
    206         }                                \ 
    207       }                                  \ 
    208     }                                    \ 
    209     gUserManager.UnlockUserList();       \ 
    210   } 
     199#define FOR_EACH_PROTO_ID_END FOR_EACH_UIN_END 
    211200 
    212201#define FOR_EACH_UIN_BREAK               \ 
     
    236225typedef std::pair<std::string, unsigned long> UserMapKey; 
    237226typedef std::map<UserMapKey, class ICQUser*> UserMap; 
    238 typedef std::list<ICQUser *> UserList; 
    239227typedef std::list<class ICQOwner *> OwnerList; 
    240228typedef std::set<unsigned short> UserGroupList; 
     
    12901278  bool IsOnList(unsigned long nUin); 
    12911279 
    1292   UserList *LockUserList(unsigned short); 
     1280  /** 
     1281   * Lock user list for access 
     1282   * call UnlockUserList when lock is no longer needed 
     1283   * 
     1284   * @param lockType Type of lock (LOCK_R or LOCK_W) 
     1285   * @return Map of all users indexed by UserMapKey 
     1286   */ 
     1287  UserMap* LockUserList(unsigned short lockType); 
     1288 
     1289  /** 
     1290   * Release user list lock 
     1291   */ 
    12931292  void UnlockUserList(); 
    12941293 
     
    14861485 
    14871486  GroupMap myGroups; 
    1488   UserList m_vpcUsers; 
    14891487  UserMap myUsers; 
    14901488  OwnerList m_vpcOwners;