Git Product home page Git Product logo

dino-chat-export's Introduction

dino-chat-export

Export chats and files from the XMPP client Dino into a plain-text format.

A screenshot of the same conversation two windows: Once in Dino, and once in HTML format displayed in Firefox.

Usage

$ ./dino-chat-export /tmp/xmpp-archive/

This script's only non-base requirement is sqlite3. It takes one argument, the output directory. The output tree ends up looking something like this:

$ tree /tmp/xmpp-archive/
/tmp/xmpp-archive/
└── [email protected]
    ├── [email protected]
    │   ├── files
    │   │   ├── sldfj_some_attached_file.pdf
    │   │   ├── their_avatar.png
    │   │   └── your_avatar.png
    │   └── messages.txt
    ├── [email protected]
    │   ├── files
    │   │   ├── their_avatar.png
    │   │   └── your_avatar.png
    │   └── messages.txt

By default, each message is output in YYYY-MM-DD <$user> $message format, but you can customize the output of this script with environment variables.

Environment variables

Variable Description Example
$DINO_HOME Dino data directory ~/.local/share/Dino
$MESSAGE_HEADER Text preceding each message file, with basic substitutions. <html><title>THEIR_JID</title><body>
Substitutions: THEIR_JID, YOUR_JID, THEIR_NICK, YOUR_NICK
$MESSAGE_FOOTER Likewise, but is output to the end of each message file. </body></html>
$MESSAGE_FORMAT Template for message output, in a printf style. [%s] <%s>: %s
$MESSAGE_SLOTS Comma-delimited arguments for $MESSAGE_FORMAT DATE,JID,BODY
Valid slots: AVATAR, BODY, DATE, JID
$IMAGE_FORMAT Format for message-bodies containing an image. <img src="%s" />
$FILE_FORMAT Same as $IMAGE_FORMAT, but for non-image files. <a href src="%s">Uploaded file</a>

Examples

HTML output

Here are some environment variables you can use to get rudimentary, unstyled HTML output:

$ export MESSAGE_FORMAT='<div class='message'><datetime>%s</datetime> <img class='avatar' src="%s" /> <b>%s</b> — <p>%s</p></div>'
MESSAGE_SLOTS='DATE,AVATAR,JID,BODY'
MESSAGE_HEADER='<!DOCTYPE html>
<html>
<head>
	<title>Conversation with THEIR_JID - YOUR_JID</title><
	<link rel="stylesheet" type="text/css" href="../style.css" />
</head>
<body>'
MESSAGE_FOOTER='</body>
</html>'
IMAGE_FORMAT='<img src="%s" />'
FILE_FORMAT='<a href="%s" />%s</a>'
$ ./dino-chat-export ~/Archive/Chats/XMPP/

Feel free to spice it up with some real CSS!

Meta

License is the GNU GPLv3+, COPYING.txt.

dino-chat-export's People

Contributors

jadedctrl avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.