@@ -4,11 +4,12 @@ echo "[register-setup] Service starting..."
44
55# Wait for prosody to be ready
66echo "[register-setup] Waiting for prosody to be ready..."
7+ [ -z "$PROSODY_HTTP_PORT" ] && PROSODY_HTTP_PORT="5280"
78MAX_ATTEMPTS=60
89ATTEMPT=0
910
1011while [ $ATTEMPT -lt $MAX_ATTEMPTS ]; do
11- if curl --fail --silent --output /dev/null http://127.0.0.1:5280 /health 2>&1; then
12+ if curl --fail --silent --output /dev/null http://127.0.0.1:${PROSODY_HTTP_PORT} /health 2>&1; then
1213 echo "[register-setup] Prosody is ready!"
1314 break
1415 fi
@@ -133,7 +134,35 @@ if [[ ! -z $JIGASI_XMPP_PASSWORD ]]; then
133134 fi
134135fi
135136
136- echo "[register-setup] All users registered, service completed"
137+ # Capture both stdout and stderr
138+ OUTPUT=$(prosodyctl --config $PROSODY_CFG shell roster subscribe_both focus@$XMPP_AUTH_DOMAIN focus.$XMPP_DOMAIN 2>&1)
139+ RESULT=$?
140+
141+ echo "[register-setup] Roster command output:"
142+ echo "$OUTPUT"
143+
144+ if [ $RESULT -eq 0 ]; then
145+ echo "[register-setup] Roster subscription completed successfully"
146+
147+ # Reload mod_client_proxy module to apply roster changes
148+ echo "[register-setup] Reloading client_proxy module..."
149+ RELOAD_OUTPUT=$(prosodyctl --config $PROSODY_CFG shell module reload client_proxy 2>&1)
150+ RELOAD_RESULT=$?
151+
152+ echo "[register-setup] Module reload output:"
153+ echo "$RELOAD_OUTPUT"
154+
155+ if [ $RELOAD_RESULT -eq 0 ]; then
156+ echo "[register-setup] Module reloaded successfully"
157+ else
158+ echo "[register-setup] WARNING: Failed to reload module (exit code: $RELOAD_RESULT)"
159+ fi
160+ else
161+ echo "[register-setup] ERROR: Failed to setup roster subscription (exit code: $RESULT)"
162+ fi
163+
164+ echo "[register-setup] All users registered and roster modified, service completed"
165+
137166# This is a oneshot service - tell s6 to stop supervising and sleep
138167s6-svc -O /var/run/s6/services/70-register-setup
139168exec sleep infinity
0 commit comments