- if (!u->IsInvited(xname))
- {
- WriteServ(user->fd,"491 %s %s %s :Is not invited to channel %s",user->nick,u->nick,c->name,c->name);
- return;
- }
- if (has_channel(user,c))
- {
- WriteServ(user->fd,"492 %s %s :You're not on that channel!",user->nick, c->name);
- return;
- }
-
- u->RemoveInvite(xname);
- WriteServ(user->fd,"NOTICE %s :*** Uninvited %s from %s",user->nick,u->nick,c->name);
- WriteChannel(c,user,"NOTICE %s :*** %s uninvited %s.",c->name,user->nick,u->nick);
- }
+ if (!u->IsInvited(xname))
+ {
+ user->WriteServ("491 %s %s %s :Is not invited to channel %s",user->nick,u->nick,c->name,c->name);
+ return CMD_FAILURE;
+ }
+ if (!c->HasUser(user))
+ {
+ user->WriteServ("492 %s %s :You're not on that channel!",user->nick, c->name);
+ return CMD_FAILURE;
+ }
+
+ u->RemoveInvite(xname);
+ user->WriteServ("494 %s %s %s :Uninvited",user->nick,c->name,u->nick);
+ u->WriteServ("493 %s :You were uninvited from %s by %s",u->nick,c->name,user->nick);
+ c->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :*** %s uninvited %s.", c->name, user->nick, u->nick);
+
+ return CMD_SUCCESS;
+ }