----------------------------------------------------------------------
Crazy Squirrel
----------------------------------------------------------------------
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  %APPDATA%\CommFort  .\AppData_xxx.
  (->).

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

--   -------------------------------------------------
AddEvent(string Text, integer Style, bool PubTime, bool WriteLog)
	  
		Text - 
		Style - 
			0 -  ()
			1 -  ()
			2 -  ()
		PubTime -  
		WriteLog -   
	: AddEvent("TEXT", 0, true, false);

print(string Text)
	  
		Text - 
	 AddEvent("TEXT", 0, true, false);

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

LeaveChannel(string Ch)
	   
		Ch - 
	: LeaveChannel("main");

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

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

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

SetStatus(string Status, bool NoImp, bool NoSnd, bool NoMsg)
	 
		Status - 
		NoImp -    
		NoSnd -  
		NoMsg -     
	: SetStatus("test", true, true, true);

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

SetGreeting(string Ch, string Text)
	  
		Ch - 
		Text -  
	: SetGreeting("main", "line1\nline2");

SetRestriction(integer IdentType, string Object, integer Type, string Ch, integer Time, string Reason, bool Anonyme)
	 
		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(3, "", 3, "main", 5, "test", true);

ClearChannel(string Ch)
	  
		Ch - 
	: ClearChannel("main");

SetInfo(integer Icon, string Name, string Date, string Cont, string Job, string Note, string File)
	    
		Icon -  (0 - , 1 - )
		Name - 
		Date -  
		Cont -  
		Job -   
		Note - 
		File -  
	: SetInfo(0, "", "", "", "", "", "C:\\image.jpg");

GetConnectionState()
	   
		    :
			0 -    
			1 -  ,    
			2 -   
	: AddEvent(GetConnectionState().tostring(), 0, true, false);

GetCurrentUser()
	 
		    :
			string name -  
			string ip - IP-
			integer icon -  (0 - , 1 - )
	:
		local user = GetCurrentUser();
		AddEvent(user.name+" ("+user.ip+")("+user.icon+")", 0, true, false);

GetCurrentStatus()
	 
	: AddEvent(GetCurrentStatus(), 0, true, false);

GetCurrentChannel()
	 
	: AddEvent(GetCurrentChannel(), 0, true, false);

GetCurrentChannels()
	   
		     :
			string name -  
			string topic -  
	:
		local list = GetCurrentChannels();
		for(local i=0; i<list.len(); i++)
			AddEvent(list[i].name+" ("+list[i].topic+")", 0, true, false);

GetCurrentPrivateChannels()			
	   
		     .
	:
		local list = GetCurrentPrivateChannels();
		for(local i=0; i<list.len(); i++)
			AddEvent(list[i], 0, true, false);

GetChannelUsers(string Ch)
	   
		     :
			string name -  
			string ip - IP-
			integer icon -  (0 - , 1 - )
	:
		local list = GetChannelUsers("main");
		for(local i=0; i<list.len(); i++)
			AddEvent(list[i].name+" ("+list[i].ip+")("+list[i].icon+")", 0, true, false);		

GetOnlineUsers()
	   
		     :
			string name -  
			string ip - IP-
			integer icon -  (0 - , 1 - )
	:
		local list = GetOnlineUsers();
		for(local i=0; i<list.len(); i++)
			AddEvent(list[i].name+" ("+list[i].ip+")("+list[i].icon+")", 0, true, false);

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

GetUserInfo(string Name)
	    
		Name -  
		    :
			string ip - IP-
			integer icon -  (0 - , 1 - )
			string status - 
			bool activity -     (true,  )
			integer idletime -    
			string process -  
	:
		local info = GetUserInfo("");
		AddEvent(info.ip+", "+info.icon+", "+info.status+", "+info.activity+", "+info.idle+", "+info.process, 0, true, false);

GetChannelInfo(string Ch)
	   
		Ch - 
		    :
			string topic -  
			string topicuser -   ,  
			table topicdate -      
				day - 
				month - 
				year - 
				hour - 
				min - 
				sec - 
			string greeting - 
			integer imagemode -   
				0 -  
				1 -   
				2 -  
				3 -  
				4 -  
				5 -   
			bool visible -    (true,  )
			bool invite -    (true -    )
			bool topiclock -    (true -      )
	:
		local info = GetChannelInfo("main");
		AddEvent(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, 0, true, false);
		
GetCurrentUserInfo()
	  
		    :
			integer icon -  (0 - , 1 - )
			string name - 
			string date -  
			string cont -  
			string job -   
			string note - 
	:
		local info = GetCurrentUserInfo();
		AddEvent(info.icon+", "+info.name+", "+info.date+", "+info.cont+", "+info.job+", "+info.note, 0, true, false);

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

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

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