From 4f6c0c8dd971dfd2ea2bb67854f77c2b7366e608 Mon Sep 17 00:00:00 2001 From: Matteo Bitussi Date: Fri, 15 Sep 2023 13:07:11 +0200 Subject: [PATCH] fixed bug in using variables --- tool/src/main/java/migt/Operation.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/tool/src/main/java/migt/Operation.java b/tool/src/main/java/migt/Operation.java index 3919e38..fcacf1d 100644 --- a/tool/src/main/java/migt/Operation.java +++ b/tool/src/main/java/migt/Operation.java @@ -366,8 +366,24 @@ public Operation_API getAPI() { // TODO: the api should be updated i.e. if the message is edited before making it available } + /** + * Sets the api of this Operation with the given api. Note that the variables are added, not substituted + * @param api the new api to be set + */ public void setAPI(Operation_API api) { - this.api = api; + if (this.api == null) { + this.api = api; + } else { + this.api.message = api.message; + this.api.is_request = api.is_request; + + // update all variables + for (Var v : api.vars) { + if (!this.api.vars.contains(v)) { + this.api.vars.add(v); + } + } + } // add the intercepted message to the matched messages to be displayed if (!matchedMessages.contains(api.message)) {