Example #1
0
File: inter.cpp Project: mrktj/tmwa
RecvResult mapif_parse_WisRequest(Session *sms)
{
    Packet_Head<0x3001> head;
    AString repeat;
    RecvResult rv = recv_vpacket<0x3001, 52, 1>(sms, head, repeat);
    if (rv != RecvResult::Complete)
        return rv;

    CharName from = head.from_char_name;
    CharName to = head.to_char_name;

    // search if character exists before to ask all map-servers
    const CharPair *mcs = search_character(to);
    if (!mcs)
    {
        Packet_Fixed<0x3802> fixed_02;
        fixed_02.sender_char_name = from;
        fixed_02.flag = 1;    // flag: 0: success to send wisper, 1: target character is not loged in?, 2: ignored by target
        send_fpacket<0x3802, 27>(sms, fixed_02);
        // Character exists. So, ask all map-servers
    }
    else
    {
        // to be sure of the correct name, rewrite it
        to = mcs->key.name;
        // if source is destination, don't ask other servers.
        if (from == to)
        {
            Packet_Fixed<0x3802> fixed_02;
            fixed_02.sender_char_name = from;
            fixed_02.flag = 1;    // flag: 0: success to send wisper, 1: target character is not loged in?, 2: ignored by target
            send_fpacket<0x3802, 27>(sms, fixed_02);
        }
        else
        {
            Session *tms = server_for(mcs); // for to
            AString& msg = repeat;
            if (tms)
            {
                mapif_wis_message(tms, from, to, msg);
            }
            else
            {
                mapif_wis_end(sms, from, 1);
            }
        }
    }

    return rv;
}
Example #2
0
// Wisp/page transmission result
int mapif_parse_WisReply(int fd) {
    int id = RFIFOL(fd,2), flag = RFIFOB(fd,6);
    struct WisData *wd = idb_get(wis_db, id);

    if (wd == NULL)
        return 0;	// This wisp was probably suppress before, because it was timeout of because of target was found on another map-server

    if ((--wd->count) <= 0 || flag != 1) {
        mapif_wis_end(wd, flag); // flag: 0: success to send wisper, 1: target character is not loged in?, 2: ignored by target
        idb_remove(wis_db, id);
    }

    return 0;
}
Example #3
0
// Wis送信結果
int mapif_parse_WisReply(int fd)
{
	int id=RFIFOW(fd,2),flag=RFIFOB(fd,4);
	
	struct WisList* wl=search_wislist(id);
	
	if(wl==NULL){
		RFIFOSKIP(fd,5);
		return 0;	// タイムアウトしたかIDが存在しない
	}
	
	if((--wl->count)==0 || flag!=1){
		// 全鯖終わったか、ある鯖から終了する結果が返った
		mapif_wis_end(wl,flag);
		del_wislist(wl->id);
	}
	
	return 0;
}
Example #4
0
File: inter.cpp Project: mrktj/tmwa
RecvResult mapif_parse_WisReply(Session *tms)
{
    Packet_Fixed<0x3002> fixed;
    RecvResult rv = recv_fpacket<0x3002, 7>(tms, fixed);
    if (rv != RecvResult::Complete)
        return rv;

    CharId id = fixed.char_id;
    uint8_t flag = fixed.flag;

    const CharPair *smcs = search_character_id(id);
    CharName from = smcs->key.name;
    Session *sms = server_for(smcs);

    if (sms)
    {
        mapif_wis_end(sms, from, flag);   // flag: 0: success to send wisper, 1: target character is not loged in?, 2: ignored by target
    }

    return rv;
}