2 // This file is part of the aMule Project.
4 // Copyright (c) 2003-2011 aMule Team ( admin@amule.org / http://www.amule.org )
5 // Copyright (c) 2002-2011 Merkur ( devs@emule-project.net / http://www.emule-project.net )
7 // Any parts of this program derived from the xMule, lMule or eMule project,
8 // or contributed by third-party developers are copyrighted by their
11 // This program is free software; you can redistribute it and/or modify
12 // it under the terms of the GNU General Public License as published by
13 // the Free Software Foundation; either version 2 of the License, or
14 // (at your option) any later version.
16 // This program is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU General Public License for more details.
21 // You should have received a copy of the GNU General Public License
22 // along with this program; if not, write to the Free Software
23 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
30 #include "Types.h" // Needed for uint32
39 typedef std::list
<CFriend
*> FriendList
;
44 bool IsAlreadyFriend(uint32 dwLastUsedIP
, uint32 nLastUsedPort
);
47 CFriend
* FindFriend(const CMD4Hash
& userhash
, uint32 dwIP
, uint16 nPort
);
48 CFriend
* FindFriend(uint32 ecid
);
49 void AddFriend(CFriend
* toadd
, bool notify
= true);
50 void AddFriend(const CClientRef
& toadd
);
51 void AddFriend(const CMD4Hash
& userhash
, uint32 lastUsedIP
, uint32 lastUsedPort
, const wxString
& name
, uint32 lastSeen
= 0, uint32 lastChatted
= 0);
52 void RemoveFriend(CFriend
* toremove
);
53 void RequestSharedFileList(CFriend
* Friend
);
55 void SetFriendSlot(CFriend
* Friend
, bool new_state
);
56 void StartChatSession(CFriend
* Friend
);
57 void RemoveAllFriendSlots();
60 class const_iterator
{
61 // iterator for internal list
62 FriendList::const_iterator m_it
;
66 const_iterator(const FriendList::const_iterator
& it
) { m_it
= it
; };
68 bool operator != (const const_iterator
& it
) const { return m_it
!= it
.m_it
; }
69 const_iterator
& operator ++ () { ++ m_it
; return *this; } // prefix (assignable)
70 void operator ++ (int) { ++ m_it
; } // postfix (not assignable)
71 const CFriend
* operator * () { return *m_it
; }
73 // begin/end iterators for looping
74 const_iterator
begin() const { return const_iterator(m_FriendList
.begin()); }
75 const_iterator
end() const { return const_iterator(m_FriendList
.end()); }
79 FriendList m_FriendList
;
83 // File_checked_for_headers