Add menu point to show rooms.txt and fix participant query
- New menu point B: Show existing rooms.txt file - Fixed list_room_participants() with multiple query methods - Tests room_token, room_id, attendee_id, user_id, actor_id Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
@ -175,7 +175,7 @@ list_room_participants() {
|
||||
echo "Teilnehmer des Chats '$room_token':"
|
||||
echo ""
|
||||
|
||||
# Teilnehmer direkt mit room_token abfragen
|
||||
# Methode 1: Direkt mit room_token
|
||||
mysql -h "$DB_HOST" -u "$DB_USER" -p"$DB_PASS" "$DB_NAME" -e "
|
||||
SELECT DISTINCT u.uid AS Username
|
||||
FROM \`${DB_PREFIX}talk_attendees\` a
|
||||
@ -184,8 +184,8 @@ list_room_participants() {
|
||||
ORDER BY u.uid
|
||||
" 2>/dev/null
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
# Alternative: mit room_id
|
||||
if [ $? -ne 0 ] || [ $(mysql -h "$DB_HOST" -u "$DB_USER" -p"$DB_PASS" "$DB_NAME" -N -e "SELECT COUNT(*) FROM \`${DB_PREFIX}talk_attendees\` WHERE room_token = '$room_token'" 2>/dev/null) -eq 0 ]; then
|
||||
# Methode 2: Mit room_id und attendee_id
|
||||
local room_id=$(mysql -h "$DB_HOST" -u "$DB_USER" -p"$DB_PASS" "$DB_NAME" -N -e "SELECT id FROM \`${DB_PREFIX}talk_rooms\` WHERE token = '$room_token'" 2>/dev/null)
|
||||
if [ -n "$room_id" ]; then
|
||||
mysql -h "$DB_HOST" -u "$DB_USER" -p"$DB_PASS" "$DB_NAME" -e "
|
||||
@ -195,15 +195,29 @@ list_room_participants() {
|
||||
WHERE a.room_id = '$room_id'
|
||||
ORDER BY u.uid
|
||||
" 2>/dev/null
|
||||
|
||||
if [ $? -ne 0 ] || [ $(mysql -h "$DB_HOST" -u "$DB_USER" -p"$DB_PASS" "$DB_NAME" -N -e "SELECT COUNT(*) FROM \`${DB_PREFIX}talk_attendees\` WHERE room_id = '$room_id'" 2>/dev/null) -eq 0 ]; then
|
||||
# Methode 3: Mit actor_id
|
||||
mysql -h "$DB_HOST" -u "$DB_USER" -p"$DB_PASS" "$DB_NAME" -e "
|
||||
SELECT DISTINCT u.uid AS Username
|
||||
FROM \`${DB_PREFIX}talk_attendees\` a
|
||||
LEFT JOIN \`${DB_PREFIX}users\` u ON a.actor_id = u.uid
|
||||
WHERE a.room_id = '$room_id' AND a.actor_type = 'users'
|
||||
ORDER BY u.uid
|
||||
" 2>/dev/null
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo -e "${RED}Fehler: Konnte Teilnehmer nicht abfragen!${NC}"
|
||||
echo "Mögliche Ursachen:"
|
||||
echo " - Raum-Token existiert nicht"
|
||||
echo " - Tabellenstruktur anders als erwartet"
|
||||
echo " - Keine Berechtigung"
|
||||
echo "Versuche manuelle Abfrage..."
|
||||
echo ""
|
||||
echo "Führe diesen Befehl aus, um die Struktur zu prüfen:"
|
||||
echo " mysql -h localhost -u d037e856 -paUVp7cvBdKyKac5HGmsw d037e856 -e \"DESCRIBE kwcL2_talk_attendees;\""
|
||||
echo ""
|
||||
echo "Und diesen, um Teilnehmer zu finden:"
|
||||
echo " mysql -h localhost -u d037e856 -paUVp7cvBdKyKac5HGmsw d037e856 -e \"SELECT * FROM kwcL2_talk_attendees WHERE room_token = '$room_token' OR room_id = (SELECT id FROM kwcL2_talk_rooms WHERE token = '$room_token');\""
|
||||
fi
|
||||
|
||||
echo ""
|
||||
@ -229,6 +243,7 @@ show_menu() {
|
||||
echo -e "${YELLOW}7.${NC} Chat entsperren"
|
||||
echo -e "${YELLOW}8.${NC} Chat-Info anzeigen"
|
||||
echo -e "${YELLOW}9.${NC} Alle Räume auflisten (-> rooms.txt)"
|
||||
echo -e "${YELLOW}B.${NC} rooms.txt anzeigen"
|
||||
echo -e "${YELLOW}A.${NC} Teilnehmer eines Chats auflisten"
|
||||
echo -e "${YELLOW}D.${NC} Debug-Informationen"
|
||||
echo -e "${YELLOW}0.${NC} Beenden"
|
||||
@ -410,13 +425,32 @@ show_chat_info() {
|
||||
read -p "Enter..."
|
||||
}
|
||||
|
||||
show_rooms_file() {
|
||||
show_menu
|
||||
local file="./rooms.txt"
|
||||
|
||||
if [ ! -f "$file" ]; then
|
||||
echo -e "${RED}Fehler: Datei $file existiert nicht!${NC}"
|
||||
echo -e "Bitte zuerst Menüpunkt 9 (Alle Räume auflisten) ausführen.${NC}"
|
||||
read -p "Enter..." && return
|
||||
fi
|
||||
|
||||
echo -e "\n${GREEN}=================================================================${NC}"
|
||||
echo -e "${GREEN} Inhalt von $file${NC}"
|
||||
echo -e "${GREEN}=================================================================${NC}"
|
||||
echo ""
|
||||
cat "$file"
|
||||
echo ""
|
||||
read -p "Enter..."
|
||||
}
|
||||
|
||||
# ============================================================================
|
||||
# HAUPT SCHLEIFE
|
||||
# ============================================================================
|
||||
|
||||
while true; do
|
||||
show_menu
|
||||
read -p "Wählen Sie [0-9,A,D]: " choice
|
||||
read -p "Wählen Sie [0-9,A,B,D]: " choice
|
||||
case $choice in
|
||||
1) create_chat ;;
|
||||
2) add_user_to_chat ;;
|
||||
@ -427,6 +461,7 @@ while true; do
|
||||
7) unlock_chat ;;
|
||||
8) show_chat_info ;;
|
||||
9) list_all_rooms ;;
|
||||
B|b) show_rooms_file ;;
|
||||
A|a) list_room_participants ;;
|
||||
D|d) show_debug ;;
|
||||
0) echo -e "\n${GREEN}Auf Wiedersehen!${NC}" && exit 0 ;;
|
||||
|
||||
Reference in New Issue
Block a user