mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 06:06:10 -04:00
load/save of banlist comments. Removed unused menu entries. Added auto-fill of input fields on sleection
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8343 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
25c0dfe69e
commit
777c915be2
7 changed files with 74 additions and 26 deletions
|
@ -43,7 +43,8 @@ void RsTlvBanListEntry::TlvClear()
|
|||
addr.TlvClear();
|
||||
level = 0;
|
||||
reason = 0;
|
||||
age = 0;
|
||||
age = 0;
|
||||
comment.clear();
|
||||
}
|
||||
|
||||
uint32_t RsTlvBanListEntry::TlvSize() const
|
||||
|
@ -55,6 +56,7 @@ uint32_t RsTlvBanListEntry::TlvSize() const
|
|||
s += 4; // reason;
|
||||
s += 4; // age;
|
||||
s += 1; // masked_bytes;
|
||||
s += GetTlvStringSize(comment) ;
|
||||
|
||||
return s;
|
||||
|
||||
|
@ -81,6 +83,7 @@ bool RsTlvBanListEntry::SetTlv(void *data, uint32_t size, uint32_t *offset) con
|
|||
ok &= setRawUInt32(data, tlvend, offset, reason);
|
||||
ok &= setRawUInt32(data, tlvend, offset, age);
|
||||
ok &= setRawUInt8(data, tlvend, offset, masked_bytes);
|
||||
ok &= SetTlvString(data, tlvend, offset, TLV_TYPE_STR_COMMENT, comment);
|
||||
|
||||
return ok;
|
||||
|
||||
|
@ -118,6 +121,7 @@ bool RsTlvBanListEntry::GetTlv(void *data, uint32_t size, uint32_t *offset)
|
|||
uint8_t tmp ;
|
||||
ok &= getRawUInt8(data, tlvend, offset, &(tmp));
|
||||
masked_bytes = tmp ;
|
||||
ok &= GetTlvString(data, tlvend, offset, TLV_TYPE_STR_COMMENT, comment);
|
||||
|
||||
/***************************************************************************
|
||||
* NB: extra components could be added (for future expansion of the type).
|
||||
|
|
|
@ -52,6 +52,7 @@ virtual std::ostream &print(std::ostream &out, uint16_t indent) const;
|
|||
uint32_t reason;
|
||||
uint32_t age;
|
||||
uint8_t masked_bytes ;
|
||||
std::string comment ;
|
||||
};
|
||||
|
||||
typedef t_RsTlvList<RsTlvBanListEntry,TLV_TYPE_BAN_LIST> RsTlvBanList;
|
||||
|
|
|
@ -226,7 +226,8 @@ const uint16_t TLV_TYPE_DSDV_ENDPOINT = 0x1080;
|
|||
const uint16_t TLV_TYPE_DSDV_ENTRY = 0x1081;
|
||||
const uint16_t TLV_TYPE_DSDV_ENTRY_SET= 0x1082;
|
||||
|
||||
const uint16_t TLV_TYPE_BAN_ENTRY = 0x1090;
|
||||
const uint16_t TLV_TYPE_BAN_ENTRY_dep = 0x1090;
|
||||
const uint16_t TLV_TYPE_BAN_ENTRY = 0x1092;
|
||||
const uint16_t TLV_TYPE_BAN_LIST = 0x1091;
|
||||
|
||||
const uint16_t TLV_TYPE_MSG_ADDRESS = 0x10A0;
|
||||
|
|
|
@ -141,9 +141,10 @@ BanListPeer::BanListPeer()
|
|||
void BanListPeer::toRsTlvBanListEntry(RsTlvBanListEntry &e) const
|
||||
{
|
||||
e.addr.addr = addr;
|
||||
e.level = level;
|
||||
e.reason = reason;
|
||||
e.masked_bytes = masked_bytes;
|
||||
e.reason = reason;
|
||||
e.level = level;
|
||||
e.comment = comment;
|
||||
e.age = time(NULL) - mTs;
|
||||
}
|
||||
|
||||
|
@ -155,8 +156,8 @@ void BanListPeer::fromRsTlvBanListEntry(const RsTlvBanListEntry &e)
|
|||
level = e.level; // LOCAL, FRIEND, FoF.
|
||||
state = true; // true=>active, false=>just stored but inactive
|
||||
connect_attempts = 0; // recorded by the BanList service
|
||||
comment = e.comment; // recorded by the BanList service
|
||||
mTs = time(NULL) - e.age;
|
||||
comment.clear() ; //
|
||||
}
|
||||
|
||||
static sockaddr_storage makeBitsRange(const sockaddr_storage& addr,int masked_bytes)
|
||||
|
@ -409,6 +410,8 @@ void p3BanList::addIpRange(const sockaddr_storage &addr, int masked_bytes,uint32
|
|||
std::cerr << "(EE) Cannot add IP range. Bad list_type. Should be eiter RSBANLIST_CHECKING_FLAGS_BLACKLIST or RSBANLIST_CHECKING_FLAGS_WHITELIST" << std::endl;
|
||||
|
||||
IndicateConfigChanged() ;
|
||||
|
||||
condenseBanSources_locked() ;
|
||||
}
|
||||
|
||||
int p3BanList::tick()
|
||||
|
@ -1026,6 +1029,7 @@ int p3BanList::sendBanSet(const RsPeerId& peerid)
|
|||
RsTlvBanListEntry bi;
|
||||
it->second.toRsTlvBanListEntry(bi) ;
|
||||
|
||||
bi.comment.clear() ; // don't send comments.
|
||||
item->peerList.mList.push_back(bi);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue