| 1 | /* |
| 2 | * This program is free software; you can redistribute it and/or |
| 3 | * modify it under the terms of the GNU General Public License |
| 4 | * as published by the Free Software Foundation; either version 2 |
| 5 | * of the License, or (at your option) any later version. |
| 6 | * |
| 7 | * This program is distributed in the hope that it will be useful, |
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | * GNU General Public License for more details. |
| 11 | * |
| 12 | * You should have received a copy of the GNU General Public License |
| 13 | * along with this program; if not, write to the Free Software |
| 14 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 15 | */ |
| 16 | |
| 17 | #ifndef INCLUDED_FRIENDS_H |
| 18 | #define INCLUDED_FRIENDS_H |
| 19 | |
| 20 | #define FRIEND_UNLOADEDMUTUAL -1 |
| 21 | #define FRIEND_NOTMUTUAL 0 |
| 22 | #define FRIEND_ISMUTUAL 1 |
| 23 | |
| 24 | #include "account.h" |
| 25 | |
| 26 | namespace pvpgn |
| 27 | { |
| 28 | |
| 29 | namespace bnetd |
| 30 | { |
| 31 | typedef struct friend_struct |
| 32 | { |
| 33 | /* FRIEND_UNLOADEDMUTUAL: unloaded(used to remove deleted elems when reload) |
| 34 | * FRIEND_NOTMUTUAL: not mutual |
| 35 | * FRIEND_ISMUTUAL: is mutual |
| 36 | */ |
| 37 | int mutual; |
| 38 | t_account *friendacc = nullptr; |
| 39 | } t_friend; |
| 40 | |
| 41 | #ifndef JUST_NEED_TYPES |
| 42 | |
| 43 | extern t_account * friend_get_account(t_friend *); |
| 44 | extern int friend_set_account(t_friend *, t_account *); |
| 45 | extern char friend_get_mutual(t_friend *); |
| 46 | extern int friend_set_mutual(t_friend *, int); |
| 47 | |
| 48 | extern int friendlist_unload(t_list *); |
| 49 | extern int friendlist_close(t_list *); |
| 50 | extern int friendlist_purge(t_list *); |
| 51 | extern int friendlist_add_account(t_list *, t_account *, int); |
| 52 | extern int friendlist_remove_friend(t_list *, t_friend *); |
| 53 | extern int friendlist_remove_account(t_list *, t_account *); |
| 54 | extern int friendlist_remove_username(t_list *, const char *); |
| 55 | extern t_friend * friendlist_find_account(t_list *, t_account *); |
| 56 | extern t_friend * friendlist_find_username(t_list *, const char *); |
| 57 | extern t_friend * friendlist_find_uid(t_list *, unsigned int); |
| 58 | |
| 59 | #endif |
| 60 | |
| 61 | } |
| 62 | |
| 63 | } |
| 64 | |
| 65 | #endif |