source: protocols/oscar/oscar_util.c @ 0b9daac

Last change on this file since 0b9daac was 0b9daac, checked in by dequis <dx@…>, at 2015-02-20T23:16:08Z

Reorganize include files to avoid conflicts with other libs

  • Change all header includes to be relative to the project root
  • Remove -I${includedir} from bitlbee.pc Cflags
  • Install lib and protocols headers to their own directories. So now it is:

/usr/include/bitlbee/*.h
/usr/include/bitlbee/lib/*.h
/usr/include/bitlbee/protocols/*.h

This breaks backwards compatibility of third party plugins, but now
they don't have to do ambiguous includes like #include <proxy.h>

This also fixes trac ticket 1170 - conflicts when libproxy and liboauth
are installed at the same time bitlbee is built, which the macports
project ran into several times.

  • Property mode set to 100644
File size: 1.3 KB
Line 
1#include "aim.h"
2#include <ctype.h>
3
4/*
5* int snlen(const char *)
6*
7* This takes a screen name and returns its length without
8* spaces.  If there are no spaces in the SN, then the
9* return is equal to that of strlen().
10*
11*/
12static int aim_snlen(const char *sn)
13{
14        int i = 0;
15        const char *curPtr = NULL;
16
17        if (!sn) {
18                return 0;
19        }
20
21        curPtr = sn;
22        while ((*curPtr) != (char) '\0') {
23                if ((*curPtr) != ' ') {
24                        i++;
25                }
26                curPtr++;
27        }
28
29        return i;
30}
31
32/*
33* int sncmp(const char *, const char *)
34*
35* This takes two screen names and compares them using the rules
36* on screen names for AIM/AOL.  Mainly, this means case and space
37* insensitivity (all case differences and spacing differences are
38* ignored).
39*
40* Return: 0 if equal
41*     non-0 if different
42*
43*/
44
45int aim_sncmp(const char *sn1, const char *sn2)
46{
47        const char *curPtr1 = NULL, *curPtr2 = NULL;
48
49        if (aim_snlen(sn1) != aim_snlen(sn2)) {
50                return 1;
51        }
52
53        curPtr1 = sn1;
54        curPtr2 = sn2;
55        while ((*curPtr1 != (char) '\0') && (*curPtr2 != (char) '\0')) {
56                if ((*curPtr1 == ' ') || (*curPtr2 == ' ')) {
57                        if (*curPtr1 == ' ') {
58                                curPtr1++;
59                        }
60                        if (*curPtr2 == ' ') {
61                                curPtr2++;
62                        }
63                } else {
64                        if (g_ascii_toupper(*curPtr1) != g_ascii_toupper(*curPtr2)) {
65                                return 1;
66                        }
67                        curPtr1++;
68                        curPtr2++;
69                }
70        }
71
72        /* Should both be NULL */
73        if (*curPtr1 != *curPtr2) {
74                return 1;
75        }
76
77        return 0;
78}
Note: See TracBrowser for help on using the repository browser.