Added rule type copy

This commit is contained in:
M66B
2019-05-18 08:34:26 +02:00
parent fcf5192ad8
commit 386f9cca17
4 changed files with 28 additions and 9 deletions

View File

@@ -84,6 +84,7 @@ public class EntityRule {
static final int TYPE_ANSWER = 4;
static final int TYPE_AUTOMATION = 5;
static final int TYPE_FLAG = 6;
static final int TYPE_COPY = 7;
static final String ACTION_AUTOMATION = BuildConfig.APPLICATION_ID + ".AUTOMATION";
static final String EXTRA_RULE = "rule";
@@ -213,6 +214,9 @@ public class EntityRule {
case TYPE_MOVE:
onActionMove(context, db, message, jaction);
break;
case TYPE_COPY:
onActionCopy(context, db, message, jaction);
break;
case TYPE_ANSWER:
onActionAnswer(context, db, message, jaction);
break;
@@ -235,6 +239,11 @@ public class EntityRule {
EntityOperation.queue(context, db, message, EntityOperation.MOVE, target, false);
}
private void onActionCopy(Context context, DB db, EntityMessage message, JSONObject jargs) throws JSONException {
long target = jargs.getLong("target");
EntityOperation.queue(context, db, message, EntityOperation.COPY, target, false);
}
private void onActionAnswer(Context context, DB db, EntityMessage message, JSONObject jargs) throws JSONException, IOException {
long iid = jargs.getLong("identity");
long aid = jargs.getLong("answer");