www.pudn.com > coolchat.zip > chatroomattrib.pl
sub Roomattrib
{
if($UserData{'Room'} eq "main")
{#Only root can change the room title of main
&chatshowmsg;
exit 0;
}
MyDo $do_chatcheckmaster;
if ((&checkmaster($UserData{'User'},$UserData{'Room'}) ne 0)&&($UserData{'Group'} ne 99))
{#See wether the quest is come from the right user
&chatshowmsg;
exit 0;
}
my $changed = 0;
&lock("$ChatRoomListFile");
if(open(ROOMLIST, "<$ChatRoomListFile"))
{
@roomlines=;
close ROOMLIST;
if(open(ROOMLIST, ">$ChatRoomListFile"))
{
foreach $roomline(@roomlines)
{
($roomname,$usernum,$master,$visible,$nouse)=split(/:/,$roomline,5);
if(($UserData{'Room'} eq $roomname)&&((lc($UserData{'User'}) eq $master)||($UserData{'Group'} eq 99)))
{
if($visible eq 1)
{
$visible = 0;
}
else
{
$visible = 1;
}
$changed = 1;
print ROOMLIST "$roomname:$usernum:$master:$visible:$nouse";
}
else
{
print ROOMLIST $roomline;
}
}
close ROOMLIST;
}
}
&unlock("$ChatRoomListFile");
if($changed eq 0)
{#You dont has the right to change the room's attrib or system busy
&chatshowmsg;
exit 0;
}
my $message;
if($visible eq 0)
{
$message = "$UserData{'Nick'}($UserData{'User'}) 隐藏了这个聊天室! 你现在可以自由的交谈了!";
}
else
{
$message = "$UserData{'Nick'}($UserData{'User'}) 聊天室重新开放了!";
}
&UpdateChatData(10, $UserData{'User'},$UserData{'Room'},$UserData{'Nick'},$message);
&chatshowmsg;
}
1; #return true