|  | @@ -94,7 +94,7 @@ function xmpp_add_onion_address {
 | 
	
		
			
			| 94 | 94 |      if [ ${#onion_address} -eq 0 ]; then
 | 
	
		
			
			| 95 | 95 |          return
 | 
	
		
			
			| 96 | 96 |      fi
 | 
	
		
			
			| 97 |  | -    if ! grep "[\"${domain_name}\"] = \"${onion_address}\";" /etc/prosody/prosody.cfg.lua; then
 | 
	
		
			
			|  | 97 | +    if ! grep "${onion_address}" /etc/prosody/prosody.cfg.lua; then
 | 
	
		
			
			| 98 | 98 |          if grep -q "[\"${domain_name}\"]" /etc/prosody/prosody.cfg.lua; then
 | 
	
		
			
			| 99 | 99 |              sed -i "s|[\"${domain_name}\"].*|[\"${domain_name}\"] = \"${onion_address}\";|g" /etc/prosody/prosody.cfg.lua
 | 
	
		
			
			| 100 | 100 |          else
 | 
	
	
		
			
			|  | @@ -138,14 +138,19 @@ function xmpp_remove_onion_address {
 | 
	
		
			
			| 138 | 138 |      if [ ${#domain_name} -eq 0 ]; then
 | 
	
		
			
			| 139 | 139 |          return
 | 
	
		
			
			| 140 | 140 |      fi
 | 
	
		
			
			|  | 141 | +    xmpp_changed=
 | 
	
		
			
			| 141 | 142 |      if grep -q "[\"${domain_name}\"]" /etc/prosody/prosody.cfg.lua; then
 | 
	
		
			
			| 142 | 143 |          sed -i "/[\"${domain_name}\"]/d" /etc/prosody/prosody.cfg.lua
 | 
	
		
			
			|  | 144 | +        xmpp_changed=1
 | 
	
		
			
			| 143 | 145 |      fi
 | 
	
		
			
			| 144 | 146 |  
 | 
	
		
			
			| 145 | 147 |      if grep -q "= \"${domain_name}\";" /etc/prosody/prosody.cfg.lua; then
 | 
	
		
			
			| 146 | 148 |          sed -i "/= \"${domain_name}\";/d" /etc/prosody/prosody.cfg.lua
 | 
	
		
			
			|  | 149 | +        xmpp_changed=1
 | 
	
		
			
			|  | 150 | +    fi
 | 
	
		
			
			|  | 151 | +    if [ $xmpp_changed ]; then
 | 
	
		
			
			|  | 152 | +        systemctl restart prosody
 | 
	
		
			
			| 147 | 153 |      fi
 | 
	
		
			
			| 148 |  | -    systemctl restart prosody
 | 
	
		
			
			| 149 | 154 |  }
 | 
	
		
			
			| 150 | 155 |  
 | 
	
		
			
			| 151 | 156 |  function xmpp_remove_onion_address_interactive {
 | 
	
	
		
			
			|  | @@ -361,16 +366,6 @@ function update_prosody_modules {
 | 
	
		
			
			| 361 | 366 |          fi
 | 
	
		
			
			| 362 | 367 |      fi
 | 
	
		
			
			| 363 | 368 |  
 | 
	
		
			
			| 364 |  | -    # change to using pep rather than profile modules
 | 
	
		
			
			| 365 |  | -    if grep -q '"pep"' /etc/prosody/prosody.cfg.lua; then
 | 
	
		
			
			| 366 |  | -        # This strange dance seems to fix occasional breakage of PEP
 | 
	
		
			
			| 367 |  | -        # Is there a better solution?
 | 
	
		
			
			| 368 |  | -        sed -i 's|"pep"|"profile"|g' /etc/prosody/prosody.cfg.lua
 | 
	
		
			
			| 369 |  | -        systemctl restart prosody
 | 
	
		
			
			| 370 |  | -        sleep 4
 | 
	
		
			
			| 371 |  | -        sed -i 's|"profile"|"pep"|g' /etc/prosody/prosody.cfg.lua
 | 
	
		
			
			| 372 |  | -        systemctl restart prosody
 | 
	
		
			
			| 373 |  | -    fi
 | 
	
		
			
			| 374 | 369 |      if ! grep -q '"vcard"' /etc/prosody/prosody.cfg.lua; then
 | 
	
		
			
			| 375 | 370 |          systemctl stop prosody
 | 
	
		
			
			| 376 | 371 |          sed -i '/"pep"/a "vcard";' /etc/prosody/prosody.cfg.lua
 |