Bonjour,

J'utilise un Robot de Gestion de Salon appelé CS6.0 ( ChanService ). J'ai un soucis avec celui-ci dans la protection des Admins et Users. Je m'explique, afin d'éviter d'être kick/Ban par le Robot, il existe une protection. Le problème est que même la Protection activée sur moi ( en tant qu'Admin ), le Robot me kick quand même.
J'ai essayé de regarder un peu si je pouvais trouver le problème mais voila quand on ne connait pas la langage C et C++ on avance pas.
Je vous c/c le code du fichier kickban en espèrant qu'un codeur me trouvera la solution. J'espère avoir été assez clair dans ma demande. Merci d'avance.


Code c : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
 
/* CS6 - Channel Services src/kickban.c
 * CS5.0, CS5.1 and CS6.0 Copyright © 1998-1999 Chris Birch(IRCore)
 */
 
#include <bot.h>
 
void kick_ban(char *who, char *rest)
{
   struct userinfo *tmp, *usertmp, *admn, *admntmp;
   struct regsinfo *regs;
   struct nickinfo *tmp1, *tmp4;
   struct chaninfo *tmp2;
   struct authinfo *admnauth, *userauth, *tmp3;
   char *nick = NULL, *level = NULL, *chan = NULL, *tlevel = NULL, *nnwho = NULL, *uhost = NULL;
   char test[10000], *therest = NULL, newban[1000], *nwho = NULL, *banmask = NULL, *waste = NULL, *tnick = NULL, *helpname = NULL;
 
   char *foobar = NULL, test2[1000], *testtime = NULL;
 
   test[0]='\0';
   newban[0]='\0';
   nwho = nick2num(who);
   strcpy(test, rest);
   chan = strtok(test, " ");
   if(chan_check(chan, who) == -1) return;
   if(check(chan, who) == -1) return;
   admn = return_userinfo(who, csadminchan);
   tmp = return_userinfo(who, chan);
   helpname = get_command_name("kickban");
   if(level = strchr(rest, ' '))
   {
      *level++ = '\0';
      tlevel = strtok(NULL, " ");
      if(is_num(tlevel))
      {
	 if(nick = strchr(level, ' '))
	 {
	    *nick++ = '\0';
	    tnick = strtok(NULL, " ");
	    if(strchr(tnick, '!') || strchr(tnick, '@'))
	    {
	       do_help(who, helpname);
	       return;
	    }
	    if(!strcasecmp(nick, bot.nick))
	    {
	       send_to_server(":%s NOTICE %s : Now you went and did it, I'm leaving and not coming back\n", bot.nick, nwho);
	       send_to_server(":%s PART %s\n", bot.nick, chan);
	       return;
	    }
	    if(therest = strchr(nick, ' ')) *therest++ = '\0';
	    else
	       therest = NULL;
	    if(uhost = getuserhost(nick));
	    if(uhost == NULL)
	    {
	       send_to_server(":%s NOTICE %s : User is not currently online\n", bot.nick, nwho);
	       return;
	    }
	    banmask = get_ban_mask(uhost);
	    if(therest != NULL)
	       sprintf(newban, "%s %s %s %s", chan, level, banmask, therest);
	    else
	       sprintf(newban, "%s %s %s", chan, level, banmask);
	    usertmp = return_userinfo(banmask, chan);
	    admntmp = return_userinfo(banmask, csadminchan);
	    userauth = return_authinfo(chan, nick);
	    admnauth = return_authinfo(csadminchan, nick);
	    if(admntmp != NULL && admntmp->protect && admnauth != NULL && strcasecmp(who, bot.nick))
	    {
	       send_to_server(":%s NOTICE %s : Ce mask correspond à un Admin protégé \n\n", bot.nick, nwho);
	       return;
	    }
	    else if(usertmp != NULL && usertmp->protect && userauth != NULL && strcasecmp(who, bot.nick))
	    {
	       send_to_server(":%s NOTICE %s : Ce mask correspond à un user protégé \n", bot.nick, nwho);   
	       return;
	    }
	    ban(who, newban);
	    nnwho=nick2num(nick);
 
	    if (therest != NULL)
	    {
	       strcpy(test2, therest);
	       testtime = strtok(test2, " ");
	       if(strchr(testtime, ':'))
	       {
		  if(foobar = strchr(therest, ' ')) *foobar++ = '\0';
		  send_to_server(":%s KICK %s %s :%s\n", bot.nick, chan, nnwho, foobar);
	       }
	       else
	       {
		  send_to_server(":%s KICK %s %s :%s\n", bot.nick, chan, nnwho, therest);
	       }
	    }
	    else
	    {
	       send_to_server(":%s KICK %s %s :%s\n", bot.nick, chan, nnwho, reason);
	    }
	    tmp1 = nickhead;
	    while(tmp1 != NULL)
	    {
	       tmp2 = tmp1->chanhead;
	       while(tmp2 != NULL)
	       {
		  if(!strcasecmp(chan, tmp2->channel))
		  {
		     tmp3 = return_authinfo(chan, tmp1->nick);
		     if(tmp3 != NULL && tmp2->is_ops)
			send_to_server(":%s NOTICE %s : IriX a kickban %s de %s ( %s [%s])\n", bot.nick, tmp1->numeric, nick, chan, reason, who);
		  }
		  tmp2 = tmp2->next;
	       }
	       tmp1 = tmp1->next;
	    }
	 }
	 else
	 {
	    do_help(who, helpname);
	    return;
	 }
      }
      else
      {
	 if(strchr(tlevel, '!') || strchr(tlevel, '@'))
	 {
	    do_help(who, helpname);
	    return;
	 }
	 if(therest = strchr(level, ' ')) *therest++ = '\0';
	 else
	    therest = NULL;
	 if(!strcasecmp(level, bot.nick))
	 {
	    send_to_server(":%s NOTICE %s : Now you went and did it, I'm leaving and not coming back\n", bot.nick, nwho);
	    send_to_server(":%s PART %s\n", bot.nick, chan);
	    return;
	 }
	 if(uhost = getuserhost(level));
	 if(uhost == NULL)
	 {
	    send_to_server(":%s NOTICE %s : User is not currently online\n", bot.nick, nwho);
	    return;
	 }
	 banmask = get_ban_mask(uhost);
	 if(therest != NULL)
	    sprintf(newban, "%s %s %s", chan, banmask, therest);
	 else
	    sprintf(newban, "%s %s", chan, banmask);
	 usertmp = return_userinfo(banmask, chan);
	 admntmp = return_userinfo(banmask, csadminchan);
	 userauth = return_authinfo(chan, level);
	 admnauth = return_authinfo(csadminchan, level);
	 if(admntmp != NULL && admntmp->protect && admnauth != NULL && strcasecmp(who, bot.nick))
	 {  
	    send_to_server(":%s NOTICE %s : Ce mask correspond à un Admin protégé \n", bot.nick, nwho);
	    return;
	 }	   
	 else if(usertmp != NULL && usertmp->protect && userauth != NULL && strcasecmp(who, bot.nick))
	 {  
	    send_to_server(":%s NOTICE %s : Ce mask correspond à un user protégé \n", bot.nick, nwho);                        
	    return;
	 }
	 ban(who, newban);
	 nnwho=nick2num(level);
	 if (therest != NULL)
	 {
	    strcpy(test2, therest);
	    testtime = strtok(test2, " ");
	    if(strchr(testtime, ':'))
	    {
	       if(foobar = strchr(therest, ' ')) *foobar++ = '\0';
	       send_to_server(":%s KICK %s %s :%s\n", bot.nick, chan, nnwho, foobar);
	    }
	    else
	    {
	       send_to_server(":%s KICK %s %s :%s\n", bot.nick, chan, nnwho, therest);
	    }
	 }
	 else
	 {
	    send_to_server(":%s KICK %s %s :%s\n", bot.nick, chan, nnwho, reason);
	 }
	 tmp1 = nickhead;
	 while(tmp1 != NULL)
	 {
	    tmp2 = tmp1->chanhead;
	    while(tmp2 != NULL)
	    {
	       if(!strcasecmp(chan, tmp2->channel))
	       {
		  tmp3 = return_authinfo(chan, tmp1->nick);
		  if(tmp3 != NULL && tmp2->is_ops)
		     send_to_server(":%s NOTICE %s : X has kickbanned %s from %s ( %s [%s])\n", bot.nick, tmp1->numeric, level, chan, reason, who);
	       }
	       tmp2 = tmp2->next;
	    }
	    tmp1 = tmp1->next;
	 }
      }
   }
   else
   {
      do_help(who, helpname);
      return;
   }
}