Skip to content
Snippets Groups Projects
Commit 06d7bc8d authored by Janne Mareike Koschinski's avatar Janne Mareike Koschinski
Browse files

Fixed invocation issues

parent eae6b238
No related branches found
No related tags found
No related merge requests found
Showing
with 385 additions and 172 deletions
...@@ -61,4 +61,6 @@ public interface BacklogStorage { ...@@ -61,4 +61,6 @@ public interface BacklogStorage {
Set<BacklogFilter> getFilters(); Set<BacklogFilter> getFilters();
void setMarkerLine(@IntRange(from = 0) int buffer, int msgId); void setMarkerLine(@IntRange(from = 0) int buffer, int msgId);
void merge(@IntRange(from = 0) int buffer1, @IntRange(from = 0) int buffer2);
} }
...@@ -214,6 +214,11 @@ public class HybridBacklogStorage implements BacklogStorage { ...@@ -214,6 +214,11 @@ public class HybridBacklogStorage implements BacklogStorage {
} }
} }
@Override
public void merge(@IntRange(from = 0) int buffer1, @IntRange(from = 0) int buffer2) {
SQLite.update(Message.class).set(Message_Table.bufferInfo_id.eq(buffer1)).where(Message_Table.bufferInfo_id.eq(buffer2)).execute();
}
private void ensureExisting(@IntRange(from = -1) int bufferId) { private void ensureExisting(@IntRange(from = -1) int bufferId) {
assertNotNull(client); assertNotNull(client);
if (backlogs.get(bufferId) == null) { if (backlogs.get(bufferId) == null) {
......
...@@ -160,6 +160,7 @@ public class BufferSyncer extends ABufferSyncer { ...@@ -160,6 +160,7 @@ public class BufferSyncer extends ABufferSyncer {
@Override @Override
public void _mergeBuffersPermanently(int buffer1, int buffer2) { public void _mergeBuffersPermanently(int buffer1, int buffer2) {
client.backlogStorage().merge(buffer1, buffer2);
_removeBuffer(buffer2); _removeBuffer(buffer2);
} }
......
...@@ -235,6 +235,7 @@ public interface QNetwork extends QObservable<QNetwork> { ...@@ -235,6 +235,7 @@ public interface QNetwork extends QObservable<QNetwork> {
void setUseSasl(boolean useSasl); void setUseSasl(boolean useSasl);
void setSaslPassword(final String saslPassword); void setSaslPassword(final String saslPassword);
void _setUseSasl(boolean useSasl); void _setUseSasl(boolean useSasl);
@Synced @Synced
...@@ -243,7 +244,6 @@ public interface QNetwork extends QObservable<QNetwork> { ...@@ -243,7 +244,6 @@ public interface QNetwork extends QObservable<QNetwork> {
void _setSaslAccount(final String saslAccount); void _setSaslAccount(final String saslAccount);
@Synced @Synced
void _setSaslPassword(final String saslPassword); void _setSaslPassword(final String saslPassword);
@Synced @Synced
......
...@@ -23,6 +23,7 @@ package de.kuschku.libquassel.syncables.types.invokers; ...@@ -23,6 +23,7 @@ package de.kuschku.libquassel.syncables.types.invokers;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import de.kuschku.libquassel.exceptions.SyncInvocationException;
import de.kuschku.libquassel.functions.types.SyncFunction; import de.kuschku.libquassel.functions.types.SyncFunction;
import de.kuschku.libquassel.syncables.types.interfaces.QAliasManager; import de.kuschku.libquassel.syncables.types.interfaces.QAliasManager;
...@@ -39,14 +40,19 @@ public class IAliasManager implements Invoker<QAliasManager> { ...@@ -39,14 +40,19 @@ public class IAliasManager implements Invoker<QAliasManager> {
} }
@Override @Override
public void invoke(SyncFunction function, QAliasManager obj) { public void invoke(SyncFunction function, QAliasManager obj) throws SyncInvocationException {
switch (function.methodName) { switch (function.methodName) {
case "addAlias": { case "addAlias": {
obj._addAlias((String) function.params.get(0), (String) function.params.get(1)); obj._addAlias((String) function.params.get(0), (String) function.params.get(1));
} break; }
break;
case "update": { case "update": {
InvokerHelper.update(obj, function.params.get(0)); InvokerHelper.update(obj, function.params.get(0));
} break; }
break;
default: {
throw new SyncInvocationException(function.className + "::" + function.methodName);
}
} }
} }
} }
...@@ -25,6 +25,7 @@ import android.support.annotation.NonNull; ...@@ -25,6 +25,7 @@ import android.support.annotation.NonNull;
import java.util.List; import java.util.List;
import de.kuschku.libquassel.exceptions.SyncInvocationException;
import de.kuschku.libquassel.functions.types.SyncFunction; import de.kuschku.libquassel.functions.types.SyncFunction;
import de.kuschku.libquassel.message.Message; import de.kuschku.libquassel.message.Message;
import de.kuschku.libquassel.syncables.types.interfaces.QBacklogManager; import de.kuschku.libquassel.syncables.types.interfaces.QBacklogManager;
...@@ -42,17 +43,23 @@ public class IBacklogManager implements Invoker<QBacklogManager> { ...@@ -42,17 +43,23 @@ public class IBacklogManager implements Invoker<QBacklogManager> {
} }
@Override @Override
public void invoke(SyncFunction function, QBacklogManager obj) { public void invoke(SyncFunction function, QBacklogManager obj) throws SyncInvocationException {
switch (function.methodName) { switch (function.methodName) {
case "receiveBacklog": { case "receiveBacklog": {
obj._receiveBacklog((int) function.params.get(0), (int) function.params.get(1), (int) function.params.get(2), (int) function.params.get(3), (int) function.params.get(4), (List<Message>) function.params.get(5)); obj._receiveBacklog((int) function.params.get(0), (int) function.params.get(1), (int) function.params.get(2), (int) function.params.get(3), (int) function.params.get(4), (List<Message>) function.params.get(5));
} break; }
break;
case "receiveBacklogAll": { case "receiveBacklogAll": {
obj._receiveBacklogAll((int) function.params.get(0), (int) function.params.get(1), (int) function.params.get(2), (int) function.params.get(3), (List<Message>) function.params.get(4)); obj._receiveBacklogAll((int) function.params.get(0), (int) function.params.get(1), (int) function.params.get(2), (int) function.params.get(3), (List<Message>) function.params.get(4));
} break; }
break;
case "update": { case "update": {
InvokerHelper.update(obj, function.params.get(0)); InvokerHelper.update(obj, function.params.get(0));
} break; }
break;
default: {
throw new SyncInvocationException(function.className + "::" + function.methodName);
}
} }
} }
} }
...@@ -23,6 +23,7 @@ package de.kuschku.libquassel.syncables.types.invokers; ...@@ -23,6 +23,7 @@ package de.kuschku.libquassel.syncables.types.invokers;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import de.kuschku.libquassel.exceptions.SyncInvocationException;
import de.kuschku.libquassel.functions.types.SyncFunction; import de.kuschku.libquassel.functions.types.SyncFunction;
import de.kuschku.libquassel.syncables.types.interfaces.QBufferSyncer; import de.kuschku.libquassel.syncables.types.interfaces.QBufferSyncer;
...@@ -39,29 +40,39 @@ public class IBufferSyncer implements Invoker<QBufferSyncer> { ...@@ -39,29 +40,39 @@ public class IBufferSyncer implements Invoker<QBufferSyncer> {
} }
@Override @Override
public void invoke(SyncFunction function, QBufferSyncer obj) { public void invoke(SyncFunction function, QBufferSyncer obj) throws SyncInvocationException {
switch (function.methodName) { switch (function.methodName) {
case "setLastSeenMsg": { case "setLastSeenMsg": {
obj._setLastSeenMsg((int) function.params.get(0), (int) function.params.get(1)); obj._setLastSeenMsg((int) function.params.get(0), (int) function.params.get(1));
} break; }
break;
case "setMarkerLine": { case "setMarkerLine": {
obj._setMarkerLine((int) function.params.get(0), (int) function.params.get(1)); obj._setMarkerLine((int) function.params.get(0), (int) function.params.get(1));
} break; }
break;
case "removeBuffer": { case "removeBuffer": {
obj._removeBuffer((int) function.params.get(0)); obj._removeBuffer((int) function.params.get(0));
} break; }
break;
case "renameBuffer": { case "renameBuffer": {
obj._renameBuffer((int) function.params.get(0), (String) function.params.get(1)); obj._renameBuffer((int) function.params.get(0), (String) function.params.get(1));
} break; }
break;
case "mergeBuffersPermanently": { case "mergeBuffersPermanently": {
obj._mergeBuffersPermanently((int) function.params.get(0), (int) function.params.get(1)); obj._mergeBuffersPermanently((int) function.params.get(0), (int) function.params.get(1));
} break; }
break;
case "markBufferAsRead": { case "markBufferAsRead": {
obj._markBufferAsRead((int) function.params.get(0)); obj._markBufferAsRead((int) function.params.get(0));
} break; }
break;
case "update": { case "update": {
InvokerHelper.update(obj, function.params.get(0)); InvokerHelper.update(obj, function.params.get(0));
} break; }
break;
default: {
throw new SyncInvocationException(function.className + "::" + function.methodName);
}
} }
} }
} }
...@@ -23,6 +23,7 @@ package de.kuschku.libquassel.syncables.types.invokers; ...@@ -23,6 +23,7 @@ package de.kuschku.libquassel.syncables.types.invokers;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import de.kuschku.libquassel.exceptions.SyncInvocationException;
import de.kuschku.libquassel.functions.types.SyncFunction; import de.kuschku.libquassel.functions.types.SyncFunction;
import de.kuschku.libquassel.syncables.types.interfaces.QBufferViewConfig; import de.kuschku.libquassel.syncables.types.interfaces.QBufferViewConfig;
...@@ -39,50 +40,67 @@ public class IBufferViewConfig implements Invoker<QBufferViewConfig> { ...@@ -39,50 +40,67 @@ public class IBufferViewConfig implements Invoker<QBufferViewConfig> {
} }
@Override @Override
public void invoke(SyncFunction function, QBufferViewConfig obj) { public void invoke(SyncFunction function, QBufferViewConfig obj) throws SyncInvocationException {
switch (function.methodName) { switch (function.methodName) {
case "setBufferViewName": { case "setBufferViewName": {
obj._setBufferViewName((String) function.params.get(0)); obj._setBufferViewName((String) function.params.get(0));
} break; }
break;
case "setNetworkId": { case "setNetworkId": {
obj._setNetworkId((int) function.params.get(0)); obj._setNetworkId((int) function.params.get(0));
} break; }
break;
case "setAddNewBuffersAutomatically": { case "setAddNewBuffersAutomatically": {
obj._setAddNewBuffersAutomatically((boolean) function.params.get(0)); obj._setAddNewBuffersAutomatically((boolean) function.params.get(0));
} break; }
break;
case "setSortAlphabetically": { case "setSortAlphabetically": {
obj._setSortAlphabetically((boolean) function.params.get(0)); obj._setSortAlphabetically((boolean) function.params.get(0));
} break; }
break;
case "setDisableDecoration": { case "setDisableDecoration": {
obj._setDisableDecoration((boolean) function.params.get(0)); obj._setDisableDecoration((boolean) function.params.get(0));
} break; }
break;
case "setAllowedBufferTypes": { case "setAllowedBufferTypes": {
obj._setAllowedBufferTypes((int) function.params.get(0)); obj._setAllowedBufferTypes((int) function.params.get(0));
} break; }
break;
case "setMinimumActivity": { case "setMinimumActivity": {
obj._setMinimumActivity((int) function.params.get(0)); obj._setMinimumActivity((int) function.params.get(0));
} break; }
break;
case "setHideInactiveBuffers": { case "setHideInactiveBuffers": {
obj._setHideInactiveBuffers((boolean) function.params.get(0)); obj._setHideInactiveBuffers((boolean) function.params.get(0));
} break; }
break;
case "setHideInactiveNetworks": { case "setHideInactiveNetworks": {
obj._setHideInactiveNetworks((boolean) function.params.get(0)); obj._setHideInactiveNetworks((boolean) function.params.get(0));
} break; }
break;
case "addBuffer": { case "addBuffer": {
obj._addBuffer((int) function.params.get(0), (int) function.params.get(1)); obj._addBuffer((int) function.params.get(0), (int) function.params.get(1));
} break; }
break;
case "moveBuffer": { case "moveBuffer": {
obj._moveBuffer((int) function.params.get(0), (int) function.params.get(1)); obj._moveBuffer((int) function.params.get(0), (int) function.params.get(1));
} break; }
break;
case "removeBuffer": { case "removeBuffer": {
obj._removeBuffer((int) function.params.get(0)); obj._removeBuffer((int) function.params.get(0));
} break; }
break;
case "removeBufferPermanently": { case "removeBufferPermanently": {
obj._removeBufferPermanently((int) function.params.get(0)); obj._removeBufferPermanently((int) function.params.get(0));
} break; }
break;
case "update": { case "update": {
InvokerHelper.update(obj, function.params.get(0)); InvokerHelper.update(obj, function.params.get(0));
} break; }
break;
default: {
throw new SyncInvocationException(function.className + "::" + function.methodName);
}
} }
} }
} }
...@@ -23,6 +23,7 @@ package de.kuschku.libquassel.syncables.types.invokers; ...@@ -23,6 +23,7 @@ package de.kuschku.libquassel.syncables.types.invokers;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import de.kuschku.libquassel.exceptions.SyncInvocationException;
import de.kuschku.libquassel.functions.types.SyncFunction; import de.kuschku.libquassel.functions.types.SyncFunction;
import de.kuschku.libquassel.syncables.types.interfaces.QBufferViewManager; import de.kuschku.libquassel.syncables.types.interfaces.QBufferViewManager;
...@@ -39,17 +40,23 @@ public class IBufferViewManager implements Invoker<QBufferViewManager> { ...@@ -39,17 +40,23 @@ public class IBufferViewManager implements Invoker<QBufferViewManager> {
} }
@Override @Override
public void invoke(SyncFunction function, QBufferViewManager obj) { public void invoke(SyncFunction function, QBufferViewManager obj) throws SyncInvocationException {
switch (function.methodName) { switch (function.methodName) {
case "addBufferViewConfig": { case "addBufferViewConfig": {
obj._addBufferViewConfig((int) function.params.get(0)); obj._addBufferViewConfig((int) function.params.get(0));
} break; }
break;
case "deleteBufferViewConfig": { case "deleteBufferViewConfig": {
obj._deleteBufferViewConfig((int) function.params.get(0)); obj._deleteBufferViewConfig((int) function.params.get(0));
} break; }
break;
case "update": { case "update": {
InvokerHelper.update(obj, function.params.get(0)); InvokerHelper.update(obj, function.params.get(0));
} break; }
break;
default: {
throw new SyncInvocationException(function.className + "::" + function.methodName);
}
} }
} }
} }
...@@ -23,6 +23,7 @@ package de.kuschku.libquassel.syncables.types.invokers; ...@@ -23,6 +23,7 @@ package de.kuschku.libquassel.syncables.types.invokers;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import de.kuschku.libquassel.exceptions.SyncInvocationException;
import de.kuschku.libquassel.functions.types.SyncFunction; import de.kuschku.libquassel.functions.types.SyncFunction;
import de.kuschku.libquassel.syncables.types.interfaces.QCertManager; import de.kuschku.libquassel.syncables.types.interfaces.QCertManager;
...@@ -39,14 +40,19 @@ public class ICertManager implements Invoker<QCertManager> { ...@@ -39,14 +40,19 @@ public class ICertManager implements Invoker<QCertManager> {
} }
@Override @Override
public void invoke(SyncFunction function, QCertManager obj) { public void invoke(SyncFunction function, QCertManager obj) throws SyncInvocationException {
switch (function.methodName) { switch (function.methodName) {
case "": { case "": {
} break; }
break;
case "update": { case "update": {
InvokerHelper.update(obj, function.params.get(0)); InvokerHelper.update(obj, function.params.get(0));
} break; }
break;
default: {
throw new SyncInvocationException(function.className + "::" + function.methodName);
}
} }
} }
} }
...@@ -24,6 +24,7 @@ package de.kuschku.libquassel.syncables.types.invokers; ...@@ -24,6 +24,7 @@ package de.kuschku.libquassel.syncables.types.invokers;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import de.kuschku.libquassel.client.QClient; import de.kuschku.libquassel.client.QClient;
import de.kuschku.libquassel.exceptions.SyncInvocationException;
import de.kuschku.libquassel.functions.types.RpcCallFunction; import de.kuschku.libquassel.functions.types.RpcCallFunction;
import de.kuschku.libquassel.message.Message; import de.kuschku.libquassel.message.Message;
import de.kuschku.libquassel.primitives.types.BufferInfo; import de.kuschku.libquassel.primitives.types.BufferInfo;
...@@ -41,35 +42,47 @@ public class IClient { ...@@ -41,35 +42,47 @@ public class IClient {
return invoker; return invoker;
} }
public void invoke(RpcCallFunction function, QClient obj) { public void invoke(RpcCallFunction function, QClient obj) throws SyncInvocationException {
switch (function.functionName) { switch (function.functionName) {
case "2displayMsg": { case "2displayMsg(Message)": {
obj._displayMsg((Message) function.params.get(0)); obj._displayMsg((Message) function.params.get(0));
} break; }
case "2bufferInfoUpdated": { break;
case "2bufferInfoUpdated(BufferInfo)": {
obj._bufferInfoUpdated((BufferInfo) function.params.get(0)); obj._bufferInfoUpdated((BufferInfo) function.params.get(0));
} break; }
case "2identityCreated": { break;
case "2identityCreated(Identity)": {
obj._identityCreated((Identity) function.params.get(0)); obj._identityCreated((Identity) function.params.get(0));
} break; }
case "2identityRemoved": { break;
case "2identityRemoved(IdentityId)": {
obj._identityRemoved((int) function.params.get(0)); obj._identityRemoved((int) function.params.get(0));
} break; }
case "2networkCreated": { break;
case "2networkCreated(NetworkId)": {
obj._networkCreated((int) function.params.get(0)); obj._networkCreated((int) function.params.get(0));
} break; }
case "2networkRemoved": { break;
case "2networkRemoved(NetworkId)": {
obj._networkRemoved((int) function.params.get(0)); obj._networkRemoved((int) function.params.get(0));
} break; }
case "2passwordChanged": { break;
case "2passwordChanged(PeerPtr,bool)": {
obj._passwordChanged((long) function.params.get(0), (boolean) function.params.get(1)); obj._passwordChanged((long) function.params.get(0), (boolean) function.params.get(1));
} break; }
case "2displayStatusMsg": { break;
case "2displayStatusMsg(QString,QString)": {
obj._displayStatusMsg((String) function.params.get(0), (String) function.params.get(1)); obj._displayStatusMsg((String) function.params.get(0), (String) function.params.get(1));
} break; }
break;
case "__objectRenamed__": { case "__objectRenamed__": {
obj.___objectRenamed__((String) function.params.get(0), (String) function.params.get(1), (String) function.params.get(2)); obj.___objectRenamed__((String) function.params.get(0), (String) function.params.get(1), (String) function.params.get(2));
} break; }
break;
default: {
throw new SyncInvocationException("Client::" + function.functionName);
}
} }
} }
} }
...@@ -25,6 +25,7 @@ import android.support.annotation.NonNull; ...@@ -25,6 +25,7 @@ import android.support.annotation.NonNull;
import java.util.Map; import java.util.Map;
import de.kuschku.libquassel.exceptions.SyncInvocationException;
import de.kuschku.libquassel.functions.types.SyncFunction; import de.kuschku.libquassel.functions.types.SyncFunction;
import de.kuschku.libquassel.primitives.types.QVariant; import de.kuschku.libquassel.primitives.types.QVariant;
import de.kuschku.libquassel.syncables.types.interfaces.QCoreInfo; import de.kuschku.libquassel.syncables.types.interfaces.QCoreInfo;
...@@ -42,14 +43,19 @@ public class ICoreInfo implements Invoker<QCoreInfo> { ...@@ -42,14 +43,19 @@ public class ICoreInfo implements Invoker<QCoreInfo> {
} }
@Override @Override
public void invoke(SyncFunction function, QCoreInfo obj) { public void invoke(SyncFunction function, QCoreInfo obj) throws SyncInvocationException {
switch (function.methodName) { switch (function.methodName) {
case "setCoreData": { case "setCoreData": {
obj._setCoreData((Map<String, QVariant>) function.params.get(0)); obj._setCoreData((Map<String, QVariant>) function.params.get(0));
} break; }
break;
case "update": { case "update": {
InvokerHelper.update(obj, function.params.get(0)); InvokerHelper.update(obj, function.params.get(0));
} break; }
break;
default: {
throw new SyncInvocationException(function.className + "::" + function.methodName);
}
} }
} }
} }
...@@ -25,6 +25,7 @@ import android.support.annotation.NonNull; ...@@ -25,6 +25,7 @@ import android.support.annotation.NonNull;
import java.util.List; import java.util.List;
import de.kuschku.libquassel.exceptions.SyncInvocationException;
import de.kuschku.libquassel.functions.types.SyncFunction; import de.kuschku.libquassel.functions.types.SyncFunction;
import de.kuschku.libquassel.syncables.types.interfaces.QIdentity; import de.kuschku.libquassel.syncables.types.interfaces.QIdentity;
...@@ -41,74 +42,99 @@ public class IIdentity implements Invoker<QIdentity> { ...@@ -41,74 +42,99 @@ public class IIdentity implements Invoker<QIdentity> {
} }
@Override @Override
public void invoke(SyncFunction function, QIdentity obj) { public void invoke(SyncFunction function, QIdentity obj) throws SyncInvocationException {
switch (function.methodName) { switch (function.methodName) {
case "setId": { case "setId": {
obj._setId((int) function.params.get(0)); obj._setId((int) function.params.get(0));
} break; }
break;
case "setIdentityName": { case "setIdentityName": {
obj._setIdentityName((String) function.params.get(0)); obj._setIdentityName((String) function.params.get(0));
} break; }
break;
case "setRealName": { case "setRealName": {
obj._setRealName((String) function.params.get(0)); obj._setRealName((String) function.params.get(0));
} break; }
break;
case "setNicks": { case "setNicks": {
obj._setNicks((List<String>) function.params.get(0)); obj._setNicks((List<String>) function.params.get(0));
} break; }
break;
case "setAwayNick": { case "setAwayNick": {
obj._setAwayNick((String) function.params.get(0)); obj._setAwayNick((String) function.params.get(0));
} break; }
break;
case "setAwayNickEnabled": { case "setAwayNickEnabled": {
obj._setAwayNickEnabled((boolean) function.params.get(0)); obj._setAwayNickEnabled((boolean) function.params.get(0));
} break; }
break;
case "setAwayReason": { case "setAwayReason": {
obj._setAwayReason((String) function.params.get(0)); obj._setAwayReason((String) function.params.get(0));
} break; }
break;
case "setAwayReasonEnabled": { case "setAwayReasonEnabled": {
obj._setAwayReasonEnabled((boolean) function.params.get(0)); obj._setAwayReasonEnabled((boolean) function.params.get(0));
} break; }
break;
case "setAutoAwayEnabled": { case "setAutoAwayEnabled": {
obj._setAutoAwayEnabled((boolean) function.params.get(0)); obj._setAutoAwayEnabled((boolean) function.params.get(0));
} break; }
break;
case "setAutoAwayTime": { case "setAutoAwayTime": {
obj._setAutoAwayTime((int) function.params.get(0)); obj._setAutoAwayTime((int) function.params.get(0));
} break; }
break;
case "setAutoAwayReason": { case "setAutoAwayReason": {
obj._setAutoAwayReason((String) function.params.get(0)); obj._setAutoAwayReason((String) function.params.get(0));
} break; }
break;
case "setAutoAwayReasonEnabled": { case "setAutoAwayReasonEnabled": {
obj._setAutoAwayReasonEnabled((boolean) function.params.get(0)); obj._setAutoAwayReasonEnabled((boolean) function.params.get(0));
} break; }
break;
case "setDetachAwayEnabled": { case "setDetachAwayEnabled": {
obj._setDetachAwayEnabled((boolean) function.params.get(0)); obj._setDetachAwayEnabled((boolean) function.params.get(0));
} break; }
break;
case "setDetachAwayReason": { case "setDetachAwayReason": {
obj._setDetachAwayReason((String) function.params.get(0)); obj._setDetachAwayReason((String) function.params.get(0));
} break; }
break;
case "setDetachAwayReasonEnabled": { case "setDetachAwayReasonEnabled": {
obj._setDetachAwayReasonEnabled((boolean) function.params.get(0)); obj._setDetachAwayReasonEnabled((boolean) function.params.get(0));
} break; }
break;
case "setIdent": { case "setIdent": {
obj._setIdent((String) function.params.get(0)); obj._setIdent((String) function.params.get(0));
} break; }
break;
case "setKickReason": { case "setKickReason": {
obj._setKickReason((String) function.params.get(0)); obj._setKickReason((String) function.params.get(0));
} break; }
break;
case "setPartReason": { case "setPartReason": {
obj._setPartReason((String) function.params.get(0)); obj._setPartReason((String) function.params.get(0));
} break; }
break;
case "setQuitReason": { case "setQuitReason": {
obj._setQuitReason((String) function.params.get(0)); obj._setQuitReason((String) function.params.get(0));
} break; }
break;
case "setSslKey": { case "setSslKey": {
obj._setSslKey((String) function.params.get(0)); obj._setSslKey((String) function.params.get(0));
} break; }
break;
case "setSslCert": { case "setSslCert": {
obj._setSslCert((String) function.params.get(0)); obj._setSslCert((String) function.params.get(0));
} break; }
break;
case "update": { case "update": {
InvokerHelper.update(obj, function.params.get(0)); InvokerHelper.update(obj, function.params.get(0));
} break; }
break;
default: {
throw new SyncInvocationException(function.className + "::" + function.methodName);
}
} }
} }
} }
...@@ -23,6 +23,7 @@ package de.kuschku.libquassel.syncables.types.invokers; ...@@ -23,6 +23,7 @@ package de.kuschku.libquassel.syncables.types.invokers;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import de.kuschku.libquassel.exceptions.SyncInvocationException;
import de.kuschku.libquassel.functions.types.SyncFunction; import de.kuschku.libquassel.functions.types.SyncFunction;
import de.kuschku.libquassel.syncables.types.interfaces.QIgnoreListManager; import de.kuschku.libquassel.syncables.types.interfaces.QIgnoreListManager;
...@@ -38,20 +39,27 @@ public class IIgnoreListManager implements Invoker<QIgnoreListManager> { ...@@ -38,20 +39,27 @@ public class IIgnoreListManager implements Invoker<QIgnoreListManager> {
return invoker; return invoker;
} }
public void invoke(SyncFunction function, QIgnoreListManager object) { public void invoke(SyncFunction function, QIgnoreListManager object) throws SyncInvocationException {
switch (function.methodName) { switch (function.methodName) {
case "removeIgnoreListItem": { case "removeIgnoreListItem": {
object._removeIgnoreListItem((String) function.params.get(0)); object._removeIgnoreListItem((String) function.params.get(0));
} break; }
break;
case "toggleIgnoreRule": { case "toggleIgnoreRule": {
object._toggleIgnoreRule((String) function.params.get(0)); object._toggleIgnoreRule((String) function.params.get(0));
} break; }
break;
case "addIgnoreListItem": { case "addIgnoreListItem": {
object._addIgnoreListItem((int) function.params.get(0), (String) function.params.get(1), (boolean) function.params.get(2), (int) function.params.get(3), (int) function.params.get(4), (String) function.params.get(5), (boolean) function.params.get(6)); object._addIgnoreListItem((int) function.params.get(0), (String) function.params.get(1), (boolean) function.params.get(2), (int) function.params.get(3), (int) function.params.get(4), (String) function.params.get(5), (boolean) function.params.get(6));
} break; }
break;
case "update": { case "update": {
InvokerHelper.update(object, function.params.get(0)); InvokerHelper.update(object, function.params.get(0));
} break; }
break;
default: {
throw new SyncInvocationException(function.className + "::" + function.methodName);
}
} }
} }
} }
...@@ -25,6 +25,7 @@ import android.support.annotation.NonNull; ...@@ -25,6 +25,7 @@ import android.support.annotation.NonNull;
import java.util.List; import java.util.List;
import de.kuschku.libquassel.exceptions.SyncInvocationException;
import de.kuschku.libquassel.functions.types.SyncFunction; import de.kuschku.libquassel.functions.types.SyncFunction;
import de.kuschku.libquassel.syncables.types.interfaces.QIrcChannel; import de.kuschku.libquassel.syncables.types.interfaces.QIrcChannel;
...@@ -41,44 +42,59 @@ public class IIrcChannel implements Invoker<QIrcChannel> { ...@@ -41,44 +42,59 @@ public class IIrcChannel implements Invoker<QIrcChannel> {
} }
@Override @Override
public void invoke(SyncFunction function, QIrcChannel obj) { public void invoke(SyncFunction function, QIrcChannel obj) throws SyncInvocationException {
switch (function.methodName) { switch (function.methodName) {
case "setTopic": { case "setTopic": {
obj._setTopic((String) function.params.get(0)); obj._setTopic((String) function.params.get(0));
} break; }
break;
case "setPassword": { case "setPassword": {
obj._setPassword((String) function.params.get(0)); obj._setPassword((String) function.params.get(0));
} break; }
break;
case "setEncrypted": { case "setEncrypted": {
obj._setEncrypted((boolean) function.params.get(0)); obj._setEncrypted((boolean) function.params.get(0));
} break; }
break;
case "joinIrcUsers": { case "joinIrcUsers": {
obj._joinIrcUsers((List<String>) function.params.get(0), (List<String>) function.params.get(1)); obj._joinIrcUsers((List<String>) function.params.get(0), (List<String>) function.params.get(1));
} break; }
break;
case "part": { case "part": {
obj._part((String) function.params.get(0)); obj._part((String) function.params.get(0));
} break; }
break;
case "setUserModes": { case "setUserModes": {
obj._setUserModes((String) function.params.get(0), (String) function.params.get(1)); obj._setUserModes((String) function.params.get(0), (String) function.params.get(1));
} break; }
break;
case "addUserMode": { case "addUserMode": {
obj._addUserMode((String) function.params.get(0), (String) function.params.get(1)); obj._addUserMode((String) function.params.get(0), (String) function.params.get(1));
} break; }
break;
case "removeUserMode": { case "removeUserMode": {
obj._removeUserMode((String) function.params.get(0), (String) function.params.get(1)); obj._removeUserMode((String) function.params.get(0), (String) function.params.get(1));
} break; }
break;
case "addChannelMode": { case "addChannelMode": {
obj._addChannelMode((char) function.params.get(0), (String) function.params.get(1)); obj._addChannelMode((char) function.params.get(0), (String) function.params.get(1));
} break; }
break;
case "removeChannelMode": { case "removeChannelMode": {
obj._removeChannelMode((char) function.params.get(0), (String) function.params.get(1)); obj._removeChannelMode((char) function.params.get(0), (String) function.params.get(1));
} break; }
break;
case "ircUserNickChanged": { case "ircUserNickChanged": {
obj._ircUserNickChanged((String) function.params.get(0), (String) function.params.get(1)); obj._ircUserNickChanged((String) function.params.get(0), (String) function.params.get(1));
} break; }
break;
case "update": { case "update": {
InvokerHelper.update(obj, function.params.get(0)); InvokerHelper.update(obj, function.params.get(0));
} break; }
break;
default: {
throw new SyncInvocationException(function.className + "::" + function.methodName);
}
} }
} }
} }
...@@ -25,6 +25,7 @@ import android.support.annotation.NonNull; ...@@ -25,6 +25,7 @@ import android.support.annotation.NonNull;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import de.kuschku.libquassel.exceptions.SyncInvocationException;
import de.kuschku.libquassel.functions.types.SyncFunction; import de.kuschku.libquassel.functions.types.SyncFunction;
import de.kuschku.libquassel.syncables.types.interfaces.QIrcUser; import de.kuschku.libquassel.syncables.types.interfaces.QIrcUser;
...@@ -41,77 +42,103 @@ public class IIrcUser implements Invoker<QIrcUser> { ...@@ -41,77 +42,103 @@ public class IIrcUser implements Invoker<QIrcUser> {
} }
@Override @Override
public void invoke(SyncFunction function, QIrcUser obj) { public void invoke(SyncFunction function, QIrcUser obj) throws SyncInvocationException {
switch (function.methodName) { switch (function.methodName) {
case "setAway": { case "setAway": {
obj._setAway((boolean) function.params.get(0)); obj._setAway((boolean) function.params.get(0));
} break; }
break;
case "setUser": { case "setUser": {
obj._setUser((String) function.params.get(0)); obj._setUser((String) function.params.get(0));
} break; }
break;
case "setHost": { case "setHost": {
obj._setHost((String) function.params.get(0)); obj._setHost((String) function.params.get(0));
} break; }
break;
case "setNick": { case "setNick": {
obj._setNick((String) function.params.get(0)); obj._setNick((String) function.params.get(0));
} break; }
break;
case "setRealName": { case "setRealName": {
obj._setRealName((String) function.params.get(0)); obj._setRealName((String) function.params.get(0));
} break; }
break;
case "setAccount": { case "setAccount": {
obj._setAccount((String) function.params.get(0)); obj._setAccount((String) function.params.get(0));
} break; }
break;
case "setAwayMessage": { case "setAwayMessage": {
obj._setAwayMessage((String) function.params.get(0)); obj._setAwayMessage((String) function.params.get(0));
} break; }
break;
case "setIdleTime": { case "setIdleTime": {
obj._setIdleTime((DateTime) function.params.get(0)); obj._setIdleTime((DateTime) function.params.get(0));
} break; }
break;
case "setLoginTime": { case "setLoginTime": {
obj._setLoginTime((DateTime) function.params.get(0)); obj._setLoginTime((DateTime) function.params.get(0));
} break; }
break;
case "setServer": { case "setServer": {
obj._setServer((String) function.params.get(0)); obj._setServer((String) function.params.get(0));
} break; }
break;
case "setIrcOperator": { case "setIrcOperator": {
obj._setIrcOperator((String) function.params.get(0)); obj._setIrcOperator((String) function.params.get(0));
} break; }
break;
case "setLastAwayMessage": { case "setLastAwayMessage": {
obj._setLastAwayMessage((int) function.params.get(0)); obj._setLastAwayMessage((int) function.params.get(0));
} break; }
break;
case "setWhoisServiceReply": { case "setWhoisServiceReply": {
obj._setWhoisServiceReply((String) function.params.get(0)); obj._setWhoisServiceReply((String) function.params.get(0));
} break; }
break;
case "setSuserHost": { case "setSuserHost": {
obj._setSuserHost((String) function.params.get(0)); obj._setSuserHost((String) function.params.get(0));
} break; }
break;
case "setEncrypted": { case "setEncrypted": {
obj._setEncrypted((boolean) function.params.get(0)); obj._setEncrypted((boolean) function.params.get(0));
} break; }
break;
case "updateHostmask": { case "updateHostmask": {
obj._updateHostmask((String) function.params.get(0)); obj._updateHostmask((String) function.params.get(0));
} break; }
break;
case "setUserModes": { case "setUserModes": {
obj._setUserModes((String) function.params.get(0)); obj._setUserModes((String) function.params.get(0));
} break; }
break;
case "joinChannel": { case "joinChannel": {
obj._joinChannel((String) function.params.get(0)); obj._joinChannel((String) function.params.get(0));
} break; }
break;
case "partChannel": { case "partChannel": {
obj._partChannel((String) function.params.get(0)); obj._partChannel((String) function.params.get(0));
} break; }
break;
case "addUserModes": { case "addUserModes": {
obj._addUserModes((String) function.params.get(0)); obj._addUserModes((String) function.params.get(0));
} break; }
break;
case "removeUserModes": { case "removeUserModes": {
obj._removeUserModes((String) function.params.get(0)); obj._removeUserModes((String) function.params.get(0));
} break; }
break;
case "quit": { case "quit": {
obj._quit(); obj._quit();
} break; }
break;
case "update": { case "update": {
InvokerHelper.update(obj, function.params.get(0)); InvokerHelper.update(obj, function.params.get(0));
} break; }
break;
default: {
throw new SyncInvocationException(function.className + "::" + function.methodName);
}
} }
} }
} }
...@@ -25,6 +25,7 @@ import android.support.annotation.NonNull; ...@@ -25,6 +25,7 @@ import android.support.annotation.NonNull;
import java.util.List; import java.util.List;
import de.kuschku.libquassel.exceptions.SyncInvocationException;
import de.kuschku.libquassel.functions.types.SyncFunction; import de.kuschku.libquassel.functions.types.SyncFunction;
import de.kuschku.libquassel.objects.types.NetworkServer; import de.kuschku.libquassel.objects.types.NetworkServer;
import de.kuschku.libquassel.syncables.types.impl.NetworkInfo; import de.kuschku.libquassel.syncables.types.impl.NetworkInfo;
...@@ -43,116 +44,154 @@ public class INetwork implements Invoker<QNetwork> { ...@@ -43,116 +44,154 @@ public class INetwork implements Invoker<QNetwork> {
} }
@Override @Override
public void invoke(SyncFunction function, QNetwork obj) { public void invoke(SyncFunction function, QNetwork obj) throws SyncInvocationException {
switch (function.methodName) { switch (function.methodName) {
case "setAutoAwayActive": { case "setAutoAwayActive": {
obj._setAutoAwayActive((boolean) function.params.get(0)); obj._setAutoAwayActive((boolean) function.params.get(0));
} break; }
break;
case "setNetworkName": { case "setNetworkName": {
obj._setNetworkName((String) function.params.get(0)); obj._setNetworkName((String) function.params.get(0));
} break; }
break;
case "setCurrentServer": { case "setCurrentServer": {
obj._setCurrentServer((String) function.params.get(0)); obj._setCurrentServer((String) function.params.get(0));
} break; }
break;
case "setConnected": { case "setConnected": {
obj._setConnected((boolean) function.params.get(0)); obj._setConnected((boolean) function.params.get(0));
} break; }
break;
case "setConnectionState": { case "setConnectionState": {
obj._setConnectionState((int) function.params.get(0)); obj._setConnectionState((int) function.params.get(0));
} break; }
break;
case "setMyNick": { case "setMyNick": {
obj._setMyNick((String) function.params.get(0)); obj._setMyNick((String) function.params.get(0));
} break; }
break;
case "setLatency": { case "setLatency": {
obj._setLatency((int) function.params.get(0)); obj._setLatency((int) function.params.get(0));
} break; }
break;
case "setIdentity": { case "setIdentity": {
obj._setIdentity((int) function.params.get(0)); obj._setIdentity((int) function.params.get(0));
} break; }
break;
case "setServerList": { case "setServerList": {
obj._setServerList((List<NetworkServer>) function.params.get(0)); obj._setServerList((List<NetworkServer>) function.params.get(0));
} break; }
break;
case "setUseRandomServer": { case "setUseRandomServer": {
obj._setUseRandomServer((boolean) function.params.get(0)); obj._setUseRandomServer((boolean) function.params.get(0));
} break; }
break;
case "setPerform": { case "setPerform": {
obj._setPerform((List<String>) function.params.get(0)); obj._setPerform((List<String>) function.params.get(0));
} break; }
break;
case "setUseAutoIdentify": { case "setUseAutoIdentify": {
obj._setUseAutoIdentify((boolean) function.params.get(0)); obj._setUseAutoIdentify((boolean) function.params.get(0));
} break; }
break;
case "setAutoIdentifyService": { case "setAutoIdentifyService": {
obj._setAutoIdentifyService((String) function.params.get(0)); obj._setAutoIdentifyService((String) function.params.get(0));
} break; }
break;
case "setAutoIdentifyPassword": { case "setAutoIdentifyPassword": {
obj._setAutoIdentifyPassword((String) function.params.get(0)); obj._setAutoIdentifyPassword((String) function.params.get(0));
} break; }
break;
case "setUseSasl": { case "setUseSasl": {
obj._setUseSasl((boolean) function.params.get(0)); obj._setUseSasl((boolean) function.params.get(0));
} break; }
break;
case "setSaslAccount": { case "setSaslAccount": {
obj._setSaslAccount((String) function.params.get(0)); obj._setSaslAccount((String) function.params.get(0));
} break; }
break;
case "setSaslPassword": { case "setSaslPassword": {
obj._setSaslPassword((String) function.params.get(0)); obj._setSaslPassword((String) function.params.get(0));
} break; }
break;
case "setUseAutoReconnect": { case "setUseAutoReconnect": {
obj._setUseAutoReconnect((boolean) function.params.get(0)); obj._setUseAutoReconnect((boolean) function.params.get(0));
} break; }
break;
case "setAutoReconnectInterval": { case "setAutoReconnectInterval": {
obj._setAutoReconnectInterval((int) function.params.get(0)); obj._setAutoReconnectInterval((int) function.params.get(0));
} break; }
break;
case "setAutoReconnectRetries": { case "setAutoReconnectRetries": {
obj._setAutoReconnectRetries((short) function.params.get(0)); obj._setAutoReconnectRetries((short) function.params.get(0));
} break; }
break;
case "setUnlimitedReconnectRetries": { case "setUnlimitedReconnectRetries": {
obj._setUnlimitedReconnectRetries((boolean) function.params.get(0)); obj._setUnlimitedReconnectRetries((boolean) function.params.get(0));
} break; }
break;
case "setRejoinChannels": { case "setRejoinChannels": {
obj._setRejoinChannels((boolean) function.params.get(0)); obj._setRejoinChannels((boolean) function.params.get(0));
} break; }
break;
case "setCodecForServer": { case "setCodecForServer": {
obj._setCodecForServer((String) function.params.get(0)); obj._setCodecForServer((String) function.params.get(0));
} break; }
break;
case "setCodecForEncoding": { case "setCodecForEncoding": {
obj._setCodecForEncoding((String) function.params.get(0)); obj._setCodecForEncoding((String) function.params.get(0));
} break; }
break;
case "setCodecForDecoding": { case "setCodecForDecoding": {
obj._setCodecForDecoding((String) function.params.get(0)); obj._setCodecForDecoding((String) function.params.get(0));
} break; }
break;
case "addSupport": { case "addSupport": {
if (function.params.size() == 1) if (function.params.size() == 1)
obj._addSupport((String) function.params.get(0)); obj._addSupport((String) function.params.get(0));
else if (function.params.size() == 2) else if (function.params.size() == 2)
obj._addSupport((String) function.params.get(0), (String) function.params.get(1)); obj._addSupport((String) function.params.get(0), (String) function.params.get(1));
} break; }
break;
case "removeSupport": { case "removeSupport": {
obj._removeSupport((String) function.params.get(0)); obj._removeSupport((String) function.params.get(0));
} break; }
break;
case "addIrcUser": { case "addIrcUser": {
obj._addIrcUser((String) function.params.get(0)); obj._addIrcUser((String) function.params.get(0));
} break; }
break;
case "addIrcChannel": { case "addIrcChannel": {
obj._addIrcChannel((String) function.params.get(0)); obj._addIrcChannel((String) function.params.get(0));
} break; }
break;
case "updateNickFromMask": { case "updateNickFromMask": {
obj._updateNickFromMask((String) function.params.get(0)); obj._updateNickFromMask((String) function.params.get(0));
} break; }
break;
case "setNetworkInfo": { case "setNetworkInfo": {
obj._setNetworkInfo((NetworkInfo) function.params.get(0)); obj._setNetworkInfo((NetworkInfo) function.params.get(0));
} break; }
break;
case "connect": { case "connect": {
obj._connect(); obj._connect();
} break; }
break;
case "disconnect": { case "disconnect": {
obj._disconnect(); obj._disconnect();
} break; }
break;
case "removeChansAndUsers": { case "removeChansAndUsers": {
obj._removeChansAndUsers(); obj._removeChansAndUsers();
} break; }
break;
case "update": { case "update": {
InvokerHelper.update(obj, function.params.get(0)); InvokerHelper.update(obj, function.params.get(0));
} break; }
break;
default: {
throw new SyncInvocationException(function.className + "::" + function.methodName);
}
} }
} }
} }
...@@ -23,6 +23,7 @@ package de.kuschku.libquassel.syncables.types.invokers; ...@@ -23,6 +23,7 @@ package de.kuschku.libquassel.syncables.types.invokers;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import de.kuschku.libquassel.exceptions.SyncInvocationException;
import de.kuschku.libquassel.functions.types.SyncFunction; import de.kuschku.libquassel.functions.types.SyncFunction;
import de.kuschku.libquassel.syncables.types.interfaces.QNetworkConfig; import de.kuschku.libquassel.syncables.types.interfaces.QNetworkConfig;
...@@ -39,35 +40,47 @@ public class INetworkConfig implements Invoker<QNetworkConfig> { ...@@ -39,35 +40,47 @@ public class INetworkConfig implements Invoker<QNetworkConfig> {
} }
@Override @Override
public void invoke(SyncFunction function, QNetworkConfig obj) { public void invoke(SyncFunction function, QNetworkConfig obj) throws SyncInvocationException {
switch (function.methodName) { switch (function.methodName) {
case "setPingTimeoutEnabled": { case "setPingTimeoutEnabled": {
obj._setPingTimeoutEnabled((boolean) function.params.get(0)); obj._setPingTimeoutEnabled((boolean) function.params.get(0));
} break; }
break;
case "setPingInterval": { case "setPingInterval": {
obj._setPingInterval((int) function.params.get(0)); obj._setPingInterval((int) function.params.get(0));
} break; }
break;
case "setMaxPingCount": { case "setMaxPingCount": {
obj._setMaxPingCount((int) function.params.get(0)); obj._setMaxPingCount((int) function.params.get(0));
} break; }
break;
case "setAutoWhoEnabled": { case "setAutoWhoEnabled": {
obj._setAutoWhoEnabled((boolean) function.params.get(0)); obj._setAutoWhoEnabled((boolean) function.params.get(0));
} break; }
break;
case "setAutoWhoInterval": { case "setAutoWhoInterval": {
obj._setAutoWhoInterval((int) function.params.get(0)); obj._setAutoWhoInterval((int) function.params.get(0));
} break; }
break;
case "setAutoWhoNickLimit": { case "setAutoWhoNickLimit": {
obj._setAutoWhoNickLimit((int) function.params.get(0)); obj._setAutoWhoNickLimit((int) function.params.get(0));
} break; }
break;
case "setAutoWhoDelay": { case "setAutoWhoDelay": {
obj._setAutoWhoDelay((int) function.params.get(0)); obj._setAutoWhoDelay((int) function.params.get(0));
} break; }
break;
case "setStandardCtcp": { case "setStandardCtcp": {
obj._setStandardCtcp((boolean) function.params.get(0)); obj._setStandardCtcp((boolean) function.params.get(0));
} break; }
break;
case "update": { case "update": {
InvokerHelper.update(obj, function.params.get(0)); InvokerHelper.update(obj, function.params.get(0));
} break; }
break;
default: {
throw new SyncInvocationException(function.className + "::" + function.methodName);
}
} }
} }
} }
...@@ -21,8 +21,9 @@ ...@@ -21,8 +21,9 @@
package de.kuschku.libquassel.syncables.types.invokers; package de.kuschku.libquassel.syncables.types.invokers;
import de.kuschku.libquassel.exceptions.SyncInvocationException;
import de.kuschku.libquassel.functions.types.SyncFunction; import de.kuschku.libquassel.functions.types.SyncFunction;
public interface Invoker<T> { public interface Invoker<T> {
void invoke(SyncFunction function, T obj); void invoke(SyncFunction function, T obj) throws SyncInvocationException;
} }
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
package de.kuschku.libquassel.syncables.types.invokers; package de.kuschku.libquassel.syncables.types.invokers;
import de.kuschku.libquassel.exceptions.SyncInvocationException;
import de.kuschku.libquassel.functions.types.SyncFunction; import de.kuschku.libquassel.functions.types.SyncFunction;
public class InvokerRegistry { public class InvokerRegistry {
...@@ -59,7 +60,7 @@ public class InvokerRegistry { ...@@ -59,7 +60,7 @@ public class InvokerRegistry {
} }
} }
public static void invoke(SyncFunction function, Object obj) { public static void invoke(SyncFunction function, Object obj) throws SyncInvocationException {
Invoker invoker = getInvoker(function); Invoker invoker = getInvoker(function);
if (invoker != null) if (invoker != null)
invoker.invoke(function, obj); invoker.invoke(function, obj);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment