Exemplo n.º 1
0
        filtered = True

    if filtered:
        filteredCount = query.count()

    results = query[start:start+limit]
    messages = []
    for result in results:
        print(result)
        message = result
        message.buffer # Populate
        message.buffer.network # Populate
        message.sender # Populate
        messages.append(message)

    
    result = {}
    result['data'] = [message.to_dict() for message in messages]
    result['recordsTotal'] = count
    result['recordsFiltered'] = filteredCount
    result['draw'] = draw

    session.commit()
    return jsonify(result)

if __name__ == '__main__':
    from config import uri
    session = quassel_session(uri)
    app.run()
    session.close()
Exemplo n.º 2
0
def new_db_session():
    return quassel_session(config.quassel_db_uri)
Exemplo n.º 3
0
import re
from datetime import date, timedelta
from flask import Flask, render_template, request, abort
from jinja2.utils import urlize
from sqlalchemy import asc, desc
from sqlalchemy.orm import joinedload
from quassel import quassel_session, Message, Buffer, Sender, Network

import settings


app = Flask(__name__)
app.config["PROPAGATE_EXCEPTIONS"] = True

## Quassel Connection
session = quassel_session(settings.uri)


def hash_nick(nick):
	hash = hashlib.sha1(nick.encode("utf-8"))
	return int(hash.hexdigest(), 16)


def process_message(message):
	# NOTE: Working around jinja2.utils.urlize being far too greedy on matches
	if not message:
		return ""
	message = message.replace("\x0f", " \x0f")
	message = urlize(message)
	message = message.replace(" \x0f", "\x0f")
	message = re.sub("\x03(\\d\\d)", r'<span class="color\1">', message)