parent
							
								
									aa9aadacf1
								
							
						
					
					
						commit
						d89e93ad47
					
				| @ -120,6 +120,8 @@ attachments are downloaded to the config directory. | ||||
| *-t* TIMEOUT, *--timeout* TIMEOUT:: | ||||
| 	Number of seconds to wait for new messages (negative values disable timeout). | ||||
| 	Default is 5 seconds. | ||||
| *--ignore-attachments*:: | ||||
| 	Don’t download attachments of received messages. | ||||
| 
 | ||||
| updateGroup | ||||
| ~~~~~~~~~~~ | ||||
| @ -179,6 +181,8 @@ libunixsocket-java ArchLinux: libmatthew-unix-java (AUR)). | ||||
| 
 | ||||
| *--system*:: | ||||
| 	Use DBus system bus instead of user bus. | ||||
| *--ignore-attachments*:: | ||||
| 	Don’t download attachments of received messages. | ||||
| 
 | ||||
| 
 | ||||
| Examples | ||||
|  | ||||
| @ -375,8 +375,9 @@ public class Main { | ||||
|                         returnOnTimeout = false; | ||||
|                         timeout = 3600; | ||||
|                     } | ||||
|                     boolean ignoreAttachments = ns.getBoolean("ignore_attachments"); | ||||
|                     try { | ||||
|                         m.receiveMessages((long) (timeout * 1000), TimeUnit.MILLISECONDS, returnOnTimeout, new ReceiveMessageHandler(m)); | ||||
|                         m.receiveMessages((long) (timeout * 1000), TimeUnit.MILLISECONDS, returnOnTimeout, ignoreAttachments, new ReceiveMessageHandler(m)); | ||||
|                     } catch (IOException e) { | ||||
|                         System.err.println("Error while receiving messages: " + e.getMessage()); | ||||
|                         return 3; | ||||
| @ -549,8 +550,9 @@ public class Main { | ||||
|                             e.printStackTrace(); | ||||
|                             return 2; | ||||
|                         } | ||||
|                         ignoreAttachments = ns.getBoolean("ignore_attachments"); | ||||
|                         try { | ||||
|                             m.receiveMessages(1, TimeUnit.HOURS, false, new DbusReceiveMessageHandler(m, conn)); | ||||
|                             m.receiveMessages(1, TimeUnit.HOURS, false, ignoreAttachments, new DbusReceiveMessageHandler(m, conn)); | ||||
|                         } catch (IOException e) { | ||||
|                             System.err.println("Error while receiving messages: " + e.getMessage()); | ||||
|                             return 3; | ||||
| @ -722,11 +724,17 @@ public class Main { | ||||
|         parserReceive.addArgument("-t", "--timeout") | ||||
|                 .type(double.class) | ||||
|                 .help("Number of seconds to wait for new messages (negative values disable timeout)"); | ||||
|         parserReceive.addArgument("--ignore-attachments") | ||||
|                 .help("Don’t download attachments of received messages.") | ||||
|                 .action(Arguments.storeTrue()); | ||||
| 
 | ||||
|         Subparser parserDaemon = subparsers.addParser("daemon"); | ||||
|         parserDaemon.addArgument("--system") | ||||
|                 .action(Arguments.storeTrue()) | ||||
|                 .help("Use DBus system bus instead of user bus."); | ||||
|         parserDaemon.addArgument("--ignore-attachments") | ||||
|                 .help("Don’t download attachments of received messages.") | ||||
|                 .action(Arguments.storeTrue()); | ||||
| 
 | ||||
|         try { | ||||
|             Namespace ns = parser.parseArgs(args); | ||||
|  | ||||
| @ -883,7 +883,7 @@ class Manager implements Signal { | ||||
|         void handleMessage(SignalServiceEnvelope envelope, SignalServiceContent decryptedContent, Throwable e); | ||||
|     } | ||||
| 
 | ||||
|     private void handleSignalServiceDataMessage(SignalServiceDataMessage message, boolean isSync, String source, String destination) { | ||||
|     private void handleSignalServiceDataMessage(SignalServiceDataMessage message, boolean isSync, String source, String destination, boolean ignoreAttachments) { | ||||
|         String threadId; | ||||
|         if (message.getGroupInfo().isPresent()) { | ||||
|             SignalServiceGroup groupInfo = message.getGroupInfo().get(); | ||||
| @ -970,7 +970,7 @@ class Manager implements Signal { | ||||
|                 threadStore.updateThread(thread); | ||||
|             } | ||||
|         } | ||||
|         if (message.getAttachments().isPresent()) { | ||||
|         if (message.getAttachments().isPresent() && !ignoreAttachments) { | ||||
|             for (SignalServiceAttachment attachment : message.getAttachments().get()) { | ||||
|                 if (attachment.isPointer()) { | ||||
|                     try { | ||||
| @ -983,7 +983,7 @@ class Manager implements Signal { | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     public void retryFailedReceivedMessages(ReceiveMessageHandler handler) { | ||||
|     public void retryFailedReceivedMessages(ReceiveMessageHandler handler, boolean ignoreAttachments) { | ||||
|         final File cachePath = new File(getMessageCachePath()); | ||||
|         if (!cachePath.exists()) { | ||||
|             return; | ||||
| @ -1014,7 +1014,7 @@ class Manager implements Signal { | ||||
|                     } catch (Exception e) { | ||||
|                         continue; | ||||
|                     } | ||||
|                     handleMessage(envelope, content); | ||||
|                     handleMessage(envelope, content, ignoreAttachments); | ||||
|                 } | ||||
|                 save(); | ||||
|                 handler.handleMessage(envelope, content, null); | ||||
| @ -1027,8 +1027,8 @@ class Manager implements Signal { | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     public void receiveMessages(long timeout, TimeUnit unit, boolean returnOnTimeout, ReceiveMessageHandler handler) throws IOException { | ||||
|         retryFailedReceivedMessages(handler); | ||||
|     public void receiveMessages(long timeout, TimeUnit unit, boolean returnOnTimeout, boolean ignoreAttachments, ReceiveMessageHandler handler) throws IOException { | ||||
|         retryFailedReceivedMessages(handler, ignoreAttachments); | ||||
|         final SignalServiceMessageReceiver messageReceiver = new SignalServiceMessageReceiver(URL, TRUST_STORE, username, password, deviceId, signalingKey, USER_AGENT); | ||||
|         SignalServiceMessagePipe messagePipe = null; | ||||
| 
 | ||||
| @ -1067,7 +1067,7 @@ class Manager implements Signal { | ||||
|                     } catch (Exception e) { | ||||
|                         exception = e; | ||||
|                     } | ||||
|                     handleMessage(envelope, content); | ||||
|                     handleMessage(envelope, content, ignoreAttachments); | ||||
|                 } | ||||
|                 save(); | ||||
|                 handler.handleMessage(envelope, content, exception); | ||||
| @ -1087,17 +1087,17 @@ class Manager implements Signal { | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     private void handleMessage(SignalServiceEnvelope envelope, SignalServiceContent content) { | ||||
|     private void handleMessage(SignalServiceEnvelope envelope, SignalServiceContent content, boolean ignoreAttachments) { | ||||
|         if (content != null) { | ||||
|             if (content.getDataMessage().isPresent()) { | ||||
|                 SignalServiceDataMessage message = content.getDataMessage().get(); | ||||
|                 handleSignalServiceDataMessage(message, false, envelope.getSource(), username); | ||||
|                 handleSignalServiceDataMessage(message, false, envelope.getSource(), username, ignoreAttachments); | ||||
|             } | ||||
|             if (content.getSyncMessage().isPresent()) { | ||||
|                 SignalServiceSyncMessage syncMessage = content.getSyncMessage().get(); | ||||
|                 if (syncMessage.getSent().isPresent()) { | ||||
|                     SignalServiceDataMessage message = syncMessage.getSent().get().getMessage(); | ||||
|                     handleSignalServiceDataMessage(message, true, envelope.getSource(), syncMessage.getSent().get().getDestination().get()); | ||||
|                     handleSignalServiceDataMessage(message, true, envelope.getSource(), syncMessage.getSent().get().getDestination().get(), ignoreAttachments); | ||||
|                 } | ||||
|                 if (syncMessage.getRequest().isPresent()) { | ||||
|                     RequestMessage rm = syncMessage.getRequest().get(); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 AsamK
						AsamK