Changeset 85023c6 for protocols/nogaim.c


Ignore:
Timestamp:
2007-07-15T15:47:34Z (17 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
1baaef8
Parents:
1ffb46f
Message:

Added imcb_clean_handle() to sanitize handles properly (without putting
IRC-specific stuff into the Jabber module). Only using this in the MUC
code for now because this only works if the IM module can somehow convert
the cleaned up handle back to the original one.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/nogaim.c

    r1ffb46f r85023c6  
    9999}
    100100
    101  
    102101struct prpl *find_protocol(const char *name)
    103102{
     
    11141113        ic->acc->prpl->rem_deny( ic, handle );
    11151114}
     1115
     1116void imcb_clean_handle( struct im_connection *ic, char *handle )
     1117{
     1118        /* Accepts a handle and does whatever is necessary to make it
     1119           BitlBee-friendly. Currently this means removing everything
     1120           outside 33-127 (ASCII printable excl spaces), @ (only one
     1121           is allowed) and ! and : */
     1122        char out[strlen(handle)+1];
     1123        int s, d;
     1124       
     1125        s = d = 0;
     1126        while( handle[s] )
     1127        {
     1128                if( handle[s] > ' ' && handle[s] != '!' && handle[s] != ':' &&
     1129                    ( handle[s] & 0x80 ) == 0 )
     1130                {
     1131                        if( handle[s] == '@' )
     1132                        {
     1133                                /* See if we got an @ already? */
     1134                                out[d] = 0;
     1135                                if( strchr( out, '@' ) )
     1136                                        continue;
     1137                        }
     1138                       
     1139                        out[d++] = handle[s];
     1140                }
     1141                s ++;
     1142        }
     1143        out[d] = handle[s];
     1144       
     1145        strcpy( handle, out );
     1146}
Note: See TracChangeset for help on using the changeset viewer.