* IM Account management

* D-Bus dictionary helper function


git-svn-id: http://dev.openwengo.org/svn/openwengo/wengophone-ng/branches/wengophone-dbus-api/libs/dbus@8130 30a43799-04e7-0310-8b2b-ea0d24f86d0e
This commit is contained in:
pdurante 2006-10-19 21:43:30 +00:00
parent 35702f41b3
commit 19712668b1
7 changed files with 34617 additions and 3565 deletions

View file

@ -305,52 +305,33 @@ void MessageIter::copy_data( MessageIter& to )
{
for(MessageIter& from = *this; !from.at_end(); ++from)
{
switch(from.type())
if(dbus_type_is_basic(from.type()))
{
case DBUS_TYPE_BYTE:
case DBUS_TYPE_BOOLEAN:
case DBUS_TYPE_INT16:
case DBUS_TYPE_UINT16:
case DBUS_TYPE_INT32:
case DBUS_TYPE_UINT32:
case DBUS_TYPE_INT64:
case DBUS_TYPE_UINT64:
case DBUS_TYPE_DOUBLE:
case DBUS_TYPE_STRING:
case DBUS_TYPE_OBJECT_PATH:
case DBUS_TYPE_SIGNATURE:
{
debug_log("copying basic type: %c", from.type());
debug_log("copying basic type: %c", from.type());
unsigned char value[8];
from.get_basic(from.type(), &value);
to.append_basic(from.type(), &value);
break;
}
case DBUS_TYPE_ARRAY:
case DBUS_TYPE_VARIANT:
case DBUS_TYPE_STRUCT:
case DBUS_TYPE_DICT_ENTRY:
{
MessageIter from_container = from.recurse();
char* sig = from_container.signature();
unsigned char value[8];
from.get_basic(from.type(), &value);
to.append_basic(from.type(), &value);
}
else
{
MessageIter from_container = from.recurse();
char* sig = from_container.signature();
debug_log("copying compound type: %c[%s]", from.type(), sig);
debug_log("copying compound type: %c[%s]", from.type(), sig);
MessageIter to_container (to.msg());
dbus_message_iter_open_container
(
(DBusMessageIter*)&(to._iter),
from.type(),
from.type() == DBUS_TYPE_VARIANT ? NULL : sig,
(DBusMessageIter*)&(to_container._iter)
);
MessageIter to_container (to.msg());
dbus_message_iter_open_container
(
(DBusMessageIter*)&(to._iter),
from.type(),
from.type() == DBUS_TYPE_VARIANT ? NULL : sig,
(DBusMessageIter*)&(to_container._iter)
);
from_container.copy_data(to_container);
to.close_container(to_container);
free(sig);
break;
}
from_container.copy_data(to_container);
to.close_container(to_container);
free(sig);
}
}
}