summary refs log tree commit diff stats
path: root/plugins/wmpa/wmpa.ico
blob: fb68714c7a7d276b55711529b18de0a2a8dae6ac (plain)
ofshex dumpascii
0000 00 00 01 00 01 00 20 20 00 00 01 00 20 00 a8 10 00 00 16 00 00 00 28 00 00 00 20 00 00 00 40 00 ......................(.......@.
0020 00 00 01 00 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
0040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
0060 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 03 00 00 00 05 00 00 00 06 00 00 ................................
0080 00 08 00 00 00 08 00 00 00 07 00 00 00 05 00 00 00 04 00 00 00 02 00 00 00 01 00 00 00 00 00 00 ................................
00a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
00c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
00e0 00 00 00 00 00 02 00 00 00 09 00 00 00 13 0c 08 05 2d 28 18 07 5e 3e 22 06 82 49 27 05 95 00 3f .................-(..^>"..I'...?
0100 69 97 00 37 5b 8d 00 24 3d 73 00 0c 15 4d 00 00 00 32 00 00 00 22 00 00 00 14 00 00 00 0a 00 00 i..7[..$=s...M...2..."..........
0120 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
0140 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
0160 00 00 1e 13 08 10 40 25 0a 71 79 42 09 cb 9a 4e 01 fb 9d 4f 00 ff 9e 4f 00 ff 9e 50 00 ff 00 87 ......@%.qyB...N...O...O...P....
0180 d8 ff 00 86 d8 ff 00 86 d7 ff 00 83 d5 fc 01 6b b0 da 01 3d 64 91 01 09 0f 36 00 00 00 18 00 00 ...............k...=d....6......
01a0 00 09 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
01c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 8b 5c 27 01 8c 56 ...........................\'..V
01e0 1c 60 97 51 08 e3 9f 52 00 ff a1 54 00 ff a3 55 00 ff a5 56 00 ff a6 57 00 ff a6 57 00 ff 00 91 .`.Q...R...T...U...V...W...W....
0200 db ff 00 90 db ff 00 8f da ff 00 8d da ff 00 8b d9 ff 00 88 d8 ff 01 80 cd ec 04 4b 79 75 04 3c ...........................Kyu.<
0220 5f 07 00 0
/*

  Copyright (c) 2010 Samuel Lidén Borell <samuel@kodafritt.se>

  Permission is hereby granted, free of charge, to any person obtaining a copy
  of this software and associated documentation files (the "Software"), to deal
  in the Software without restriction, including without limitation the rights
  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  copies of the Software, and to permit persons to whom the Software is
  furnished to do so, subject to the following conditions:

  The above copyright notice and this permission notice shall be included in
  all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  THE SOFTWARE.

*/

#include <stdlib.h>
#include <string.h>
#include "irc.h"

/**
 * Parses an IRC message. The words array should contain the message splitted
 * at spaces. The prefix and command is extracted from the message, and
 * parameters_offset is set to the index of the first parameter.
 */
bool irc_parse_message(const char *words[],
                       const char **prefix, const char **command,
                       size_t *parameters_offset) {
    size_t w = 1;
    if (prefix) *prefix = NULL;
    if (command) *command = NULL;
    
    // See if the message starts with a prefix (sender user)
    if (words[w][0] == ':') {
        if (prefix) *prefix = &words[w][1];
        w++;
    }
    
    // Check command
    if (words[w][0] == '\0') return false;
    if (command) *command = words[w];
    w++;
    
    *parameters_offset = w;
    return true;
}


/**
 * Finds the nick part of a "IRC prefix", which can have any
 * of the following forms:
 *
 *     nick
 *     nick@host
 *     nick!ident
 *     nick!ident@host
 */
char *irc_prefix_get_nick(const char *prefix) {
    const char *end;
    char *nick;
    size_t length;
    
    if (!prefix) return NULL;
    
    // Find end of nick
    end = prefix;
    while (*end != '\0' && *end != '!' && *end != '@') end++;
    
    // Allocate string
    length = end - prefix;
    nick = malloc(length+1);
    if (!nick) return NULL;
    
    // Copy to string
    memcpy(nick, prefix, length);
    nick[length] = '\0';
    return nick;
}


/**
 * Compares two nick names. Return 0 if equal. Otherwise the return value is
 * less than zero if a is less than b or greater than zero if a is greater
 * than b.
 */
int irc_nick_cmp(const char *a, const char *b) {
    char ac;
    char bc;
    char diff;
    for (;;) {
        ac = *(a++);
        bc = *(b++);
        
        // Change into IRC uppercase (see RFC 2812 section 2.2)
        if (ac >= 'a' && ac <= '~') ac &= ~0x20;
        if (bc >= 'a' && bc <= '~') bc &= ~0x20;
        
        diff = ac - bc;
        if (diff) return diff;
        if (!ac) return 0;
    }
}
00 0d 0e ................................ 0ee0 a6 3e 2c 2e ba c8 4d 4e db fe 39 3a e1 ff 06 06 da ff 00 00 da ff 00 00 da ff 00 00 da ff 00 ca .>,...MN..9:.................... 0f00 9e ff 00 ca 9e ff 00 ca 9d ff 01 c9 9c ff 15 c6 9c ff 1c a5 72 ff 14 77 36 d8 08 6b 25 52 00 00 ....................r..w6..k%R.. 0f20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................ 0f40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................ 0f60 00 00 00 00 00 00 66 66 dd 42 bb bb f7 a7 dd dd fb f0 8c 8c eb fe 46 48 d8 ff 2a 2c ce ff 1d ab ......ff.B............FH..*,.... 0f80 79 ff 1c a3 70 ff 1c 94 5c ff 1b 7f 42 f2 0a 69 23 af 07 67 20 51 07 67 20 03 00 00 00 00 00 00 y...p...\...B..i#..g.Q.g........ 0fa0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................ 0fc0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................ 0fe0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 d2 d3 f9 04 9b 9b e7 26 3e 3e c3 46 12 1d 99 58 06 56 .....................&>>.F...X.V 1000 2e 5e 06 63 1b 4f 06 65 1d 2a 06 64 1d 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 .^.c.O.e.*.d.................... 1020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff ff ................................ 1040 ff ff ff fc 3f ff ff e0 03 ff ff 80 01 ff fe 00 00 7f fc 00 00 3f f8 00 00 1f f0 00 00 0f f0 00 ....?................?.......... 1060 00 0f e0 00 00 07 e0 00 00 03 c0 00 00 03 c0 00 00 03 c0 00 00 03 c0 00 00 01 c0 00 00 01 80 00 ................................ 1080 00 01 c0 00 00 01 c0 00 00 03 c0 00 00 03 c0 00 00 03 c0 00 00 03 e0 00 00 07 e0 00 00 07 f0 00 ................................ 10a0 00 0f f0 00 00 0f f8 00 00 1f fc 00 00 3f fe 00 00 7f ff 80 01 ff ff e0 07 ff ff ff ff ff .............?................