<commit_before>/*
* Copyright (C) 2008-2011 <NAME> <EMAIL>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*/

#include "messageformatter.h"
#include <ircsender.h>
#include <ircutil.h>
#include <irc.h>
#include <QHash>
#include <QTime>
#include <QColor>

static bool nameLessThan(const QString &n1, const QString &n2)
{
    const bool o1 = n1.startsWith("@");
    const bool o2 = n2.startsWith("@");

    if (o1 && !o2)
        return true;
    if (!o1 && o2)
        return false;

    const bool v1 = n1.startsWith("+");
    const bool v2 = n2.startsWith("+");

    if (v1 && !v2 && !o2)
        return true;
    if (!v1 && !o1 && v2)<commit_msg>Add support for channelop modes +q (~, channel owner), +a (&, channel admin) and +h (%, halfop).<commit_after>/*
* Copyright (C) 2008-2011 <NAME> <EMAIL>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*/

#include "messageformatter.h"
#include <ircsender.h>
#include <ircutil.h>
#include <irc.h>
#include <QHash>
#include <QTime>
#include <QColor>

static bool nameLessThan(const QString &n1, const QString &n2)
{
    const bool q1 = n1.startsWith("~");
    const bool q2 = n2.startsWith("~");

    if (q1 && !q2)
        return true;
    if (!q1 && q2)
        return false;

    const bool a1 = n1.startsWith("&");
    const bool a2 = n2.startsWith("&");

    if (a1 && !a2 && !q2)
        return true;
    if (!a1 && !q1 && a2)
        return false;

    const bool o1 = n1.startsWith("@");
    const bool o2 = n2.startsWith("@");

    if (o1 && !o2 && !a2 && !q2)
        return true;
    if (!o1 && !a1 && !q1 && o2)
        return false;

    const bool h1 = n1.startsWith("%");
    const bool h2 = n2.startsWith("%");

    if (h1 && !h2 && !o2 && !a2 && !q2)
        return true;
    if (!h1 && !o1 && !a1 && !q1 && h2)
        return false;

    const bool v1 = n1.startsWith("+");
    const bool v2 = n2.startsWith("+");

    if (v1 && !v2 && !h2 && !o2 && !a2 && !q2)
        return true;
    if (!v1 && !h1 && !o1 && !a1 && !q1 && v2)
{'fraction_non_alphanumeric': 0.14241164241164242, 'fraction_numerical': 0.03465003465003465, 'mean_word_length': 3.0547752808988764, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4211331', 'n_tokens_mistral': 1004, 'n_tokens_neox': 979, 'n_words': 370}