| 1 |
sysadm |
1.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_CLAN_TYPES
|
| 18 |
|
|
#define INCLUDED_CLAN_TYPES
|
| 19 |
|
|
|
| 20 |
|
|
#ifdef JUST_NEED_TYPES
|
| 21 |
|
|
# include "common/bn_type.h"
|
| 22 |
|
|
#else
|
| 23 |
|
|
# define JUST_NEED_TYPES
|
| 24 |
|
|
# include "common/bn_type.h"
|
| 25 |
|
|
# undef JUST_NEED_TYPES
|
| 26 |
|
|
#endif
|
| 27 |
|
|
|
| 28 |
|
|
#ifdef CLAN_INTERNAL_ACCESS
|
| 29 |
|
|
#ifdef JUST_NEED_TYPES
|
| 30 |
|
|
# include <stdio.h>
|
| 31 |
|
|
# include "common/list.h"
|
| 32 |
|
|
#else
|
| 33 |
|
|
# define JUST_NEED_TYPES
|
| 34 |
|
|
# include <stdio.h>
|
| 35 |
|
|
# include "common/list.h"
|
| 36 |
|
|
# undef JUST_NEED_TYPES
|
| 37 |
|
|
#endif
|
| 38 |
|
|
|
| 39 |
|
|
#endif
|
| 40 |
|
|
|
| 41 |
|
|
typedef struct clan
|
| 42 |
|
|
#ifdef CLAN_INTERNAL_ACCESS
|
| 43 |
|
|
{
|
| 44 |
|
|
unsigned int clanid;
|
| 45 |
|
|
int clantag;
|
| 46 |
|
|
char const *clanname;
|
| 47 |
|
|
time_t creation_time;
|
| 48 |
|
|
char const *clan_motd;
|
| 49 |
|
|
t_list *members;
|
| 50 |
|
|
int created;
|
| 51 |
|
|
/* --by Soar
|
| 52 |
|
|
on create, set it to -count of invited members,
|
| 53 |
|
|
each accept packet will inc it by 1,
|
| 54 |
|
|
when it is increased to 0, means that all invited members have accepted,
|
| 55 |
|
|
then clan will be created and set this value to 1
|
| 56 |
|
|
*/
|
| 57 |
|
|
char modified;
|
| 58 |
|
|
char channel_type; /* 0--public 1--private */
|
| 59 |
|
|
}
|
| 60 |
|
|
#endif
|
| 61 |
|
|
t_clan;
|
| 62 |
|
|
|
| 63 |
|
|
typedef struct _clanmember
|
| 64 |
|
|
#ifdef CLAN_INTERNAL_ACCESS
|
| 65 |
|
|
{
|
| 66 |
|
|
void *memberacc;
|
| 67 |
|
|
char status;
|
| 68 |
|
|
time_t join_time;
|
| 69 |
|
|
t_clan * clan;
|
| 70 |
|
|
#ifdef WITH_SQL
|
| 71 |
|
|
char modified;
|
| 72 |
|
|
#endif
|
| 73 |
|
|
}
|
| 74 |
|
|
#endif
|
| 75 |
|
|
t_clanmember;
|
| 76 |
|
|
|
| 77 |
|
|
#define CLAN_CHIEFTAIN 0x04
|
| 78 |
|
|
#define CLAN_SHAMAN 0x03
|
| 79 |
|
|
#define CLAN_GRUNT 0x02
|
| 80 |
|
|
#define CLAN_PEON 0x01
|
| 81 |
|
|
#define CLAN_NEW 0x00
|
| 82 |
|
|
|
| 83 |
|
|
#endif
|
| 84 |
|
|
|
| 85 |
|
|
#ifndef JUST_NEED_TYPES
|
| 86 |
|
|
#ifndef INCLUDED_CLAN_PROTOS
|
| 87 |
|
|
#define INCLUDED_CLAN_PROTOS
|
| 88 |
|
|
|
| 89 |
|
|
#define JUST_NEED_TYPES
|
| 90 |
|
|
#include "common/list.h"
|
| 91 |
|
|
#undef JUST_NEED_TYPES
|
| 92 |
|
|
|
| 93 |
|
|
|
| 94 |
|
|
extern t_list *clanlist(void);
|
| 95 |
|
|
extern int clanlist_load(void);
|
| 96 |
|
|
extern int clanlist_save(void);
|
| 97 |
|
|
extern int clanlist_unload(void);
|
| 98 |
|
|
extern int clanlist_remove_clan(t_clan * clan);
|
| 99 |
|
|
extern int clanlist_add_clan(t_clan * clan);
|
| 100 |
|
|
extern t_clan *clanlist_find_clan_by_clanid(int cid);
|
| 101 |
|
|
extern t_clan *clanlist_find_clan_by_clantag(int clantag);
|
| 102 |
|
|
|
| 103 |
|
|
|
| 104 |
|
|
extern t_account *clanmember_get_account(t_clanmember * member);
|
| 105 |
|
|
extern int clanmember_set_account(t_clanmember * member, t_account * memberacc);
|
| 106 |
|
|
extern t_connection *clanmember_get_conn(t_clanmember * member);
|
| 107 |
|
|
extern char clanmember_get_status(t_clanmember * member);
|
| 108 |
|
|
extern int clanmember_set_status(t_clanmember * member, char status);
|
| 109 |
|
|
extern time_t clanmember_get_join_time(t_clanmember * member);
|
| 110 |
|
|
extern t_clan * clanmember_get_clan(t_clanmember * member);
|
| 111 |
|
|
extern int clanmember_set_online(t_connection * c);
|
| 112 |
|
|
extern int clanmember_set_offline(t_connection * c);
|
| 113 |
|
|
extern const char *clanmember_get_online_status(t_clanmember * member, char *status);
|
| 114 |
|
|
extern int clanmember_on_change_status(t_clanmember * member);
|
| 115 |
|
|
extern const char *clanmember_get_online_status_by_connection(t_connection * conn, char *status);
|
| 116 |
|
|
extern int clanmember_on_change_status_by_connection(t_connection * conn);
|
| 117 |
|
|
|
| 118 |
|
|
extern t_clan *clan_create(t_account * chieftain_acc, int clantag, const char *clanname, const char *motd);
|
| 119 |
|
|
extern int clan_destroy(t_clan * clan);
|
| 120 |
|
|
|
| 121 |
|
|
extern int clan_unload_members(t_clan * clan);
|
| 122 |
|
|
extern int clan_remove_all_members(t_clan * clan);
|
| 123 |
|
|
|
| 124 |
|
|
extern int clan_save(t_clan * clan);
|
| 125 |
|
|
extern int clan_remove(int clantag);
|
| 126 |
|
|
|
| 127 |
|
|
extern int clan_get_created(t_clan * clan);
|
| 128 |
|
|
extern int clan_set_created(t_clan * clan, int created);
|
| 129 |
|
|
extern char clan_get_modified(t_clan * clan);
|
| 130 |
|
|
extern int clan_set_modified(t_clan * clan, char modified);
|
| 131 |
|
|
extern char clan_get_channel_type(t_clan * clan);
|
| 132 |
|
|
extern int clan_set_channel_type(t_clan * clan, char channel_type);
|
| 133 |
|
|
extern t_list *clan_get_members(t_clan * clan);
|
| 134 |
|
|
extern char const *clan_get_name(t_clan * clan);
|
| 135 |
|
|
extern int clan_get_clantag(t_clan * clan);
|
| 136 |
|
|
extern char const *clan_get_motd(t_clan * clan);
|
| 137 |
|
|
extern int clan_set_motd(t_clan * clan, const char *motd);
|
| 138 |
|
|
extern unsigned int clan_get_clanid(t_clan * clan);
|
| 139 |
|
|
extern int clan_set_creation_time(t_clan * clan, time_t c_time);
|
| 140 |
|
|
extern time_t clan_get_creation_time(t_clan * clan);
|
| 141 |
|
|
extern int clan_get_member_count(t_clan * clan);
|
| 142 |
|
|
|
| 143 |
|
|
extern t_clanmember *clan_add_member(t_clan * clan, t_account * memberacc, char status);
|
| 144 |
|
|
extern int clan_remove_member(t_clan * clan, t_clanmember * member);
|
| 145 |
|
|
|
| 146 |
|
|
extern t_clanmember *clan_find_member(t_clan * clan, t_account * memberacc);
|
| 147 |
|
|
extern t_clanmember *clan_find_member_by_name(t_clan * clan, char const *membername);
|
| 148 |
|
|
extern t_clanmember *clan_find_member_by_uid(t_clan * clan, unsigned int memberuid);
|
| 149 |
|
|
|
| 150 |
|
|
extern int clan_send_packet_to_online_members(t_clan * clan, t_packet * packet);
|
| 151 |
|
|
extern int clan_get_possible_member(t_connection * c, t_packet const *const packet);
|
| 152 |
|
|
extern int clan_send_status_window(t_connection * c);
|
| 153 |
|
|
extern int clan_send_status_window_on_create(t_clan * clan);
|
| 154 |
|
|
extern int clan_close_status_window(t_connection * c);
|
| 155 |
|
|
extern int clan_close_status_window_on_disband(t_clan * clan);
|
| 156 |
|
|
extern int clan_send_memberlist(t_connection * c, t_packet const *const packet);
|
| 157 |
|
|
extern int clan_change_member_status(t_connection * c, t_packet const *const packet);
|
| 158 |
|
|
extern int clan_send_motd_reply(t_connection * c, t_packet const *const packet);
|
| 159 |
|
|
extern int clan_save_motd_chg(t_connection * c, t_packet const *const packet);
|
| 160 |
|
|
|
| 161 |
|
|
extern int str_to_clantag(const char *str);
|
| 162 |
|
|
|
| 163 |
|
|
#endif
|
| 164 |
|
|
#endif
|