mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-30 02:50:39 +00:00
parent
4377a2179b
commit
ef55196806
1 changed files with 47 additions and 43 deletions
|
@ -807,9 +807,9 @@ class Manager implements Signal {
|
||||||
if (contact == null) {
|
if (contact == null) {
|
||||||
contact = new ContactInfo();
|
contact = new ContactInfo();
|
||||||
contact.number = number;
|
contact.number = number;
|
||||||
System.out.println("Add contact " + number + " named " + name);
|
System.err.println("Add contact " + number + " named " + name);
|
||||||
} else {
|
} else {
|
||||||
System.out.println("Updating contact " + number + " name " + contact.name + " -> " + name);
|
System.err.println("Updating contact " + number + " name " + contact.name + " -> " + name);
|
||||||
}
|
}
|
||||||
contact.name = name;
|
contact.name = name;
|
||||||
contactStore.updateContact(contact);
|
contactStore.updateContact(contact);
|
||||||
|
@ -1113,7 +1113,7 @@ class Manager implements Signal {
|
||||||
try {
|
try {
|
||||||
Files.delete(fileEntry.toPath());
|
Files.delete(fileEntry.toPath());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
System.out.println("Failed to delete cached message file “" + fileEntry + "”: " + e.getMessage());
|
System.err.println("Failed to delete cached message file “" + fileEntry + "”: " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1170,7 +1170,7 @@ class Manager implements Signal {
|
||||||
cacheFile = getMessageCacheFile(envelope.getSource(), now, envelope.getTimestamp());
|
cacheFile = getMessageCacheFile(envelope.getSource(), now, envelope.getTimestamp());
|
||||||
Files.delete(cacheFile.toPath());
|
Files.delete(cacheFile.toPath());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
System.out.println("Failed to delete cached message file “" + cacheFile + "”: " + e.getMessage());
|
System.err.println("Failed to delete cached message file “" + cacheFile + "”: " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1216,7 +1216,8 @@ class Manager implements Signal {
|
||||||
File tmpFile = null;
|
File tmpFile = null;
|
||||||
try {
|
try {
|
||||||
tmpFile = Util.createTempFile();
|
tmpFile = Util.createTempFile();
|
||||||
DeviceGroupsInputStream s = new DeviceGroupsInputStream(retrieveAttachmentAsStream(syncMessage.getGroups().get().asPointer(), tmpFile));
|
try (InputStream attachmentAsStream = retrieveAttachmentAsStream(syncMessage.getGroups().get().asPointer(), tmpFile)) {
|
||||||
|
DeviceGroupsInputStream s = new DeviceGroupsInputStream(attachmentAsStream);
|
||||||
DeviceGroup g;
|
DeviceGroup g;
|
||||||
while ((g = s.read()) != null) {
|
while ((g = s.read()) != null) {
|
||||||
GroupInfo syncGroup = groupStore.getGroup(g.getId());
|
GroupInfo syncGroup = groupStore.getGroup(g.getId());
|
||||||
|
@ -1234,6 +1235,7 @@ class Manager implements Signal {
|
||||||
}
|
}
|
||||||
groupStore.updateGroup(syncGroup);
|
groupStore.updateGroup(syncGroup);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -1241,7 +1243,7 @@ class Manager implements Signal {
|
||||||
try {
|
try {
|
||||||
Files.delete(tmpFile.toPath());
|
Files.delete(tmpFile.toPath());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
System.out.println("Failed to delete temp file “" + tmpFile + "”: " + e.getMessage());
|
System.err.println("Failed to delete received groups temp file “" + tmpFile + "”: " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1254,7 +1256,8 @@ class Manager implements Signal {
|
||||||
try {
|
try {
|
||||||
tmpFile = Util.createTempFile();
|
tmpFile = Util.createTempFile();
|
||||||
final ContactsMessage contactsMessage = syncMessage.getContacts().get();
|
final ContactsMessage contactsMessage = syncMessage.getContacts().get();
|
||||||
DeviceContactsInputStream s = new DeviceContactsInputStream(retrieveAttachmentAsStream(contactsMessage.getContactsStream().asPointer(), tmpFile));
|
try (InputStream attachmentAsStream = retrieveAttachmentAsStream(contactsMessage.getContactsStream().asPointer(), tmpFile)) {
|
||||||
|
DeviceContactsInputStream s = new DeviceContactsInputStream(attachmentAsStream);
|
||||||
if (contactsMessage.isComplete()) {
|
if (contactsMessage.isComplete()) {
|
||||||
contactStore.clear();
|
contactStore.clear();
|
||||||
}
|
}
|
||||||
|
@ -1277,6 +1280,7 @@ class Manager implements Signal {
|
||||||
retrieveContactAvatarAttachment(c.getAvatar().get(), contact.number);
|
retrieveContactAvatarAttachment(c.getAvatar().get(), contact.number);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -1284,7 +1288,7 @@ class Manager implements Signal {
|
||||||
try {
|
try {
|
||||||
Files.delete(tmpFile.toPath());
|
Files.delete(tmpFile.toPath());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
System.out.println("Failed to delete temp file “" + tmpFile + "”: " + e.getMessage());
|
System.err.println("Failed to delete received contacts temp file “" + tmpFile + "”: " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1439,7 +1443,7 @@ class Manager implements Signal {
|
||||||
try {
|
try {
|
||||||
Files.delete(tmpFile.toPath());
|
Files.delete(tmpFile.toPath());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
System.out.println("Failed to delete temp file “" + tmpFile + "”: " + e.getMessage());
|
System.err.println("Failed to delete received attachment temp file “" + tmpFile + "”: " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return outputFile;
|
return outputFile;
|
||||||
|
@ -1493,7 +1497,7 @@ class Manager implements Signal {
|
||||||
try {
|
try {
|
||||||
Files.delete(groupsFile.toPath());
|
Files.delete(groupsFile.toPath());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
System.out.println("Failed to delete temp file “" + groupsFile + "”: " + e.getMessage());
|
System.err.println("Failed to delete groups temp file “" + groupsFile + "”: " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1525,7 +1529,7 @@ class Manager implements Signal {
|
||||||
try {
|
try {
|
||||||
Files.delete(contactsFile.toPath());
|
Files.delete(contactsFile.toPath());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
System.out.println("Failed to delete temp file “" + contactsFile + "”: " + e.getMessage());
|
System.err.println("Failed to delete contacts temp file “" + contactsFile + "”: " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue