----------------------------------------------------------------------
Crazy Squirrel SV
----------------------------------------------------------------------
Copyright (C) 2011 CrazyVirus
E-mail: crazyvius@inbox.ru
ICQ: 438299
----------------------------------------------------------------------

--  ----------------------------------------------------------
    CommFort 5.
  Squirrel  (http://www.squirrel-lang.org).

     "PluginsData\CrazySquirrel\Scripts"    ".nut".

     -,        ,     .
       .
  OnPremoderation  OnScriptStop     ,     .

--  ---------------------------------------------------------
  Plugins   .
  PluginsData  %COMMON_APPDATA%\CommFort_server  .\AppData_xxx.
  (->).

--   ------------------------------------------
Events.nut
     .
Premoderation.nut
   .

--   -------------------------------------------------
print(string Text)
	    
		Text -   
	: print("Text");

ConnectUser(string Name, string IP, string Pass, bool MD5Pass, integer Icon)
	  
		Name - 
		IP - IP-
		Pass - 
		MD5Pass -  
			false -    
			true - MD5 - 
		Icon -  (0 - , 1 - )
	: ConnectUser("Name", "N/A", "123456", false, 0);

DisconnectUser(string Name)
	  
		Name - 
	: DisconnectUser("Name");

JoinChannel(string VUser, string Ch, bool Invis, bool Invite)
	      
		VUser -   
		Ch - 
		Invis -     
		Invite -    
	: JoinChannel("Name", "main", false, false);

LeaveChannel(string VUser, string Ch)
	   
		VUser -   
		Ch - 
	: LeaveChannel("Name", "main");

SendMessage(string VUser, string Ch, string Text, bool Flag, integer Type)
	 
		VUser -   
		Ch - 
		Text -  
		Flag -   ( 0  1) /   ( 2)
		Type -  
			0 -    
			1 -    
			2 -  
	: SendMessage("Name", "main", "test", false, 0);

SendImage(string VUser, string Ch, string File, bool Private)
	 
		VUser -   
		Ch -  /  
		File -  
		Private -    
	: SendImage("Name", "main", "C:\\image.jpg", false);

SetStatus(string VUser, string Status)
	 
		VUser -   
		Status - 
	: SetStatus("Name", "test");
	
SetIcon(string VUser, integer Icon)
	 
		VUser -   
		Icon - 
			0 - 
			1 - 
	: SetIcon("Name", 1);

SetTopic(string VUser, string Ch, string Text)
	  
		VUser -   
		Ch - 
		Text -  
	: SetTopic("Name", "main", "test");

SetGreeting(string VUser, string Ch, string Text)
	  
		VUser -   
		Ch - 
		Text -  
	: SetGreeting("Name", "main", "line1\nline2");
	
RenameChannel(string VUser, string Ch, string Text)
	 
		VUser -   
		Ch - 
		Text -   
	: RenameChannel("Name", "main", "main2");
	
DeleteChannel(string VUser, string Ch)
	 () 
		VUser -   
		Ch - 
	: DeleteChannel("Name", "main");

SetRestriction(string VUser, integer IdentType, string Object, integer Type, string Ch, integer Time, string Reason, bool Anonyme)
	 
		VUser -   
		IdentType -  
			0 - IP-
			1 -  IP- (   : 192.168.0.0-192.168.0.255)
			2 - ID 
			3 -   ( )
			4 -   ( IP-)
			5 -   ( ID )
			6 -   (   IP-)
			7 -   (   ID )
			8 -   ( IP-  ID )
			9 -   (   IP-,  ID )
		Object -  
		Type -  
			0 -    
			1 -   
			2 -    
			3 -    
			4 -     
			5 -     
		Ch - 
		Time -    
		Reason -  
		Anonyme -  
	: SetRestriction("Name", 3, "", 3, "main", 5, "test", true);

DeleteRestriction(string VUser, integer ID, string Reason)
	 
		VUser -   
		ID - ID 
		Reason - 
	: DeleteRestriction("Name", 1234, "");

AcceptActivation(string VUser, string Name)
	   
		VUser -   
		Name -   
	: AcceptActivation("Name", "user");
	
DeclineActivation(string VUser, string Name, string Reason)
	   
		VUser -   
		Name -   
		Reason - 
	: DeclineActivation("Name", "user", "");

DeleteActivation(string VUser, string Name)
	     
		VUser -   
		Name -    
	: DeleteActivation("Name", "user");

AddBulletin(string VUser, integer ID, string Title, string Text, bool Imp, bool NoComm, integer Time)
	 
		VUser -   
		ID - ID 
		Title - 
		Text -  
		Imp -  
			false -  
			true -  
		NoComm -   
			false -   
			true -   
		Time -     
	: AddBulletin("Name", 1234, "!", "--!", false, true, 60);

DeleteBulletin(string VUser, integer ID)
	 
		VUser -   
		ID - ID 
	: DeleteBulletin("Name", 1234);

AddComment(string VUser, integer ID, string Text)
	 
		VUser -   
		ID - ID 
		Text -  
	: AddComment("Name", 1234, "Text");

DeleteComment(string VUser, integer ID)
	 
		VUser -   
		ID - ID 
	: DeleteComment("Name", 1234);

SetPassword(string VUser, string Name, bool MD5Pass, string Pass)
	 
		VUser -   
		Name -  ,    
		MD5Pass -  
			false -    
			true - MD5 - 
		Pass -  
	: SetPassword("Name", "user", false, "12345");

DeleteAccount(string VUser, string Name)
	    
		VUser -   
		Name -   
	: DeleteAccount("Name", "user");

GetMaxImageSize(string Ch)
	    
		Ch -  
		    :
			integer bytes -    
			integer pixels -    
		       -    "&priv".
		    -     .
	:
		local sz = GetMaxImageSize("main");
		print(sz.bytes+", "+sz.pixels);

GetChannels()
	  
		     :
			string name -  
			integer userscount -    
			string topic -  
	:
		local list = GetChannels();
		local s = "\n";
		for(local i=0; i<list.len(); i++)
			s = s + "\n"+list[i].name+" ("+list[i].userscount+")("+list[i].topic+")";
		print(s);

GetOnlineUsers()
	   
		     :
			string name -  
			string ip - IP-
			integer icon -  (0 - , 1 - )
	:
		local list = GetOnlineUsers();
		local s = "\n";
		for(local i=0; i<list.len(); i++)
			s = s + "\n"+list[i].name+" ("+list[i].ip+")("+list[i].icon+")";
		print(s);

GetRegisteredUsers()
	  
		     :
			string name -  
			string ip - IP-
			integer icon - 
				0 - 
				1 - 
	:
		local list = GetRegisteredUsers();
		local s = "\n";
		for(local i=0; i<list.len(); i++)
			s = s + "\n"+list[i].name+" ("+list[i].ip+")("+list[i].icon+")";
		print(s);

GetActivations()
	   
		     :
			integer status - 
				0 -  
				1 - 
				2 - 
			table date -   .   :
				integer day - 
				integer month - 
				integer year - 
				integer hour - 
				integer min - 
				integer sec - 
			string name -  
			string ip - IP-
			string compid - ID 
			string message - 
			string moderator -   ,  
			string reason -  
	:
		local list = GetActivations();
		local s = "\n";
		for(local i=0; i<list.len(); i++)
			s = s + "\n"+list[i].status+", "+list[i].date.day+"."+list[i].date.month+"."+list[i].date.year+" "+list[i].date.hour+":"+list[i].date.min+":"+list[i].date.sec+", "+list[i].name+", "+list[i].ip+", "+list[i].id+", "+list[i].message+", "+list[i].moderator+", "+list[i].reason;
		print(s);

GetRestrictions()
	 
		     :
			integer id - ID 
			table date -     .   :
				integer day - 
				integer month - 
				integer year - 
				integer hour - 
				integer min - 
				integer sec - 
			table time -     .   :
				integer day - 
				integer hour - 
				integer min - 
			integer identtype -  
				0 - IP-
				1 -  IP- (   : 192.168.0.0-192.168.0.255)
				2 - ID 
				3 -   ( )
				4 -   ( IP-)
				5 -   ( ID )
				6 -   (   IP-)
				7 -   (   ID )
				8 -   ( IP-  ID )
				9 -   (   IP-,  ID )
			string name -  
			string ip - IP-
			string iprange -  IP-
			string compid - ID 
			integer resttype -  
				0 -    
				1 -   
				2 -    
				3 -    
				4 -     
				5 -     
			string channel - 
			string moderator -   
			string reason - 
	:
		local list = GetRestrictions();
		local s = "\n";
		for(local i=0; i<list.len(); i++)
			s = s + "\n"+list[i].status+", "+list[i].date.day+"."+list[i].date.month+"."+list[i].date.year+" "+list[i].date.hour+":"+list[i].date.min+":"+list[i].date.sec+", "+list[i].name+", "+list[i].ip+", "+list[i].id+", "+list[i].message+", "+list[i].moderator+", "+list[i].reason;
		print(s);

GetIPStatus(string Name)
	  IP-
		Name -  
		 true,  IP- , false   .
	: if(GetIPStatus("Name")) print("IP- ");

GetAccountPassword(string Name)
	  
		Name -  
		 MD5 - .
	: print(GetAccountPassword("Name"));

GetAccountIP(string Name)
	IP-  
		Name -  
		 IP-.
	: print(GetAccountIP("Name"));

GetAccountID(string Name)
	ID   
		Name -  
		 ID .
	: print(GetAccountID("Name"));

GetUserInfo(string Name)
	   
		Name -  
		    :
			string ip - IP-
			string publicip -   IP-
			string compid - ID 
			integer icon - 
				0 - 
				1 - 
			string status - 
			string version -  
			bool activity -     (true,  )
			integer idletime -    
			string process -  
	:
		local info = GetUserInfo("Name");
		print(info.ip+", "+info.publicip+", "+info.compid+", "+info.icon+", "+info.status+", "+info.version+", "+info.activity+", "+info.idletime+", "+info.process);

GetChannelInfo(string Ch)
	   
		Ch - 
		    :
			string topic -  
			string topicuser -   ,  
			table date -      .   :
				integer day - 
				integer month - 
				integer year - 
				integer hour - 
				integer min - 
				integer sec - 
			string greeting - 
			integer imagemode -   
				0 -  
				1 -   
				2 -  
				3 -  
				4 -  
				5 -   
			bool visible -    (true,  )
			bool invite -    (true -    )
			bool topiclock -    (true -      )
	:
		local info = GetChannelInfo("main");
		print(info.topic+", "+info.topicuser+", "+info.topicdate.day+"."+info.topicdate.month+"."+info.topicdate.year+" "+info.topicdate.hour+":"+info.topicdate.min+":"+info.topicdate.sec+", "+info.greeting+", "+info.imagemode+", "+info.visible+", "+info.invite+", "+info.topiclock);

GetBulletinsCategories(string Name)
	   
		Name -  
		     :
			integer id - ID 
			string name -  
			string desc -  
	:
		local list = GetBulletinsCategories("Name");
		local s = "\n";
		for(local i=0; i<list.len(); i++)
			s = s + "\n"+list[i].id+", "+list[i].name+", "+list[i].desc;
		print(s);

GetBulletins(integer ID)
	 
		ID - ID 
		     :
			integer id - ID 
			table date -     .   :
				integer day - 
				integer month - 
				integer year - 
				integer hour - 
				integer min - 
				integer sec - 
			string username -  
			string title -  
			integer commcount -  
	:
		local list = GetBulletins(1234);
		local s = "\n";
		for(local i=0; i<list.len(); i++)
			s = s + "\n"+list[i].id+", "+list[i].date.day+"."+list[i].date.month+"."+list[i].date.year+" "+list[i].date.hour+":"+list[i].date.min+":"+list[i].date.sec+", "+list[i].username+", "+list[i].title+", "+list[i].commcount;
		print(s);
		
GetBulletin(integer ID)
	     
		ID - ID 
		    :
			table date -     .   :
				integer day - 
				integer month - 
				integer year - 
				integer hour - 
				integer min - 
				integer sec - 
			table time -    .   :
				integer day - 
				integer hour - 
				integer min - 
			string username -  
			string title -  
			string text -  
			string question -     
			integer varcount -     
			array vars -  .     :
				string var -  
				integer count -  
			integer commcount -  
			array comments - .     :
				integer id - ID 
				table date -     .   :
					integer day - 
					integer month - 
					integer year - 
					integer hour - 
					integer min - 
					integer sec - 
				string username -   
				string text -  
	:
		local info = GetBulletin(1234);
		print(info.date.day+"."+info.date.month+"."+info.date.year+" "+info.date.hour+":"+info.date.min+":"+info.date.sec+", "+info.time.day+":"+info.time.hour+":"+info.time.min+", "+info.username+", "+info.title+", "+info.text+", "+info.question+", "+info.varcount+", "+info.commcount);
		if(info.varcount)
		{
			local s = "\n";
			for(local i=0; i<info.vars.len(); i++)
				s = s + "\n"+info.vars[i].var+", "+info.vars[i].count;
			print(s);
		}
		if(info.commcount)
		{
			local s = "\n";
			for(local i=0; i<info.comments.len(); i++)
				s = s + "\n"+info.comments[i].id+", "+info.comments[i].username+", "+info.comments[i].text;
			print(s);
		}
		
GetCurrentChannels(string VUser)
	 ,     
		VUser -   
		     :
			string name -  
			integer userscount -    
			string topic -  
	:
		local list = GetCurrentChannels("Name");
		local s = "\n";
		for(local i=0; i<list.len(); i++)
			s = s + "\n"+list[i].name+" ("+list[i].userscount+")("+list[i].topic+")";
		print(s);

GetChannelUsers(string VUser, string Ch)
	   ,     
		VUser -   
		Ch - 
		     :
			string name -  
			string ip - IP-
			integer icon - 
				0 - 
				1 - 
	:
		local list = GetChannelUsers("Name", "main");
		local s = "\n";
		for(local i=0; i<list.len(); i++)
			s = s + "\n"+list[i].name+" ("+list[i].ip+")("+list[i].icon+")";	
		print(s);

GetAccountRights(string Name, integer Type, string Ch)
	   
		Name -  
		Type -  
			0 -  
			1 -   
			2 -    
			3 -   
			4 -   
			5 -   
			6 -   
			7 -  IP-
			8 -    
			9 -    
		Ch - 
		 true,   , false   .
	: if(GetAccountRights("Name", 4, "")) print("   ");

Sleep(integer Time)
	 
		Time -   
	: Sleep(1000);

--   ----------------------------------------------
PluginsDataDir -  PluginsData
ScriptsDir -  
CommFortDir -  

--  -----------------------------------------------------------
!
!list
    
! <_>
!start <_>
   
! <_>
!stop <_>
   

--   ----------------------------------------------------
1.1:
     /    
   Squirrel  3.0.1