Search in sources :

Example 1 with AbuseSeverity

use of net.i2p.data.i2cp.AbuseSeverity in project i2p.i2p by i2p.

the class I2CPMessageProducer method reportAbuse.

/**
 * Send an abuse message to the router
 */
public void reportAbuse(I2PSessionImpl session, int msgId, int severity) throws I2PSessionException {
    ReportAbuseMessage msg = new ReportAbuseMessage();
    MessageId id = new MessageId();
    id.setMessageId(msgId);
    msg.setMessageId(id);
    AbuseReason reason = new AbuseReason();
    reason.setReason("Not specified");
    msg.setReason(reason);
    AbuseSeverity sv = new AbuseSeverity();
    sv.setSeverity(severity);
    msg.setSeverity(sv);
    session.sendMessage(msg);
}
Also used : ReportAbuseMessage(net.i2p.data.i2cp.ReportAbuseMessage) AbuseSeverity(net.i2p.data.i2cp.AbuseSeverity) AbuseReason(net.i2p.data.i2cp.AbuseReason) MessageId(net.i2p.data.i2cp.MessageId)

Example 2 with AbuseSeverity

use of net.i2p.data.i2cp.AbuseSeverity in project i2p.i2p by i2p.

the class ReportAbuseJob method runJob.

public void runJob() {
    if (_runner.isDead())
        return;
    AbuseReason res = new AbuseReason();
    res.setReason(_reason);
    AbuseSeverity sev = new AbuseSeverity();
    sev.setSeverity(_severity);
    ReportAbuseMessage msg = new ReportAbuseMessage();
    msg.setReason(res);
    SessionId id = _runner.getSessionId(_dest.calculateHash());
    if (id == null)
        return;
    msg.setSessionId(id);
    msg.setSeverity(sev);
    try {
        _runner.doSend(msg);
    } catch (I2CPMessageException ime) {
        _log.error("Error reporting abuse", ime);
    }
}
Also used : I2CPMessageException(net.i2p.data.i2cp.I2CPMessageException) AbuseSeverity(net.i2p.data.i2cp.AbuseSeverity) ReportAbuseMessage(net.i2p.data.i2cp.ReportAbuseMessage) AbuseReason(net.i2p.data.i2cp.AbuseReason) SessionId(net.i2p.data.i2cp.SessionId)

Aggregations

AbuseReason (net.i2p.data.i2cp.AbuseReason)2 AbuseSeverity (net.i2p.data.i2cp.AbuseSeverity)2 ReportAbuseMessage (net.i2p.data.i2cp.ReportAbuseMessage)2 I2CPMessageException (net.i2p.data.i2cp.I2CPMessageException)1 MessageId (net.i2p.data.i2cp.MessageId)1 SessionId (net.i2p.data.i2cp.SessionId)1