System.out.println("createContactNym - addressBook returns null");
return false;
}
int count = (int) addressBook.GetContactCount();
for (int i = 0; i < count; i++) {
Contact contact = addressBook.GetContact(i);
if (contact == null) {
continue;
}
if (contactID.equals(contact.getContact_id())) {
System.out.println("createContactNym - contactID matches");
ContactNym contactNYM = null;
if (index == -1) {
Storable storable = otapi.CreateObject(StoredObjectType.STORED_OBJ_CONTACT_NYM);
if (storable != null) {
contactNYM = ContactNym.ot_dynamic_cast(storable);
}
} else {
contactNYM = contact.GetContactNym(index);
}
if (contactNYM != null) {
contactNYM.setGui_label(label);
contactNYM.setMemo(memo);
contactNYM.setNym_id(nymID);
contactNYM.setNym_type(nymType);
contactNYM.setPublic_key(publickey);
while (contactNYM.GetServerInfoCount() > 0) {
contactNYM.RemoveServerInfo(0);
}
for (int j = 0; j < serverID.length; j++) {
Storable storable1 = otapi.CreateObject(StoredObjectType.STORED_OBJ_SERVER_INFO);
if (storable1 != null) {
ServerInfo serverInfo = ServerInfo.ot_dynamic_cast(storable1);
if (serverInfo != null) {
serverInfo.setServer_id(serverID[j]);
System.out.println("serverType[j]:"+serverType[j]);
serverInfo.setServer_type(serverType[j]);
contactNYM.AddServerInfo(serverInfo);
}
}
}
contact.AddContactNym(contactNYM);
status = otapi.StoreObject(addressBook, "moneychanger", "gui_contacts.dat");
System.out.println("createContactNym status addressBook otapi.StoreObject:" + status);
// Set other values here
}