Ticket #1058: patch_bitlbee.diff

File patch_bitlbee.diff, 786 bytes (added by Antoine Levitt <antoine.levitt@…>, at 2013-05-14T16:49:05Z)

Patch for channels with custom users

  • irc_channel.c

    === modified file 'irc_channel.c'
     
    786786{
    787787        struct irc_control_channel *icc = ic->data;
    788788        gboolean ret = FALSE;
     789
     790        if(!strcmp(ic->name,"&friends")) {
     791                static const char filename[] = "/home/antoine/.bitlbee_friends";
     792                FILE *file = fopen ( filename, "r" );
     793                if ( file != NULL )
     794                {
     795                        char line [ 128 ]; /* or other suitable maximum line size */
     796                       
     797                        while ( fgets ( line, sizeof line, file ) != NULL )
     798                        {
     799                                if (line[strlen(line) - 1] == '\n')
     800                                        line[strlen(line) - 1] = '\0';
     801                                       
     802                                if(!strncmp(iu->nick,line,sizeof line))
     803                                {
     804                                        return TRUE;
     805                                }
     806                        }
     807                        fclose ( file );
     808                }
     809                return FALSE;
     810        }
     811
    789812       
    790813        if( iu->bu == NULL )
    791814                return FALSE;