Remove do-nothing command and add warning about it
[amule.git] / src / FriendList.h
blobb4bbe71c4cf2b37cc72872a71c650e64b0f6c666
1 //
2 // This file is part of the aMule Project.
3 //
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 )
6 //
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
9 // respective authors.
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
26 #ifndef FRIENDLIST_H
27 #define FRIENDLIST_H
30 #include "Types.h" // Needed for uint32
32 class wxString;
33 class CFriend;
34 class CMD4Hash;
35 class CClientRef;
37 class CFriendList
39 typedef std::list<CFriend*> FriendList;
40 public:
41 CFriendList();
42 ~CFriendList();
44 bool IsAlreadyFriend(uint32 dwLastUsedIP, uint32 nLastUsedPort);
45 void SaveList();
46 void LoadList();
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();
59 // Iterator class
60 class const_iterator {
61 // iterator for internal list
62 FriendList::const_iterator m_it;
63 public:
64 // constructs
65 const_iterator() {};
66 const_iterator(const FriendList::const_iterator& it) { m_it = it; };
67 // operators
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()); }
78 private:
79 FriendList m_FriendList;
82 #endif
83 // File_checked_for_headers