Beispiel #1
0
  public void invoke(String name, TL.Object obj) {
    Method m;
    try {
      m = MTProto.class.getDeclaredMethod("TL_" + name.replace(".", "_"), TL.Object.class);
      m.setAccessible(true);
    } catch (Exception e) {
      Common.logWarning("not handled: Main::" + name);
      return;
    }

    try {
      Common.logInfo("invoke: Main::" + name);
      m.invoke(this, obj);
    } catch (Exception e) {
      Common.logError("invoke error in Main");
      e.printStackTrace();
    }
  }
Beispiel #2
0
  private void process(TL.Object obj) {
    //		if (obj instanceof TL.Vector)
    //			return;
    Method m;
    try {
      m = MTProto.class.getDeclaredMethod("TL_" + obj.type.replace(".", "_"), TL.Object.class);
      m.setAccessible(true);
    } catch (Exception e) {
      Common.logWarning("not handled: " + obj.type + " (" + obj.name + ")");
      return;
    }

    try {
      Common.logInfo("invoke: " + obj.type + " (" + obj.name + ")");
      m.invoke(this, obj);
    } catch (Exception e) {
      Common.logError("process error");
      e.printStackTrace();
    }
  }