本文整理汇总了C++中set_eof函数的典型用法代码示例。如果您正苦于以下问题:C++ set_eof函数的具体用法?C++ set_eof怎么用?C++ set_eof使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set_eof函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: chlogif_parse
int chlogif_parse(int fd) {
struct char_session_data* sd = NULL;
// only process data from the login-server
if( fd != login_fd ) {
ShowDebug("parse_fromlogin: Disconnecting invalid session #%d (is not the login-server)\n", fd);
do_close(fd);
return 0;
}
if( session[fd]->flag.eof ) {
do_close(fd);
login_fd = -1;
chlogif_on_disconnect();
return 0;
} else if ( session[fd]->flag.ping ) {/* we've reached stall time */
if( DIFF_TICK(last_tick, session[fd]->rdata_tick) > (stall_time * 2) ) {/* we can't wait any longer */
set_eof(fd);
return 0;
} else if( session[fd]->flag.ping != 2 ) { /* we haven't sent ping out yet */
WFIFOHEAD(fd,2);// sends a ping packet to login server (will receive pong 0x2718)
WFIFOW(fd,0) = 0x2719;
WFIFOSET(fd,2);
session[fd]->flag.ping = 2;
}
}
sd = (struct char_session_data*)session[fd]->session_data;
while(RFIFOREST(fd) >= 2) {
// -1: Login server is not connected
// 0: Avoid processing followup packets (prev was probably incomplete) packet
// 1: Continue parsing
int next = 1;
uint16 command = RFIFOW(fd,0);
switch( command ) {
case 0x2711: next = chlogif_parse_ackconnect(fd,sd); break;
case 0x2713: next = chlogif_parse_ackaccreq(fd, sd); break;
case 0x2717: next = chlogif_parse_reqaccdata(fd, sd); break;
case 0x2718: next = chlogif_parse_keepalive(fd, sd); break;
case 0x2721: next = chlogif_parse_AccInfoAck(fd); break;
case 0x2723: next = chlogif_parse_ackchangesex(fd, sd); break;
case 0x2726: next = chlogif_parse_ack_global_accreg(fd, sd); break;
case 0x2731: next = chlogif_parse_accbannotification(fd, sd); break;
case 0x2734: next = chlogif_parse_askkick(fd,sd); break;
case 0x2735: next = chlogif_parse_updip(fd,sd); break;
case 0x2743: next = chlogif_parse_vipack(fd); break;
default:
ShowError("Unknown packet 0x%04x received from login-server, disconnecting.\n", command);
set_eof(fd);
return 0;
}
if (next == 0)
return 0; //do not parse next data
}
RFIFOFLUSH(fd);
return 0;
}
开发者ID:Atemo,项目名称:rathena,代码行数:60,代码来源:char_logif.cpp
示例2: recv_to_fifo
int recv_to_fifo(int fd)
{
int len;
if( !session_isActive(fd) )
return -1;
len = sRecv(fd, (char *) session[fd]->rdata + session[fd]->rdata_size, (int)RFIFOSPACE(fd), 0);
if( len == SOCKET_ERROR )
{//An exception has occured
if( sErrno != S_EWOULDBLOCK ) {
//ShowDebug("recv_to_fifo: code %d, closing connection #%d\n", sErrno, fd);
set_eof(fd);
}
return 0;
}
if( len == 0 )
{//Normal connection end.
set_eof(fd);
return 0;
}
session[fd]->rdata_size += len;
session[fd]->rdata_tick = last_tick;
return 0;
}
开发者ID:Anubiros,项目名称:adhara-project,代码行数:28,代码来源:socket.c
示例3: recv_to_fifo
int recv_to_fifo(int fd)
{
int len;
if( !session_isActive(fd) )
return -1;
len = sRecv(fd, (char *) session[fd]->rdata + session[fd]->rdata_size, (int)RFIFOSPACE(fd), 0);
if( len == SOCKET_ERROR ) { //An exception has occured
if( sErrno != S_EWOULDBLOCK ) {
//ShowDebug("recv_to_fifo: %s, closing connection #%d\n", error_msg(), fd);
set_eof(fd);
}
return 0;
}
if( len == 0 ) { //Normal connection end.
set_eof(fd);
return 0;
}
session[fd]->rdata_size += len;
session[fd]->rdata_tick = last_tick;
#ifdef SHOW_SERVER_STATS
socket_data_i += len;
socket_data_qi += len;
if (!session[fd]->flag.server) {
socket_data_ci += len;
}
#endif
return 0;
}
开发者ID:BlazingSpear,项目名称:idathena,代码行数:33,代码来源:socket.c
示例4: set_eof
void tcp_connection::handle_read(const boost::system::error_code &error, size_t bytes_transferred)
{
if (!socket_.is_open() && !flags.eof)
{
set_eof();
}
if (flags.eof)
return;
if (error)
{
set_eof();
do_close();
}
else if (bytes_transferred == 0)
{
set_eof();
do_close();
}
else
{
rdata_size += bytes_transferred;
if (parse_)
parse_((pointer)this->shared_from_this());
RFIFOFLUSH(this);
start_read();
}
}
开发者ID:Fimbulwinter,项目名称:Fimbulwinter,代码行数:32,代码来源:tcp_connection.cpp
示例5: logchrif_parse
/**
* Entry point from char-server to log-server.
* Function that checks incoming command, then splits it to the correct handler.
* @param fd: file descriptor to parse, (link to char-serv)
* @return 0=invalid server,marked for disconnection,unknow packet; 1=success
*/
int logchrif_parse(int fd){
int cid; //char-serv id
uint32 ipl;
char ip[16];
ARR_FIND( 0, ARRAYLENGTH(ch_server), cid, ch_server[cid].fd == fd );
if( cid == ARRAYLENGTH(ch_server) ){// not a char server
ShowDebug("logchrif_parse: Disconnecting invalid session #%d (is not a char-server)\n", fd);
set_eof(fd);
do_close(fd);
return 0;
}
if( session[fd]->flag.eof ){
do_close(fd);
ch_server[cid].fd = -1;
logchrif_on_disconnect(cid);
return 0;
}
ipl = ch_server[cid].ip;
ip2str(ipl, ip);
while( RFIFOREST(fd) >= 2 ){
int next = 1; // 0: avoid processing followup packets (prev was probably incomplete) packet, 1: Continue parsing
uint16 command = RFIFOW(fd,0);
switch( command ){
case 0x2712: next = logchrif_parse_reqauth(fd, cid, ip); break;
case 0x2714: next = logchrif_parse_ackusercount(fd, cid); break;
case 0x2716: next = logchrif_parse_reqaccdata(fd, cid, ip); break;
case 0x2719: next = logchrif_parse_keepalive(fd); break;
case 0x2720: next = logchrif_parse_accinfo(fd); break; //@accinfo from inter-server
case 0x2722: next = logchrif_parse_reqchangemail(fd,cid,ip); break;
case 0x2724: next = logchrif_parse_requpdaccstate(fd,cid,ip); break;
case 0x2725: next = logchrif_parse_reqbanacc(fd,cid,ip); break;
case 0x2727: next = logchrif_parse_reqchgsex(fd,cid,ip); break;
case 0x2728: next = logchrif_parse_upd_global_accreg(fd,cid,ip); break;
case 0x272a: next = logchrif_parse_requnbanacc(fd,cid,ip); break;
case 0x272b: next = logchrif_parse_setacconline(fd,cid); break;
case 0x272c: next = logchrif_parse_setaccoffline(fd); break;
case 0x272d: next = logchrif_parse_updonlinedb(fd,cid); break;
case 0x272e: next = logchrif_parse_req_global_accreg(fd); break;
case 0x2736: next = logchrif_parse_updcharip(fd,cid); break;
case 0x2737: next = logchrif_parse_setalloffline(fd,cid); break;
#if PACKETVER_SUPPORTS_PINCODE
case 0x2738: next = logchrif_parse_updpincode(fd); break;
case 0x2739: next = logchrif_parse_pincode_authfail(fd); break;
#endif
case 0x2742: next = logchrif_parse_reqvipdata(fd); break; //Vip sys
default:
ShowError("logchrif_parse: Unknown packet 0x%x from a char-server! Disconnecting!\n", command);
set_eof(fd);
return 0;
} // switch
if (next == 0)
return 0;
} // while
return 1; //or 0
}
开发者ID:RadianFord,项目名称:rAthena,代码行数:65,代码来源:loginchrif.cpp
示例6: impossible_trade_check
/**
* Check here hacker for duplicate item in trade
* normal client refuse to have 2 same types of item (except equipment) in same trade window
* normal client authorise only no equipped item and only from inventory
* This function could end player connection if too much hack is detected
* @param sd : player to check
* @return -1:zeny hack, 0:all fine, 1:item hack
*/
int impossible_trade_check(struct map_session_data *sd)
{
struct item inventory[MAX_INVENTORY];
char message_to_gm[200];
int i, index;
nullpo_retr(1, sd);
if(sd->deal.zeny > sd->status.zeny) {
pc_setglobalreg(sd,"ZENY_HACKER",1);
return -1;
}
// get inventory of player
memcpy(&inventory, &sd->status.inventory, sizeof(struct item) * MAX_INVENTORY);
// remove this part: arrows can be trade and equipped
// re-added! [celest]
// remove equipped items (they can not be trade)
for (i = 0; i < MAX_INVENTORY; i++)
if (inventory[i].nameid > 0 && inventory[i].equip && !(inventory[i].equip & EQP_AMMO))
memset(&inventory[i], 0, sizeof(struct item));
// check items in player inventory
for(i = 0; i < 10; i++) {
if (!sd->deal.item[i].amount)
continue;
index = sd->deal.item[i].index;
if (inventory[index].amount < sd->deal.item[i].amount) { // if more than the player have -> hack
sprintf(message_to_gm, msg_txt(sd,538), sd->status.name, sd->status.account_id); // Hack on trade: character '%s' (account: %d) try to trade more items that he has.
intif_wis_message_to_gm(wisp_server_name, PC_PERM_RECEIVE_HACK_INFO, message_to_gm);
sprintf(message_to_gm, msg_txt(sd,539), inventory[index].amount, inventory[index].nameid, sd->deal.item[i].amount); // This player has %d of a kind of item (id: %d), and try to trade %d of them.
intif_wis_message_to_gm(wisp_server_name, PC_PERM_RECEIVE_HACK_INFO, message_to_gm);
// if we block people
if (battle_config.ban_hack_trade < 0) {
chrif_req_login_operation(-1, sd->status.name, CHRIF_OP_LOGIN_BLOCK, 0, 0, 0); // type: 1 - block
set_eof(sd->fd); // forced to disconnect because of the hack
// message about the ban
strcpy(message_to_gm, msg_txt(sd,540)); // This player has been definitively blocked.
// if we ban people
} else if (battle_config.ban_hack_trade > 0) {
chrif_req_login_operation(-1, sd->status.name, CHRIF_OP_LOGIN_BAN, battle_config.ban_hack_trade*60, 0, 0); // type: 2 - ban (year, month, day, hour, minute, second)
set_eof(sd->fd); // forced to disconnect because of the hack
// message about the ban
sprintf(message_to_gm, msg_txt(sd,507), battle_config.ban_hack_trade); // This player has been banned for %d minute(s).
} else
// message about the ban
strcpy(message_to_gm, msg_txt(sd,508)); // This player hasn't been banned (Ban option is disabled).
intif_wis_message_to_gm(wisp_server_name, PC_PERM_RECEIVE_HACK_INFO, message_to_gm);
return 1;
}
inventory[index].amount -= sd->deal.item[i].amount; // remove item from inventory
}
return 0;
}
开发者ID:Chowkin,项目名称:Original,代码行数:67,代码来源:trade.c
示例7: recv_to_fifo
static int recv_to_fifo(int fd)
{
int len;
if( (fd<0) || (fd>=FD_SETSIZE) || (NULL==session[fd]) )
return -1;
if(session[fd]->eof)
return -1;
#ifdef __WIN32
len=recv(fd,(char *)session[fd]->rdata+session[fd]->rdata_size, RFIFOSPACE(fd), 0);
if (len == SOCKET_ERROR) {
if (WSAGetLastError() == WSAECONNABORTED) {
ShowWarning("recv_to_fifo: software de conexao cancelado na sessao #%d\n", fd);
FD_CLR(fd, &readfds); //Remove the socket so the select() won't hang on it.
// exit(1); //Windows can't really recover from this one. [Skotlex]
}
if (WSAGetLastError() != WSAEWOULDBLOCK) {
// ShowDebug("recv_to_fifo: error %d, ending connection #%d\n", WSAGetLastError(), fd);
set_eof(fd);
}
return 0;
}
#else
len=read(fd,session[fd]->rdata+session[fd]->rdata_size, RFIFOSPACE(fd));
if (len == -1)
{
if (errno == ECONNABORTED)
{
ShowFatalError("recv_to_fifo: Quebra de conexao (software de conexao cancelado na sessao #%d)\n", fd);
// exit(1); //Temporal debug, maybe this can be fixed.
}
if (errno != EAGAIN) { //Connection error.
// perror("closing session: recv_to_fifo");
set_eof(fd);
}
return 0;
}
#endif
if (len <= 0) { //Normal connection end.
set_eof(fd);
return 0;
}
session[fd]->rdata_size+=len;
session[fd]->rdata_tick = last_tick;
return 0;
}
开发者ID:AxlSckay,项目名称:Ragnarok-OldTimes,代码行数:49,代码来源:socket.c
示例8: set_eof
/*
* Called to indicate that we have just read an EOF from the device.
*/
void DEVICE::set_ateof()
{
set_eof();
file_addr = 0;
file_size = 0;
block_num = 0;
}
开发者ID:dl5rcw,项目名称:bareos,代码行数:10,代码来源:dev.c
示例9: chlogif_parse_askkick
int chlogif_parse_askkick(int fd, struct char_session_data* sd){
if (RFIFOREST(fd) < 6)
return 0;
else {
DBMap* online_char_db = char_get_onlinedb();
DBMap* auth_db = char_get_authdb();
int aid = RFIFOL(fd,2);
struct online_char_data* character = (struct online_char_data*)idb_get(online_char_db, aid);
RFIFOSKIP(fd,6);
if( character != NULL )
{// account is already marked as online!
if( character->server > -1 )
{ //Kick it from the map server it is on.
mapif_disconnectplayer(map_server[character->server].fd, character->account_id, character->char_id, 2);
if (character->waiting_disconnect == INVALID_TIMER)
character->waiting_disconnect = add_timer(gettick()+AUTH_TIMEOUT, char_chardb_waiting_disconnect, character->account_id, 0);
}
else
{// Manual kick from char server.
struct char_session_data *tsd;
int i;
ARR_FIND( 0, fd_max, i, session[i] && (tsd = (struct char_session_data*)session[i]->session_data) && tsd->account_id == aid );
if( i < fd_max )
{
chclif_send_auth_result(i,2); //Send "Someone has already logged in with this id"
set_eof(i);
}
else // still moving to the map-server
char_set_char_offline(-1, aid);
}
}
idb_remove(auth_db, aid);// reject auth attempts from map-server
}
return 1;
}
开发者ID:Atemo,项目名称:rathena,代码行数:35,代码来源:char_logif.cpp
示例10: send_from_fifo
int send_from_fifo(int fd)
{
int len;
if( !session_isValid(fd) )
return -1;
if( session[fd]->wdata_size == 0 )
return 0; // nothing to send
len = sSend(fd, (const char *) session[fd]->wdata, (int)session[fd]->wdata_size, 0);
if( len == SOCKET_ERROR )
{//An exception has occured
if( sErrno != S_EWOULDBLOCK ) {
//ShowDebug("send_from_fifo: error %d, ending connection #%d\n", sErrno, fd);
session[fd]->wdata_size = 0; //Clear the send queue as we can't send anymore. [Skotlex]
set_eof(fd);
}
return 0;
}
if( len > 0 )
{
// some data could not be transferred?
// shift unsent data to the beginning of the queue
if( (size_t)len < session[fd]->wdata_size )
memmove(session[fd]->wdata, session[fd]->wdata + len, session[fd]->wdata_size - len);
session[fd]->wdata_size -= len;
}
return 0;
}
开发者ID:Anubiros,项目名称:adhara-project,代码行数:34,代码来源:socket.c
示例11: set_eof
/*
* Called to indicate that we have just read an EOF from the device.
*/
void generic_tape_device::set_ateof()
{
set_eof();
file++;
file_addr = 0;
file_size = 0;
block_num = 0;
}
开发者ID:aAnsgarWuestenhagen,项目名称:bareos,代码行数:11,代码来源:generic_tape_device.c
示例12: set_eof
/*
* Called to indicate that we have just read an
* EOF from the device.
*/
void DEVICE::set_ateof()
{
set_eof();
if (is_tape()) {
file++;
}
file_addr = 0;
file_size = 0;
block_num = 0;
}
开发者ID:prelegalwonder,项目名称:bacula,代码行数:14,代码来源:dev.c
示例13: chrif_changedsex
/*==========================================
* Request char server to change sex of char (modified by Yor)
*------------------------------------------*/
int chrif_changedsex(int fd) {
int acc, sex;
struct map_session_data *sd;
acc = RFIFOL(fd,2);
sex = RFIFOL(fd,6);
if ( battle_config.etc_log )
ShowNotice("chrif_changedsex %d.\n", acc);
sd = map_id2sd(acc);
if ( sd ) { //Normally there should not be a char logged on right now!
if ( sd->status.sex == sex )
return 0; //Do nothing? Likely safe.
sd->status.sex = !sd->status.sex;
// reset skill of some job
if ((sd->class_&MAPID_UPPERMASK) == MAPID_BARDDANCER) {
int i, idx = 0;
// remove specifical skills of Bard classes
for(i = 315; i <= 322; i++) {
idx = skill->get_index(i);
if (sd->status.skill[idx].id > 0 && sd->status.skill[idx].flag == SKILL_FLAG_PERMANENT) {
sd->status.skill_point += sd->status.skill[idx].lv;
sd->status.skill[idx].id = 0;
sd->status.skill[idx].lv = 0;
}
}
// remove specifical skills of Dancer classes
for(i = 323; i <= 330; i++) {
idx = skill->get_index(i);
if (sd->status.skill[idx].id > 0 && sd->status.skill[idx].flag == SKILL_FLAG_PERMANENT) {
sd->status.skill_point += sd->status.skill[idx].lv;
sd->status.skill[idx].id = 0;
sd->status.skill[idx].lv = 0;
}
}
clif->updatestatus(sd, SP_SKILLPOINT);
// change job if necessary
if (sd->status.sex) //Changed from Dancer
sd->status.class_ -= 1;
else //Changed from Bard
sd->status.class_ += 1;
//sd->class_ needs not be updated as both Dancer/Bard are the same.
}
// save character
sd->login_id1++; // change identify, because if player come back in char within the 5 seconds, he can change its characters
// do same modify in login-server for the account, but no in char-server (it ask again login_id1 to login, and don't remember it)
clif->message(sd->fd, msg_txt(409)); //"Your sex has been changed (need disconnection by the server)..."
set_eof(sd->fd); // forced to disconnect for the change
map_quit(sd); // Remove leftovers (e.g. autotrading) [Paradox924X]
}
return 0;
}
开发者ID:Shaktoh,项目名称:Hercules,代码行数:57,代码来源:chrif.c
示例14: pc_group_pc_load
/**
* Load permission for player based on group id
* @param sd Player
*/
void pc_group_pc_load(struct map_session_data * sd) {
GroupSettings *group = NULL;
if ((group = id2group(sd->group_id)) == NULL) {
ShowWarning("pc_group_pc_load: %s (AID:%d) logged in with unknown group id (%d)! kicking...\n",
sd->status.name,
sd->status.account_id,
sd->group_id);
set_eof(sd->fd);
return;
}
sd->permissions = group->e_permissions;
sd->group_pos = group->group_pos;
sd->group_level = group->level;
}
开发者ID:AsaK,项目名称:rathena,代码行数:18,代码来源:pc_groups.c
示例15: rewind_recording
void rewind_recording(
void)
{
if(replay.game_is_being_recorded)
{
/* This is unnecessary, because it is called from reset_player_queues, */
/* which is always called from revert_game */
set_eof(replay.recording_file_refnum, sizeof(struct recording_header));
set_fpos(replay.recording_file_refnum, sizeof(struct recording_header));
replay.header.length= sizeof(struct recording_header);
}
return;
}
开发者ID:DrItanium,项目名称:moo,代码行数:15,代码来源:vbl.c
示例16: chrif_accountban
/*==========================================
* Disconnection of a player (account has been banned of has a status, from login-server) by [Yor]
*------------------------------------------*/
int chrif_accountban(int fd)
{
int acc;
struct map_session_data *sd;
acc = RFIFOL(fd,2);
if (battle_config.etc_log)
ShowNotice("chrif_accountban %d.\n", acc);
sd = map_id2sd(acc);
if (acc < 0 || sd == NULL) {
ShowError("chrif_accountban failed - player not online.\n");
return 0;
}
sd->login_id1++; // change identify, because if player come back in char within the 5 seconds, he can change its characters
if (RFIFOB(fd,6) == 0) // 0: change of statut, 1: ban
{
switch (RFIFOL(fd,7)) { // status or final date of a banishment
case 1: clif_displaymessage(sd->fd, "Your account has 'Unregistered'."); break;
case 2: clif_displaymessage(sd->fd, "Your account has an 'Incorrect Password'..."); break;
case 3: clif_displaymessage(sd->fd, "Your account has expired."); break;
case 4: clif_displaymessage(sd->fd, "Your account has been rejected from server."); break;
case 5: clif_displaymessage(sd->fd, "Your account has been blocked by the GM Team."); break;
case 6: clif_displaymessage(sd->fd, "Your Game's EXE file is not the latest version."); break;
case 7: clif_displaymessage(sd->fd, "Your account has been prohibited to log in."); break;
case 8: clif_displaymessage(sd->fd, "Server is jammed due to over populated."); break;
case 9: clif_displaymessage(sd->fd, "Your account has not more authorised."); break;
case 100: clif_displaymessage(sd->fd, "Your account has been totally erased."); break;
default: clif_displaymessage(sd->fd, "Your account has not more authorised."); break;
}
}
else if (RFIFOB(fd,6) == 1) // 0: change of statut, 1: ban
{
time_t timestamp;
char tmpstr[2048];
timestamp = (time_t)RFIFOL(fd,7); // status or final date of a banishment
strcpy(tmpstr, "Your account has been banished until ");
strftime(tmpstr + strlen(tmpstr), 24, "%d-%m-%Y %H:%M:%S", localtime(×tamp));
clif_displaymessage(sd->fd, tmpstr);
}
set_eof(sd->fd); // forced to disconnect for the change
map_quit(sd); // Remove leftovers (e.g. autotrading) [Paradox924X]
return 0;
}
开发者ID:J4ND3RS0N,项目名称:Cronus-Emulator,代码行数:49,代码来源:chrif.c
示例17: chrif_accountban
/*==========================================
* Disconnection of a player (account has been banned of has a status, from login-server) by [Yor]
*------------------------------------------*/
int chrif_accountban(int fd)
{
int acc;
struct map_session_data *sd;
acc = RFIFOL(fd,2);
if (battle_config.etc_log)
ShowNotice("chrif_accountban %d.\n", acc);
sd = map_id2sd(acc);
if (acc < 0 || sd == NULL) {
ShowError("chrif_accountban failed - player not online.\n");
return 0;
}
sd->login_id1++; // change identify, because if player come back in char within the 5 seconds, he can change its characters
if (RFIFOB(fd,6) == 0) // 0: change of statut, 1: ban
{
switch (RFIFOL(fd,7)) { // status or final date of a banishment
case 1: clif_displaymessage(sd->fd, "Your account has 'Unregistered'."); break;
case 2: clif_displaymessage(sd->fd, "Senha incorreta..."); break;
case 3: clif_displaymessage(sd->fd, "Sua conta expirou."); break;
case 4: clif_displaymessage(sd->fd, "Sua conta foi rejeitada pelo map-server."); break;
case 5: clif_displaymessage(sd->fd, "Sua conta foi bloqueada pela staff do server."); break;
case 6: clif_displaymessage(sd->fd, "Seu EXE do jogo nуo estс na њltima versуo."); break;
case 7: clif_displaymessage(sd->fd, "Sua conta foi proibida de fazer login."); break;
case 8: clif_displaymessage(sd->fd, "Servidor estс lotado."); break;
case 9: clif_displaymessage(sd->fd, "Your account has not more authorised."); break;
case 100: clif_displaymessage(sd->fd, "Sua conta foi totalmente apagada."); break;
default: clif_displaymessage(sd->fd, "Your account has not more authorised."); break;
}
}
else if (RFIFOB(fd,6) == 1) // 0: change of statut, 1: ban
{
time_t timestamp;
char tmpstr[2048];
timestamp = (time_t)RFIFOL(fd,7); // status or final date of a banishment
strcpy(tmpstr, "Sua conta foi banida atщ ");
strftime(tmpstr + strlen(tmpstr), 24, "%d-%m-%Y %H:%M:%S", localtime(×tamp));
clif_displaymessage(sd->fd, tmpstr);
}
set_eof(sd->fd); // forced to disconnect for the change
map_quit(sd); // Remove leftovers (e.g. autotrading) [Paradox924X]
return 0;
}
开发者ID:soyandre,项目名称:Cronus,代码行数:49,代码来源:chrif.c
示例18: chrif_accountban
/*==========================================
* Disconnection of a player (account has been banned of has a status, from login-server) by [Yor]
*------------------------------------------*/
int chrif_accountban(int fd)
{
int acc;
struct map_session_data *sd;
acc = RFIFOL(fd,2);
if (battle_config.etc_log)
ShowNotice("chrif_accountban %d.\n", acc);
sd = map_id2sd(acc);
if (acc < 0 || sd == NULL) {
ShowError("chrif_accountban falhou - personagem nao encontrado.\n");
return 0;
}
sd->login_id1++; // change identify, because if player come back in char within the 5 seconds, he can change its characters
if (RFIFOB(fd,6) == 0) // 0: change of statut, 1: ban
{
switch (RFIFOL(fd,7)) { // status or final date of a banishment
case 1: clif_displaymessage(sd->fd, "Sua conta encontra-se 'N�o Registrada'."); break;
case 2: clif_displaymessage(sd->fd, "Sua conta encontra-se com a 'Senha Incorreta'..."); break;
case 3: clif_displaymessage(sd->fd, "Sua conta foi expirada."); break;
case 4: clif_displaymessage(sd->fd, "Sua conta foi rejeitada pelo servidor."); break;
case 5: clif_displaymessage(sd->fd, "Sua conta foi bloqueada pela Equipe de GMs."); break;
case 6: clif_displaymessage(sd->fd, "Seu execut�vel do jogo n�o encontra-se na �ltima vers�o."); break;
case 7: clif_displaymessage(sd->fd, "Sua conta est� proibida de se conectar."); break;
case 8: clif_displaymessage(sd->fd, "Servidor encontra-se lotado devido ao excesso de usu�rios."); break;
case 9: clif_displaymessage(sd->fd, "Sua conta n�o est� mais autorizada ao acesso."); break;
case 100: clif_displaymessage(sd->fd, "Sua conta foi totalmente apagada."); break;
default: clif_displaymessage(sd->fd, "Sua conta n�o est� mais autorizada ao acesso."); break;
}
}
else if (RFIFOB(fd,6) == 1) // 0: change of statut, 1: ban
{
time_t timestamp;
char tmpstr[2048];
timestamp = (time_t)RFIFOL(fd,7); // status or final date of a banishment
strcpy(tmpstr, "Sua conta foi banida at� ");
strftime(tmpstr + strlen(tmpstr), 24, "%d-%m-%Y %H:%M:%S", localtime(×tamp));
clif_displaymessage(sd->fd, tmpstr);
}
set_eof(sd->fd); // forced to disconnect for the change
map_quit(sd); // Remove leftovers (e.g. autotrading) [Paradox924X]
return 0;
}
开发者ID:JulioCF,项目名称:cronus-txt,代码行数:49,代码来源:chrif.c
示例19: send_from_fifo
int send_from_fifo(int fd)
{
ssize_t len;
if( !sockt->session_isValid(fd) )
return -1;
if( session[fd]->wdata_size == 0 )
return 0; // nothing to send
len = sSend(fd, (const char *) session[fd]->wdata, (int)session[fd]->wdata_size, MSG_NOSIGNAL);
if( len == SOCKET_ERROR )
{//An exception has occured
if( sErrno != S_EWOULDBLOCK ) {
//ShowDebug("send_from_fifo: %s, ending connection #%d\n", error_msg(), fd);
#ifdef SHOW_SERVER_STATS
socket_data_qo -= session[fd]->wdata_size;
#endif
session[fd]->wdata_size = 0; //Clear the send queue as we can't send anymore. [Skotlex]
set_eof(fd);
}
return 0;
}
if( len > 0 )
{
// some data could not be transferred?
// shift unsent data to the beginning of the queue
if( (size_t)len < session[fd]->wdata_size )
memmove(session[fd]->wdata, session[fd]->wdata + len, session[fd]->wdata_size - len);
session[fd]->wdata_size -= len;
#ifdef SHOW_SERVER_STATS
socket_data_o += len;
socket_data_qo -= len;
if (!session[fd]->flag.server)
{
socket_data_co += len;
}
#endif
}
return 0;
}
开发者ID:BlazingSpear,项目名称:Hercules,代码行数:45,代码来源:socket.c
示例20: channel_join
/**
* Make a player join a channel
* - Add player to channel user list
* - Add channel to user channel list
* @param channel: Channel data
* @param sd: Player data
* @return
* 0: Success
* -1: Invalid channel or player
* -2: Player already in channel
* -3: Player banned
* -4: Reached max limit
*/
int channel_join(struct Channel *channel, struct map_session_data *sd) {
if(!channel || !sd)
return -1;
if(sd->state.autotrade)
return 0; // fake success
if(channel_haspc(channel,sd)==1)
return -2;
if (!pc_has_permission(sd, PC_PERM_CHANNEL_ADMIN) && !channel_pccheckgroup(channel, sd->group_id))
return -2;
if(channel_haspcbanned(channel,sd)==1){
char output[CHAT_SIZE_MAX];
sprintf(output, msg_txt(sd,1438),channel->name); //You're currently banned from the '%s' channel.
clif_displaymessage(sd->fd, output);
return -3;
}
if (channel->type == CHAN_TYPE_PRIVATE && db_size(channel->users) >= channel_config.private_channel.max_member) {
char output[CHAT_SIZE_MAX];
sprintf(output, msg_txt(sd,760), channel->name, channel_config.private_channel.max_member); // You cannot join channel '%s'. Limit of %d has been met.
clif_displaymessage(sd->fd, output);
return -4;
}
RECREATE(sd->channels, struct Channel *, ++sd->channel_count);
sd->channels[ sd->channel_count - 1 ] = channel;
idb_put(channel->users, sd->status.char_id, sd);
RECREATE(sd->channel_tick, t_tick, sd->channel_count);
sd->channel_tick[sd->channel_count-1] = 0;
if( sd->stealth ) {
sd->stealth = false;
} else if( channel->opt & CHAN_OPT_ANNOUNCE_JOIN ) {
char output[CHAT_SIZE_MAX];
safesnprintf(output, CHAT_SIZE_MAX, msg_txt(sd,761), channel->alias, sd->status.name); // %s %s has joined.
clif_channel_msg(channel,output,channel->color);
}
/* someone is cheating, we kindly disconnect the bastard */
if( sd->channel_count > 200 ) {
set_eof(sd->fd);
}
return 0;
}
开发者ID:Atemo,项目名称:rathena,代码行数:58,代码来源:channel.cpp
注:本文中的set_eof函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论