aboutsummaryrefslogtreecommitdiffstats
path: root/src/native/addrbook/macosx
diff options
context:
space:
mode:
authorVincent Lucas <chenzo@jitsi.org>2013-03-11 22:23:23 +0000
committerVincent Lucas <chenzo@jitsi.org>2013-03-11 22:23:23 +0000
commita6288b5c35c8ea11c06ce6729bf1a7b739af703e (patch)
treec7fdc58baf9db9b3b80320d3a10c6d300f18c8fa /src/native/addrbook/macosx
parentfd097c2eb2d8c49daba567875e06b8f9845e3439 (diff)
downloadjitsi-a6288b5c35c8ea11c06ce6729bf1a7b739af703e.zip
jitsi-a6288b5c35c8ea11c06ce6729bf1a7b739af703e.tar.gz
jitsi-a6288b5c35c8ea11c06ce6729bf1a7b739af703e.tar.bz2
Adds edition for macosx address book contact properties. Avoids concurrent access to contact details. Corrects msoutlook subcategories for email and nickname.
Diffstat (limited to 'src/native/addrbook/macosx')
-rw-r--r--src/native/addrbook/macosx/net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery.m45
1 files changed, 35 insertions, 10 deletions
diff --git a/src/native/addrbook/macosx/net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery.m b/src/native/addrbook/macosx/net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery.m
index 9db946f..fca3afa 100644
--- a/src/native/addrbook/macosx/net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery.m
+++ b/src/native/addrbook/macosx/net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery.m
@@ -231,20 +231,45 @@ JNIEXPORT jboolean JNICALL Java_net_java_sip_communicator_plugin_addrbook_macosx
NSMutableDictionary *addr;
addr = [NSMutableDictionary dictionary];
- for (i = 0; i < propertyCount; i+=2)
+ data=[[ABMutableMultiValue alloc] init];
+ NSString *subProp = NULL;
+ NSString *lastSubProp;
+ for (i = 0; i < propertyCount; i+=3)
{
- jstring value = (jstring) (*jniEnv)->GetObjectArrayElement(jniEnv, arr, i);
- jstring label = (jstring) (*jniEnv)->GetObjectArrayElement(jniEnv, arr, i+1);
+ jstring value
+ = (jstring) (*jniEnv)->GetObjectArrayElement(jniEnv, arr, i);
+ jstring label
+ = (jstring) (*jniEnv)->GetObjectArrayElement(jniEnv, arr, i+1);
+ jstring tmpLastSubProp
+ = (jstring) (*jniEnv)->GetObjectArrayElement(jniEnv, arr, i+2);
+ lastSubProp = JavaStringToNSString(jniEnv, tmpLastSubProp);
+ // Initiates the first sub-property value.
+ if(i == 0)
+ {
+ subProp = lastSubProp;
+ }
- //NSLog(@"key:%@, value:%@", JavaStringToNSString(jniEnv, label), JavaStringToNSString(jniEnv, value));
+ // If there is a change in the sub-property, then save the actual
+ // one to the address property and create a new sub-property list
+ // (Home, Work).
+ if(![lastSubProp isEqualToString: subProp])
+ {
+ [(ABMutableMultiValue *) data addValue:addr withLabel:subProp];
+ addr = [NSMutableDictionary dictionary];
+ // Sets the new current proeperty
+ subProp = lastSubProp;
+ }
+
+ //NSLog(@"key:%@, value:%@", JavaStringToNSString(jniEnv, label),
+ //JavaStringToNSString(jniEnv, value));
[addr setObject:JavaStringToNSString(jniEnv, value)
- forKey:JavaStringToNSString(jniEnv, label)];
+ forKey:JavaStringToNSString(jniEnv, label)];
+ }
+ // Adds the last sub-property to the address book.
+ if(i > 0)
+ {
+ [(ABMutableMultiValue *) data addValue: addr withLabel: subProp];
}
-
- data=[[ABMutableMultiValue alloc] init];
- [(ABMutableMultiValue *) data
- addValue:addr
- withLabel:JavaStringToNSString(jniEnv, subProperty)];
}
//else if(property == kABOtherDatesProperty)//kABMultiDateProperty
else