Skip to content

Commit

Permalink
Added set_piece_hashes session method with alert.
Browse files Browse the repository at this point in the history
  • Loading branch information
aldenml committed Feb 27, 2015
1 parent 22386af commit 2f73962
Show file tree
Hide file tree
Showing 13 changed files with 545 additions and 2,081 deletions.
Binary file modified libjlibtorrent.dylib
Binary file not shown.
1 change: 1 addition & 0 deletions src/com/frostwire/jlibtorrent/Session.java
Original file line number Diff line number Diff line change
Expand Up @@ -1034,6 +1034,7 @@ private static Map<Integer, CastAlertFunction> buildCastAlertTable() {
CAST_ALERT_METHOD(dht_stats_alert.class, map);

CAST_ALERT_METHOD(dht_get_peers_reply_alert.class, map);
CAST_ALERT_METHOD(set_piece_hashes_alert.class, map);

return Collections.unmodifiableMap(map);
}
Expand Down
1 change: 1 addition & 0 deletions src/com/frostwire/jlibtorrent/alerts/AlertType.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public enum AlertType {
LSD_ERROR(lsd_error_alert.alert_type),
DHT_STATS(dht_stats_alert.alert_type),
DHT_GET_PEERS_REPLY_ALERT(dht_get_peers_reply_alert.alert_type),
SET_PIECE_HASHES(set_piece_hashes_alert.alert_type),
UNKNOWN(-1),
TORRENT_PRIORITIZE(-2);

Expand Down
26 changes: 26 additions & 0 deletions src/com/frostwire/jlibtorrent/alerts/SetPieceHashesAlert.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.frostwire.jlibtorrent.alerts;

import com.frostwire.jlibtorrent.swig.set_piece_hashes_alert;

/**
* @author gubatron
* @author aldenml
*/
public final class SetPieceHashesAlert extends AbstractAlert<set_piece_hashes_alert> {

public SetPieceHashesAlert(set_piece_hashes_alert alert) {
super(alert);
}

public String getId() {
return alert.getId();
}

public int getProgress() {
return alert.getProgress();
}

public int getNumPieces() {
return alert.getNum_pieces();
}
}
5 changes: 5 additions & 0 deletions src/com/frostwire/jlibtorrent/swig/alert.java
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,11 @@ public static dht_get_peers_reply_alert cast_to_dht_get_peers_reply_alert(alert
return (cPtr == 0) ? null : new dht_get_peers_reply_alert(cPtr, false);
}

public static set_piece_hashes_alert cast_to_set_piece_hashes_alert(alert alert) {
long cPtr = libtorrent_jni.alert_cast_to_set_piece_hashes_alert(alert.getCPtr(alert), alert);
return (cPtr == 0) ? null : new set_piece_hashes_alert(cPtr, false);
}

public enum category_t {
error_notification(libtorrent_jni.alert_error_notification_get()),
peer_notification(libtorrent_jni.alert_peer_notification_get()),
Expand Down
17 changes: 17 additions & 0 deletions src/com/frostwire/jlibtorrent/swig/libtorrent_jni.java
Original file line number Diff line number Diff line change
Expand Up @@ -1568,6 +1568,7 @@ public class libtorrent_jni {
public final static native long alert_cast_to_lsd_error_alert(long jarg1, alert jarg1_);
public final static native long alert_cast_to_dht_stats_alert(long jarg1, alert jarg1_);
public final static native long alert_cast_to_dht_get_peers_reply_alert(long jarg1, alert jarg1_);
public final static native long alert_cast_to_set_piece_hashes_alert(long jarg1, alert jarg1_);
public final static native String operation_name(int jarg1);
public final static native int user_alert_id_get();
public final static native int torrent_alert_alert_type_get();
Expand Down Expand Up @@ -3205,6 +3206,7 @@ public class libtorrent_jni {
public final static native void session_dht_get_peers(long jarg1, session jarg1_, long jarg2, sha1_hash jarg2_);
public final static native void session_dht_announce__SWIG_0(long jarg1, session jarg1_, long jarg2, sha1_hash jarg2_, int jarg3, int jarg4);
public final static native void session_dht_announce__SWIG_1(long jarg1, session jarg1_, long jarg2, sha1_hash jarg2_);
public final static native void session_set_piece_hashes_with_progress(long jarg1, session jarg1_, String jarg2, long jarg3, create_torrent jarg3_, String jarg4, long jarg5, error_code jarg5_);
public final static native void pool_file_status_file_index_set(long jarg1, pool_file_status jarg1_, int jarg2);
public final static native int pool_file_status_file_index_get(long jarg1, pool_file_status jarg1_);
public final static native void pool_file_status_last_use_set(long jarg1, pool_file_status jarg1_, long jarg2, ptime jarg2_);
Expand Down Expand Up @@ -3367,6 +3369,20 @@ public class libtorrent_jni {
public final static native void dht_get_peers_reply_alert_peers_set(long jarg1, dht_get_peers_reply_alert jarg1_, long jarg2, tcp_endpoint_vector jarg2_);
public final static native long dht_get_peers_reply_alert_peers_get(long jarg1, dht_get_peers_reply_alert jarg1_);
public final static native void delete_dht_get_peers_reply_alert(long jarg1);
public final static native long new_set_piece_hashes_alert(String jarg1, int jarg2, int jarg3);
public final static native int set_piece_hashes_alert_alert_type_get();
public final static native int set_piece_hashes_alert_type(long jarg1, set_piece_hashes_alert jarg1_);
public final static native int set_piece_hashes_alert_category(long jarg1, set_piece_hashes_alert jarg1_);
public final static native String set_piece_hashes_alert_what(long jarg1, set_piece_hashes_alert jarg1_);
public final static native int set_piece_hashes_alert_static_category_get();
public final static native String set_piece_hashes_alert_message(long jarg1, set_piece_hashes_alert jarg1_);
public final static native void set_piece_hashes_alert_id_set(long jarg1, set_piece_hashes_alert jarg1_, String jarg2);
public final static native String set_piece_hashes_alert_id_get(long jarg1, set_piece_hashes_alert jarg1_);
public final static native void set_piece_hashes_alert_progress_set(long jarg1, set_piece_hashes_alert jarg1_, int jarg2);
public final static native int set_piece_hashes_alert_progress_get(long jarg1, set_piece_hashes_alert jarg1_);
public final static native void set_piece_hashes_alert_num_pieces_set(long jarg1, set_piece_hashes_alert jarg1_, int jarg2);
public final static native int set_piece_hashes_alert_num_pieces_get(long jarg1, set_piece_hashes_alert jarg1_);
public final static native void delete_set_piece_hashes_alert(long jarg1);
public final static native boolean sha1_bloom_filter_find(long jarg1, sha1_bloom_filter jarg1_, long jarg2, sha1_hash jarg2_);
public final static native void sha1_bloom_filter_set(long jarg1, sha1_bloom_filter jarg1_, long jarg2, sha1_hash jarg2_);
public final static native String sha1_bloom_filter_to_string(long jarg1, sha1_bloom_filter jarg1_);
Expand Down Expand Up @@ -3486,4 +3502,5 @@ public class libtorrent_jni {
public final static native long peer_connection_SWIGSmartPtrUpcast(long jarg1);
public final static native long web_seed_t_SWIGUpcast(long jarg1);
public final static native long dht_get_peers_reply_alert_SWIGUpcast(long jarg1);
public final static native long set_piece_hashes_alert_SWIGUpcast(long jarg1);
}
4 changes: 4 additions & 0 deletions src/com/frostwire/jlibtorrent/swig/session.java
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,10 @@ public void dht_announce(sha1_hash info_hash) {
libtorrent_jni.session_dht_announce__SWIG_1(swigCPtr, this, sha1_hash.getCPtr(info_hash), info_hash);
}

public void set_piece_hashes_with_progress(String id, create_torrent t, String p, error_code ec) {
libtorrent_jni.session_set_piece_hashes_with_progress(swigCPtr, this, id, create_torrent.getCPtr(t), t, p, error_code.getCPtr(ec), ec);
}

public enum save_state_flags_t {
save_settings(libtorrent_jni.session_save_settings_get()),
save_dht_settings(libtorrent_jni.session_save_dht_settings_get()),
Expand Down
84 changes: 84 additions & 0 deletions src/com/frostwire/jlibtorrent/swig/set_piece_hashes_alert.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.5
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */

package com.frostwire.jlibtorrent.swig;

public class set_piece_hashes_alert extends alert {
private long swigCPtr;

protected set_piece_hashes_alert(long cPtr, boolean cMemoryOwn) {
super(libtorrent_jni.set_piece_hashes_alert_SWIGUpcast(cPtr), cMemoryOwn);
swigCPtr = cPtr;
}

protected static long getCPtr(set_piece_hashes_alert obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}

protected void finalize() {
delete();
}

public synchronized void delete() {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
libtorrent_jni.delete_set_piece_hashes_alert(swigCPtr);
}
swigCPtr = 0;
}
super.delete();
}

public set_piece_hashes_alert(String id, int progress, int num_pieces) {
this(libtorrent_jni.new_set_piece_hashes_alert(id, progress, num_pieces), true);
}

public int type() {
return libtorrent_jni.set_piece_hashes_alert_type(swigCPtr, this);
}

public int category() {
return libtorrent_jni.set_piece_hashes_alert_category(swigCPtr, this);
}

public String what() {
return libtorrent_jni.set_piece_hashes_alert_what(swigCPtr, this);
}

public String message() {
return libtorrent_jni.set_piece_hashes_alert_message(swigCPtr, this);
}

public void setId(String value) {
libtorrent_jni.set_piece_hashes_alert_id_set(swigCPtr, this, value);
}

public String getId() {
return libtorrent_jni.set_piece_hashes_alert_id_get(swigCPtr, this);
}

public void setProgress(int value) {
libtorrent_jni.set_piece_hashes_alert_progress_set(swigCPtr, this, value);
}

public int getProgress() {
return libtorrent_jni.set_piece_hashes_alert_progress_get(swigCPtr, this);
}

public void setNum_pieces(int value) {
libtorrent_jni.set_piece_hashes_alert_num_pieces_set(swigCPtr, this, value);
}

public int getNum_pieces() {
return libtorrent_jni.set_piece_hashes_alert_num_pieces_get(swigCPtr, this);
}

public final static int alert_type = libtorrent_jni.set_piece_hashes_alert_alert_type_get();
public final static int static_category = libtorrent_jni.set_piece_hashes_alert_static_category_get();
}

0 comments on commit 2f73962

Please sign in to comment.