| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -48,7 +48,7 @@ function Send-MatrixEvent {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        Write-Host ('Event {0} sent to room {1}' -f $response.event_id,$RoomId)
 | 
					 | 
					 | 
					 | 
					        Write-Host ('Event {0} sent to room {1}' -f $response.event_id,$RoomId)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    }
 | 
					 | 
					 | 
					 | 
					    }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					}
 | 
					 | 
					 | 
					 | 
					}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					function Send-MatrixNotice {
 | 
					 | 
					 | 
					 | 
					function Send-Pong {
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    param (
 | 
					 | 
					 | 
					 | 
					    param (
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        [Parameter(Mandatory=$true)]
 | 
					 | 
					 | 
					 | 
					        [Parameter(Mandatory=$true)]
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        [string]
 | 
					 | 
					 | 
					 | 
					        [string]
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -60,12 +60,29 @@ function Send-MatrixNotice {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        [Parameter(Mandatory=$false)]
 | 
					 | 
					 | 
					 | 
					        [Parameter(Mandatory=$false)]
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        [string]
 | 
					 | 
					 | 
					 | 
					        [string]
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $FormattedBody
 | 
					 | 
					 | 
					 | 
					        $FormattedBody,
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        [Parameter(Mandatory=$true)]
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        [string]
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        $OriginHomeServer,
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        [Parameter(Mandatory=$true)]
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        [int]
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        $Duration,
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        [Parameter(Mandatory=$true)]
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        [string]
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        $PingEventId
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    )
 | 
					 | 
					 | 
					 | 
					    )
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    $event = @{
 | 
					 | 
					 | 
					 | 
					    $event = @{
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        msgtype = 'm.notice'
 | 
					 | 
					 | 
					 | 
					        msgtype = 'm.notice'
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        body = $Body
 | 
					 | 
					 | 
					 | 
					        body = $Body
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        pong = @{
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            from = $OriginHomeServer
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            ms = $Duration
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            ping = $PingEventId
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    }
 | 
					 | 
					 | 
					 | 
					    }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    if($FormattedBody) {
 | 
					 | 
					 | 
					 | 
					    if($FormattedBody) {
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -174,7 +191,8 @@ function Open-MatrixEvent {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        #$bodies contains a hashtable with keys Body and FormattedBody
 | 
					 | 
					 | 
					 | 
					        #$bodies contains a hashtable with keys Body and FormattedBody
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $bodies = Join-Pong -RoomId $RoomId -PingEventId $Event.event_id -SenderMxId $Event.sender -ReadableTimespan $readable_timespan -Ball $Matches.ball
 | 
					 | 
					 | 
					 | 
					        $bodies = Join-Pong -RoomId $RoomId -PingEventId $Event.event_id -SenderMxId $Event.sender -ReadableTimespan $readable_timespan -Ball $Matches.ball
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        Send-MatrixNotice -RoomId $RoomId @bodies
 | 
					 | 
					 | 
					 | 
					        $origin_homeserver = $Event.sender.Split(':')[1]
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        Send-Pong -RoomId $RoomId @bodies -OriginHomeServer $origin_homeserver -Duration $difference.TotalMilliseconds -PingEventId $Event.event_id
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    }
 | 
					 | 
					 | 
					 | 
					    }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					}
 | 
					 | 
					 | 
					 | 
					}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					function Start-MatrixSync {
 | 
					 | 
					 | 
					 | 
					function Start-MatrixSync {
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
 
 |