Testing a new concept for the SyncableObjects.
[quassel.git] / src / common / syncableobject.cpp
index fe320a9..aab2857 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- *   Copyright (C) 2005-08 by the Quassel IRC Team                         *
+ *   Copyright (C) 2005-09 by the Quassel Project                          *
  *   devel@quassel-irc.org                                                 *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
@@ -58,6 +58,12 @@ SyncableObject &SyncableObject::operator=(const SyncableObject &other) {
   return *this;
 }
 
+void SyncableObject::synchronize(SignalProxy *proxy) {
+  if(_signalProxies.contains(proxy))
+    return;
+  _signalProxies << proxy;
+}
+
 bool SyncableObject::isInitialized() const {
   return _initialized;
 }
@@ -155,3 +161,13 @@ void SyncableObject::requestUpdate(const QVariantMap &properties) {
   }
   emit updateRequested(properties);
 }
+
+void SyncableObject::sync_call__(SignalProxy::ProxyMode modeType, const char *funcname, ...) {
+  qDebug() << Q_FUNC_INFO << modeType << funcname;
+  foreach(SignalProxy *proxy, _signalProxies) {
+    va_list ap;
+    va_start(ap, funcname);
+    proxy->syncCall(this, modeType, funcname, ap);
+    va_end(ap);
+  }
+}