1
0
mirror of https://github.com/fabianonline/telegram_backup.git synced 2024-12-26 06:45:33 +00:00

removes basically all code. Fresh start.

This commit is contained in:
Fabian Schlenz 2016-06-29 11:01:26 +02:00
parent 3f5fd7787c
commit a7caf248a3
2 changed files with 0 additions and 72 deletions

View File

@ -1,37 +1,7 @@
package de.fabianonline.telegram_backup;
import de.fabianonline.telegram_backup.MyStorage;
import org.telegram.api.engine.AppInfo;
import org.telegram.api.engine.ApiCallback;
import org.telegram.api.engine.TelegramApi;
import org.telegram.api.TLConfig;
import org.telegram.api.TLAbsUpdates;
import org.telegram.api.requests.*;
import java.io.IOException;
public class Main {
public static void main(String[] args) {
System.out.println("Hello World");
MyStorage storage = new MyStorage();
AppInfo appinfo = new AppInfo(32860, "Desktop", "0.0.1", "0.0.1", "EN");
ApiCallback callback = new ApiCallback() {
public void onApiDies(TelegramApi api) { System.out.println("onApiDies"); }
public void onUpdatesInvalidated(TelegramApi api) { System.out.println("onUpdatesInvalidated"); }
public void onUpdate(TLAbsUpdates updates) { System.out.println("onUpdate"); }
public void onAuthCancelled(TelegramApi api) { System.out.println("onAuthCancelled"); }
};
TelegramApi api = new TelegramApi(storage, appinfo, callback);
try {
TLConfig config = api.doRpcCall(new TLRequestHelpGetConfig());
} catch(IOException ex) {
System.out.println("IOException caught.");
}
}
}

View File

@ -1,42 +0,0 @@
package de.fabianonline.telegram_backup;
import org.telegram.api.engine.storage.AbsApiState;
import org.telegram.api.TLConfig;
import org.telegram.mtproto.state.AbsMTProtoState;
import org.telegram.mtproto.state.ConnectionInfo;
import org.telegram.mtproto.state.KnownSalt;
import java.util.HashMap;
public class MyStorage implements AbsApiState {
private int primaryDc = 2;
private HashMap<Integer, Boolean> isAuthenticated = new HashMap<Integer, Boolean>();
private HashMap<Integer, byte[]> authKeys = new HashMap<Integer, byte[]>();
public int getPrimaryDc() { return primaryDc; }
public void setPrimaryDc(int newDc) { this.primaryDc = newDc; }
public boolean isAuthenticated(int dc) {
boolean temp = this.isAuthenticated.get(dc);
if (temp) return true;
return false;
}
public void setAuthenticated(int dc, boolean val) { this.isAuthenticated.put(dc, val); }
public void updateSettings(TLConfig config) { System.out.println("Call to updateSettings"); }
public byte[] getAuthKey(int dc) { return this.authKeys.get(dc); }
public void putAuthKey(int dc, byte[] key) { this.authKeys.put(dc, key); }
public ConnectionInfo[] getAvailableConnections(int dc) {
switch(dc) {
case 2: return new ConnectionInfo[]{new ConnectionInfo(1, 1, "149.154.167.50", 443)};
}
return new ConnectionInfo[0];
}
public AbsMTProtoState getMtProtoState(int dc) { System.out.println("Call to getMtProtoState"); return null; }
public void resetAuth() { this.isAuthenticated.clear(); this.authKeys.clear(); }
public void reset() { this.resetAuth(); this.primaryDc=2; }
}