diff --git a/dino-chat-export.sh b/dino-chat-export.sh index f7c235f..8ecb9fb 100755 --- a/dino-chat-export.sh +++ b/dino-chat-export.sh @@ -240,11 +240,15 @@ message_slots_to_selection() { # Prints a header/footer for message output, replacing useful variables output_message_cap() { - printf "$MESSAGE_HEADER" \ + local account_id="$1" + local partner_id="$2" + local message_cap="$3" + + echo "$message_cap" \ | sed 's%YOUR_JID%'"$(account_jid_and_nick "$account_id" | head -1)"'%g' \ | sed 's%YOUR_NICK%'"$(account_jid_and_nick "$account_id" | tail -1)"'%g' \ | sed 's%THEIR_JID%'"$(id_jid_and_nick "$partner_id" | head -1)"'%g' \ - | sed 's%THEIR_NICK%'"$(id_jid_and_nick "$partner_id" | tail -1)"'%g' + | sed 's%THEIR_NICK%'"$(id_jid_and_nick "$partner_id" | tail -1)"'%g' } @@ -254,7 +258,7 @@ output_messages_with_partner() { local partner_id="$2" local output_dir="$3" # optional, only used to guess avatar paths - output_message_cap "$account_id" "$partner_id" "$MESSAGE_HEADER" "$output_dir" + output_message_cap "$account_id" "$partner_id" "$MESSAGE_HEADER" sqlite "$DB_FILE" \ "SELECT FORMAT('$MESSAGE_FORMAT', @@ -265,7 +269,7 @@ output_messages_with_partner() { AND jid.id == $partner_id ORDER BY message.local_time ASC;" - output_message_cap "$account_id" "$partner_id" "$MESSAGE_FOOTER" "$output_dir" + output_message_cap "$account_id" "$partner_id" "$MESSAGE_FOOTER" } @@ -314,24 +318,20 @@ DB_FILE="$XDG_DATA_HOME/dino/dino.db" if test -z "$MESSAGE_FORMAT"; then MESSAGE_FORMAT="%s <%s> %s" fi -MESSAGE_FORMAT='

%s %s %s

' # The slots used in $MESSAGE_FORMAT. # May be DATE, JID, BODY, or AVATAR. Must be comma-delimited. if test -z "$MESSAGE_SLOTS"; then MESSAGE_SLOTS="DATE, JID, BODY" fi -MESSAGE_SLOTS="AVATAR, DATE, JID, BODY" -# A header printed before messages are output (could be "", for example) -MESSAGE_HEADER='\n\n\nConversation with THEIR_JID - YOUR_JID\n
'
+if test -z "$FILE_FORMAT"; then
+	FILE_FORMAT="File uploaded: %s"
+fi
 
-# A footer printed after messages are output (could be "", for example)
-MESSAGE_FOOTER=''
-
-
-IMAGE_FORMAT=''
-FILE_FORMAT='%s'
+if test -z "$IMAGE_FORMAT"; then
+	IMAGE_FORMAT="Image uploaded: %s"
+fi