Advertisement
danielawesome7

RTB v3.5 IRC Client .cs file

Sep 2nd, 2014
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 53.82 KB | None | 0 0
  1. //#############################################################################
  2. //#
  3. //# Return to Blockland - Version 3.5
  4. //#
  5. //# -------------------------------------------------------------------------
  6. //#
  7. //# $Rev: 112 $
  8. //# $Date: 2009-09-05 18:17:49 +0100 (Sat, 05 Sep 2009) $
  9. //# $Author: Ephialtes $
  10. //# $URL: http://svn.returntoblockland.com/trunk/RTBC_IRCClient.cs $
  11. //#
  12. //# $Id: RTBC_IRCClient.cs 112 2009-09-05 17:17:49Z Ephialtes $
  13. //#
  14. //# -------------------------------------------------------------------------
  15. //#
  16. //# IRC Client (RTBIC/CIRCClient)
  17. //#
  18. //#############################################################################
  19. //Register that this module has been loaded
  20. $RTB::RTBC_IRCClient = 1;
  21.  
  22. //*********************************************************
  23. //* GUI Modification
  24. //*********************************************************
  25. if(!isObject(MM_RTBIRCClientButton))
  26. {
  27. %btn = new GuiBitmapButtonCtrl(MM_RTBIRCClientButton)
  28. {
  29. profile = "GuiDefaultProfile";
  30. horizSizing = "relative";
  31. vertSizing = "relative";
  32. position = "416 160";
  33. extent = "224 40";
  34. minExtent = "8 2";
  35. visible = "1";
  36. text = " ";
  37. groupNum = "-1";
  38. buttonType = "PushButton";
  39. bitmap = $RTB::Path@"images/buttons/menu/btnIRCClient";
  40. command = "canvas.pushdialog(RTB_IRCClient);";
  41. lockAspectRatio = "1";
  42. alignLeft = "1";
  43. overflowImage = "0";
  44. mKeepCached = "1";
  45. mColor = "255 255 255 255";
  46. };
  47. MainMenuGui.add(%btn);
  48. }
  49. function MM_RTBIRCClientButton::onMouseEnter(%this)
  50. {
  51. if($Pref::Audio::MenuSounds)
  52. alxPlay(Note9Sound);
  53. }
  54.  
  55. //*********************************************************
  56. //* Variable Declarations
  57. //*********************************************************
  58. $RTB::CIRCClient::Server = "irc.centralchat.net";
  59. $RTB::CIRCClient::Port = "6667";
  60. $RTB::CIRCClient::RetryCount = "5";
  61.  
  62. //*********************************************************
  63. //* Initialisation of required objects
  64. //*********************************************************
  65. if(!isObject(RTB_IRCClient))
  66. exec("./RTB_IRCClient.gui");
  67.  
  68. if(!isObject(RTBIC_MessageVector))
  69. new MessageVector(RTBIC_MessageVector);
  70.  
  71. if(!isObject(RTBIC_UserManifest))
  72. new SimGroup(RTBIC_UserManifest);
  73.  
  74. if(!isObject(RTBIC_SessionManifest))
  75. new SimGroup(RTBIC_SessionManifest);
  76.  
  77. if(!isObject(RTBIC_NotificationManifest))
  78. new SimGroup(RTBIC_NotificationManifest);
  79.  
  80. if(!$RTB::CIRCClient::AppliedMaps)
  81. {
  82. RTB_addControlMap("keyboard","i","Toggle IRC","RTBIC_toggleIRC");
  83. $RTB::CIRCClient::AppliedMaps = 1;
  84. }
  85.  
  86. if(!isObject(RTBIC_PMSound))
  87. new AudioProfile(RTBIC_PMSound)
  88. {
  89. fileName = "./sounds/RTB_ircPM.wav";
  90. description = "AudioGui";
  91. preload = "1";
  92. };
  93.  
  94. //*********************************************************
  95. //* GUI Callbacks
  96. //*********************************************************
  97. function RTB_IRCClient::onWake(%this)
  98. {
  99. RTBIC_MessageVectorCtrl.attach(RTBIC_MessageVector);
  100.  
  101. for(%i=0;%i<RTBIC_SessionManifest.getCount();%i++)
  102. {
  103. %sess = RTBIC_SessionManifest.getObject(%i);
  104. %sess.window.messageVectorCtrl.attach(%sess.window.messageVector);
  105. }
  106.  
  107. RTBIC_refreshScroll();
  108.  
  109. if($RTB::Options::IC::CustomUsername)
  110. RTBIC_CustomUserBlock.setVisible(0);
  111.  
  112. schedule(10,0,"RTBIC_makeFirstResponder");
  113. }
  114.  
  115. function RTBIC_makeFirstResponder()
  116. {
  117. if(isObject($RTB::CIRCClient::CurrPane.window.messageBox))
  118. $RTB::CIRCClient::CurrPane.window.messageBox.makeFirstResponder(1);
  119. else
  120. RTBIC_MessageBox.makeFirstResponder(1);
  121. }
  122.  
  123. function RTBIC_toggleIRC(%val)
  124. {
  125. if(!%val)
  126. return;
  127.  
  128. if(RTB_IRCClient.isAwake())
  129. canvas.popDialog(RTB_IRCClient);
  130. else
  131. canvas.pushDialog(RTB_IRCClient);
  132.  
  133. schedule(10,0,"RTBIC_makeFirstResponder");
  134. }
  135.  
  136. function RTBIC_SendMessage()
  137. {
  138. %message = RTBIC_MessageBox.getValue();
  139. if(%message $= "")
  140. return;
  141.  
  142. if(filterKey(%message))
  143. {
  144. RTBIC_MessageBox.setValue("");
  145. RTBIC_addLine("\c2** DO NOT SAY YOUR BLOCKLAND KEY INTO THE CHAT! **");
  146. return;
  147. }
  148.  
  149. if(!RTBIC_SC.connected)
  150. {
  151. RTBIC_addLine("\c2ERROR: You are not connected.");
  152. RTBIC_MessageBox.setValue("");
  153. return;
  154. }
  155.  
  156. if(getSubStr(%message,0,1) $= "/")
  157. {
  158. if(getWord(%message, 0) $= "/me" || getWord(%message, 0) $= "/action")
  159. {
  160. %vars = getWords(%message,1,getWordCount(%message)-1);
  161. %message = "PRIVMSG "@RTBIC_SC.currentchannel@" :\c0ACTION "@%vars@"\c0";
  162. RTBIC_SC.sendLine(%message);
  163. RTBIC_addLine("\c4* "@$RTB::CIRCClient::Cache::NickName SPC %vars);
  164. }
  165. else if(getWord(%message,0) $= "/ignore")
  166. {
  167. %user = getWord(%message,1);
  168. if($Ignore::User[%user])
  169. {
  170. $Ignore::User[%user] = "";
  171. RTBIC_addLine("\c6* You are no longer ignoring "@%user@".");
  172. }
  173. else
  174. {
  175. $Ignore::User[%user] = 1;
  176. RTBIC_addLine("\c6* You are now ignoring "@%user@".");
  177. }
  178. }
  179. else if(getWord(%message,0) $= "/unignore")
  180. {
  181. %user = getWord(%message,1);
  182. if($Ignore::User[%user])
  183. {
  184. $Ignore::User[%user] = "";
  185. RTBIC_addLine("\c6* You are no longer ignoring "@%user@".");
  186. }
  187. }
  188. else if(getWord(%message,0) $= "/msg")
  189. {
  190. %vars = getWords(%message,1,getWordCount(%message)-1);
  191. RTBIC_SC.sendLine("PRIVMSG "@%vars);
  192.  
  193. %username = getWord(%message,1);
  194. if(RTBIC_hasSession(%username))
  195. {
  196. %sess = RTBIC_getSession(%username);
  197. RTBIC_SetPane(%sess);
  198. RTBIC_ScrollToTab(%username);
  199. }
  200. else
  201. {
  202. %sess = RTBIC_createSession(%username);
  203. RTBIC_SetPane(%sess);
  204. %sess.window.messageVector.pushBackLine("\c6* Now talking to "@%username@"...",0);
  205. RTBIC_ScrollToTab(%username);
  206. }
  207. %sess.window.messageVector.pushBackLine("\c0<"@$RTB::CIRCClient::Cache::NickName@"> "@getWords(%message,2,getWordCount(%message)-1),0);
  208. }
  209. else if(getWord(%message,0) $= "/slap")
  210. {
  211. %name = getField(RTBIC_UserList.getValue(),1);
  212. %num = getRandom(1,2);
  213. if(%num $= 1)
  214. {
  215. if(%name !$= "")
  216. %vars = "slaps "@%name@" around with a moose at large!";
  217. else
  218. %vars = "gets slapped around with a moose at large!";
  219. }
  220. else if(%num $= 2)
  221. {
  222. if(%name !$= "")
  223. %vars = "slaps "@%name@" around with a whale bone!";
  224. else
  225. %vars = "gets slapped around with a whale bone!";
  226. }
  227. %message = "PRIVMSG "@RTBIC_SC.currentchannel@" :\c0ACTION "@%vars@"\c0";
  228.  
  229. RTBIC_SC.sendLine(%message);
  230. RTBIC_addLine("\c4* "@$RTB::CIRCClient::Cache::NickName SPC %vars);
  231. }
  232. else if(getWord(%message,0) $= "/kick")
  233. {
  234. RTBIC_SC.sendLine("KICK "@RTBIC_SC.currentchannel@" "@getWord(%message,1));
  235. }
  236. else if(getWord(%message,0) $= "/hop")
  237. {
  238. RTBIC_SC.sendLine("PART #rtb");
  239. RTBIC_SC.sendLine("JOIN #rtb");
  240. }
  241. else if(getWord(%message,0) $= "/join")
  242. {
  243. //nope.
  244. return;
  245. }
  246. else
  247. RTBIC_SC.sendLine(getSubStr(%message,1,strLen(%message)));
  248. }
  249. else
  250. {
  251. RTBIC_SC.sendLine("PRIVMSG "@RTBIC_SC.currentChannel SPC ":"@%message);
  252. RTBIC_addLine("\c5<"@$RTB::CIRCClient::Cache::NickName@">\c0" SPC %message);
  253. }
  254. RTBIC_MessageBox.setValue("");
  255. }
  256. function RTBIC_UserList::onSelect(%this, %id, %text)
  257. {
  258. if($RTB::CIRCClient::Cache::WasSort)
  259. {
  260. $RTB::CIRCClient::Cache::WasSort = 0;
  261. return;
  262. }
  263.  
  264. %user = getWord(%text,1);
  265. if(%user $= $RTB::CIRCClient::Cache::LastULClickP && %user !$= "" && vectorDist($Sim::Time,$RTB::CIRCClient::Cache::LastULClick) < 2 && $RTB::Options::IC::AllowPM)
  266. {
  267. if(%user $= $RTB::CIRCClient::Cache::NickName)
  268. {
  269. }
  270. else if(RTBIC_hasSession(%user))
  271. {
  272. %sess = RTBIC_getSession(%user);
  273. RTBIC_SetPane(%sess);
  274. RTBIC_ScrollToTab(%user);
  275. }
  276. else
  277. {
  278. %sess = RTBIC_createSession(%user);
  279. RTBIC_SetPane(%sess);
  280. %sess.window.messageVector.pushBackLine("\c6* Now talking to "@%user@"...",0);
  281. RTBIC_ScrollToTab(%user);
  282. }
  283. }
  284. $RTB::CIRCClient::Cache::LastULClickP = %user;
  285. $RTB::CIRCClient::Cache::LastULClick = $Sim::Time;
  286. }
  287.  
  288. //*********************************************************
  289. //* Connection Management
  290. //*********************************************************
  291. function RTBIC_InitiateConnection()
  292. {
  293. if(isObject(RTBIC_SC))
  294. return;
  295.  
  296. new TCPObject(RTBIC_SC)
  297. {
  298. site = $RTB::CIRCClient::Server;
  299. port = $RTB::CIRCClient::Port;
  300.  
  301. connected = 0;
  302. };
  303. }
  304.  
  305. function RTBIC_SC::sendLine(%this,%line)
  306. {
  307. %this.send(%line@"\r\n");
  308. }
  309.  
  310. function RTBIC_SC::addHandle(%this,%handle,%routine)
  311. {
  312. %this.dispatch[%handle] = %routine;
  313. return 1;
  314. }
  315.  
  316. function RTBIC_Connect()
  317. {
  318. RTBIC_SC.connect(RTBIC_SC.site@":"@RTBIC_SC.port);
  319.  
  320. RTBIC_addLine("\c6Connecting...");
  321.  
  322. RTBIC_ConnectBtn.setColor("255 255 50 255");
  323. RTBIC_ConnectBtn.text = "Stop Connecting";
  324. RTBIC_ConnectBtn.command = "RTBIC_Disconnect();";
  325.  
  326. %this.retryCount = 0;
  327. }
  328.  
  329. function RTBIC_Disconnect(%cleanup)
  330. {
  331. if(!%cleanup)
  332. RTBIC_SC.disconnect();
  333.  
  334. RTBIC_SC.connected = 0;
  335. RTBIC_SC.currentChannel = "";
  336.  
  337. cancel(RTBIC_SC.retrySchedule);
  338.  
  339. RTBIC_addLine("\c6Disconnected.");
  340.  
  341. RTBIC_ConnectBtn.setColor("50 255 50 255");
  342. RTBIC_ConnectBtn.text = "Connect";
  343. RTBIC_ConnectBtn.command = "RTBIC_Connect();";
  344.  
  345. for(%i=0;%i<RTB_IRCClient.getObject(0).getCount();%i++)
  346. {
  347. %ctrl = RTB_IRCClient.getObject(0).getObject(%i);
  348. if(%ctrl.isPane && %ctrl.getName() $= "")
  349. %ctrl.delete();
  350. }
  351. RTBIC_SetPane("");
  352.  
  353. RTBIC_SessionManifest.clear();
  354. RTBIC_UserManifest.clear();
  355. RTBIC_drawUserList();
  356. RTBIC_TabSwatch.clear();
  357.  
  358. RTBIC_refreshScroll();
  359. }
  360.  
  361. //*********************************************************
  362. //* Execute-Time Instructions
  363. //*********************************************************
  364. RTBIC_InitiateConnection();
  365.  
  366. //*********************************************************
  367. //* Connection Callbacks
  368. //*********************************************************
  369. function RTBIC_SC::onConnected(%this)
  370. {
  371. RTBIC_ConnectBtn.setColor("255 50 50 255");
  372. RTBIC_ConnectBtn.text = "Disconnect";
  373. RTBIC_ConnectBtn.command = "RTBIC_Disconnect();";
  374.  
  375. RTBIC_addLine("\c0Connected.");
  376.  
  377. %this.connected = 1;
  378. %guestName = "Blockhead"@getNumKeyID();
  379. %this.sendLine("NICK "@%guestName);
  380.  
  381. if($Pref::Player::NetName !$= "" && isUnlocked())
  382. %userName = filterString(strReplace($Pref::Player::NetName," ","_"),"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789[]-");
  383. else if($Pref::Player::LANName !$= "")
  384. %userName = filterString(strReplace($Pref::Player::LANName," ","_"),"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789[]-");
  385.  
  386. %this.sendLine("USER "@%guestName@" 0 * :"@%userName@"-"@getNumKeyID());
  387.  
  388. $RTB::CIRCClient::Cache::NickName = %guestName;
  389. $RTB::CIRCClient::Cache::DesNickName = %userName;
  390.  
  391. $RTB::Options::IC::CustomUser = filterString(strReplace($RTB::Options::IC::CustomUser," ","_"),"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789");
  392. RTBIC_CustomUser.setValue($RTB::Options::IC::CustomUser);
  393. }
  394.  
  395. function RTBIC_SC::onLine(%this,%line)
  396. {
  397. if($RTB::Debug)
  398. echo(%line);
  399.  
  400. if(getSubStr(%line,0,1) $= ":")
  401. %line = nextToken(getSubStr(%line,1,strLen(%line)),prefix," ");
  402.  
  403. %line = nextToken(%line,command," :");
  404. %line = nextToken(%line,params,"");
  405.  
  406. %this.dispatchCommand(%command,%prefix,%params);
  407. }
  408.  
  409. function RTBIC_SC::onConnectFailed(%this)
  410. {
  411. %this.connected = 0;
  412.  
  413. %this.retryCount++;
  414. if(%this.retryCount > $RTB::CIRCClient::RetryCount)
  415. RTBIC_addLine("\c2Could not connect.");
  416. else
  417. {
  418. RTBIC_addLine("\c6Connect Failed - Retrying ("@%this.retryCount@"/5)");
  419. %this.retrySchedule = %this.schedule(1000,"connect",%this.site@":"@%this.port);
  420. }
  421. }
  422.  
  423. function RTBIC_SC::onDNSFailed(%this)
  424. {
  425. %this.connected = 0;
  426.  
  427. %this.retryCount++;
  428. if(%this.retryCount > $RTB::CIRCClient::RetryCount)
  429. RTBIC_addLine("\c2Could not connect.");
  430. else
  431. {
  432. RTBIC_addLine("\c6DNS Failed - Retrying ("@%this.retryCount@"/5)");
  433. %this.retrySchedule = %this.schedule(1000,"connect",%this.site@":"@%this.port);
  434. }
  435. }
  436.  
  437. function RTBIC_SC::onDisconnect(%this)
  438. {
  439. %this.connected = 0;
  440.  
  441. RTBIC_Disconnect(1);
  442. }
  443.  
  444. //*********************************************************
  445. //* IRC Command Dispatcher
  446. //*********************************************************
  447. function RTBIC_SC::dispatchCommand(%this,%command,%prefix,%params)
  448. {
  449. %prefix = strReplace(%prefix,"\"","\\\"");
  450. %params = strReplace(%params,"\"","\\\"");
  451. if(getsubstr(%params,strlen(%params)-1,1) $= "\\")
  452. %params = %params @ "\\";
  453.  
  454. if(%this.dispatch[%command] !$= "")
  455. eval("RTBIC_SC::"@%this.dispatch[%command]@"("@%this@",\""@%prefix@"\",\""@%params@"\");");
  456. else
  457. {
  458. if($RTB::Debug)
  459. error("ERROR: No dispatch route for command: "@%command);
  460. }
  461. }
  462.  
  463. //*********************************************************
  464. //* Dispatch Subroutines
  465. //*********************************************************
  466. RTBIC_SC.addHandle("NOTICE","onNotice");
  467. function RTBIC_SC::onNotice(%this,%prefix,%params)
  468. {
  469. if(strPos(%prefix,"Global") $= 0)
  470. return;
  471.  
  472. nextToken(%prefix,sender,"!");
  473. %params = stripMLControlChars(nextToken(%params,params,":"));
  474.  
  475. if(%sender $= "ChanServ" || %sender $= "NickServ")
  476. {
  477. %username = %sender;
  478. %message = %params;
  479. if(RTBIC_hasSession(%username))
  480. %sess = RTBIC_getSession(%username);
  481. else
  482. return;
  483.  
  484. %sess.window.messageVector.pushBackLine("\c4"@%params,0);
  485.  
  486. if(!%sess.window.visible)
  487. RTBIC_startFlashTab(%sess.tab);
  488.  
  489. RTBIC_makeFirstResponder();
  490.  
  491. if(!RTB_IRCClient.isAwake())
  492. {
  493. if($RTB::Options::IC::PMVisualNotify)
  494. {
  495. if(strLen(%message) > 40)
  496. %message = getSubStr(%message,0,40)@"...";
  497. RTBIC_pushNotification(%username,%message);
  498. }
  499.  
  500. if($RTB::Options::IC::PMAudioNotify)
  501. alxPlay(RTBIC_PMSound);
  502. }
  503. }
  504. else
  505. {
  506. if(RTBIC_hasUser(%sender))
  507. RTBIC_addLine("\c2-"@%sender@"- "@%params);
  508. else
  509. RTBIC_addLine("\c4"@%params);
  510. }
  511. }
  512.  
  513. RTBIC_SC.addHandle("JOIN","onJoin");
  514. function RTBIC_SC::onJoin(%this,%prefix,%params)
  515. {
  516. nextToken(%prefix,nick,"!");
  517. if(%nick $= $RTB::CIRCClient::Cache::NickName)
  518. {
  519. RTBIC_addLine("");
  520. RTBIC_addLine("\c1* You have joined the channel "@%params@".");
  521. %this.currentChannel = %params;
  522. %this.channelTab = RTBIC_pushTab(%params,"","RTBIC_forcePart();");
  523. }
  524. else
  525. {
  526. if($RTB::Options::IC::Filter::ShowConnects)
  527. RTBIC_addLine("\c1* "@%nick@" has joined "@%params@".");
  528. RTBIC_addUser(%nick);
  529. }
  530. }
  531.  
  532. RTBIC_SC.addHandle("PART","onPart");
  533. function RTBIC_SC::onPart(%this,%prefix,%params)
  534. {
  535. nextToken(%prefix,nick,"!");
  536. if(%nick $= $RTB::CIRCClient::Cache::NickName)
  537. {
  538. RTBIC_addLine("\c1* You have left the channel "@%params@".");
  539. %this.currentChannel = "";
  540. RTBIC_popTab(%this.channelTab);
  541. RTBIC_UserManifest.clear();
  542. RTBIC_drawUserList();
  543. }
  544. else
  545. {
  546. if($RTB::Options::IC::Filter::ShowDisconnects)
  547. RTBIC_addLine("\c1* "@%nick@" has left "@%params@".");
  548. RTBIC_removeUser(%nick);
  549. }
  550. }
  551.  
  552. RTBIC_SC.addHandle("QUIT","onQuit");
  553. function RTBIC_SC::onQuit(%this,%prefix,%params)
  554. {
  555. nextToken(%prefix,nick,"!");
  556.  
  557. if($RTB::Options::IC::Filter::ShowDisconnects)
  558. RTBIC_addLine("\c1* "@%nick@" has quit.");
  559. RTBIC_removeUser(%nick);
  560. }
  561.  
  562. RTBIC_SC.addHandle("332","onTopic");
  563. function RTBIC_SC::onTopic(%this,%prefix,%params)
  564. {
  565. %topic = nextToken(%params,prefix," :");
  566. RTBIC_addLine("\c3Topic is currently '"@%topic@"'");
  567. }
  568.  
  569. RTBIC_SC.addHandle("TOPIC","onTopicChange");
  570. function RTBIC_SC::onTopicChange(%this,%prefix,%params)
  571. {
  572. %topic = nextToken(%params,prefix," :");
  573. RTBIC_addLine("\c3The Topic has been changed: '"@%topic@"'");
  574. }
  575.  
  576. RTBIC_SC.addHandle("372","onMOTD");
  577. function RTBIC_SC::onMOTD(%this,%prefix,%params)
  578. {
  579. %msg = nextToken(%params,prefix,":");
  580. RTBIC_addLine("\c6"@%msg);
  581. }
  582.  
  583. RTBIC_SC.addHandle("376","onMOTDEnd");
  584. function RTBIC_SC::onMOTDEnd(%this,%prefix,%params)
  585. {
  586. %this.sendLine("ISON "@$RTB::CIRCClient::Cache::NickName);
  587. }
  588.  
  589. RTBIC_SC.addHandle("422","onMOTDMissing");
  590. function RTBIC_SC::onMOTDMissing(%this,%prefix,%params)
  591. {
  592. %this.sendLine("ISON "@$RTB::CIRCClient::Cache::NickName);
  593. }
  594.  
  595. RTBIC_SC.addHandle("438","onError");
  596. RTBIC_SC.addHandle("431","onError");
  597. RTBIC_SC.addHandle("401","onError");
  598. RTBIC_SC.addHandle("ERROR","onError");
  599. function RTBIC_SC::onError(%this,%prefix,%params)
  600. {
  601. %message = nextToken(%params,prefix,":");
  602. if(getWordcount(%prefix) > 1)
  603. {
  604. %username = getWord(%prefix,1);
  605. if(RTBIC_hasSession(%username))
  606. %sess = RTBIC_getSession(%username);
  607. else
  608. %sess = RTBIC_createSession(%username);
  609.  
  610. %sess.window.messageVector.pushBackLine("\c2ERROR: "@%message,0);
  611.  
  612. if(!%sess.window.visible)
  613. RTBIC_startFlashTab(%sess.tab);
  614.  
  615. RTBIC_makeFirstResponder();
  616.  
  617. if(!RTB_IRCClient.isAwake())
  618. {
  619. if($RTB::Options::IC::PMVisualNotify)
  620. {
  621. if(strLen(%message) > 40)
  622. %message = getSubStr(%message,0,40)@"...";
  623. RTBIC_pushNotification(%username,%message);
  624. }
  625.  
  626. if($RTB::Options::IC::PMAudioNotify)
  627. alxPlay(RTBIC_PMSound);
  628. }
  629. }
  630. else
  631. RTBIC_addLine("\c2ERROR: "@%message);
  632. }
  633.  
  634. RTBIC_SC.addHandle("432","onErroneousNick");
  635. function RTBIC_SC::onErroneousNick(%this,%prefix,%params)
  636. {
  637. %msg = getWords(%params,4,getWordCount(%params));
  638. RTBIC_addLine("\c2* The Nickname "@getWord(%params,1)@" is not allowed. ("@%msg@")");
  639. }
  640.  
  641. RTBIC_SC.addHandle("482","onNotOp");
  642. function RTBIC_SC::onNotOp(%this,%prefix,%params)
  643. {
  644. RTBIC_addLine("\c2* Oops you can't do that, you're not an Operator.");
  645. }
  646.  
  647. RTBIC_SC.addHandle("461","onNotEnoughParams");
  648. function RTBIC_SC::onNotEnoughParams(%this,%prefix,%params)
  649. {
  650. RTBIC_addLine("\c2* You have not entered enough parameters for the command "@getWord(%params,1)@".");
  651. }
  652.  
  653. RTBIC_SC.addHandle("442","onNotOnChannel");
  654. function RTBIC_SC::onNotOnChannel(%this,%prefix,%params)
  655. {
  656. RTBIC_addLine("\c2* You are not on the channel "@getWord(%params,1)@".");
  657. }
  658.  
  659. RTBIC_SC.addHandle("474","onBanned");
  660. function RTBIC_SC::onBanned(%this,%prefix,%params)
  661. {
  662. RTBIC_addLine("\c2* You cannot join "@getWord(%params,1)@" because you are banned.");
  663. }
  664.  
  665. RTBIC_SC.addHandle("NICK","onNick");
  666. function RTBIC_SC::onNick(%this,%prefix,%params)
  667. {
  668. %oldName = getSubStr(%prefix,0,strPos(%prefix,"!"));
  669. if(%oldName $= $RTB::CIRCClient::Cache::NickName)
  670. {
  671. RTBIC_addLine("\c4* You are now known as "@%params@".");
  672. $RTB::CIRCClient::Cache::NickName = %params;
  673. }
  674. else
  675. {
  676. RTBIC_addLine("\c4"@%oldName@" is now known as "@%params@".");
  677. if($Ignore::User[%oldName])
  678. {
  679. $Ignore::User[%params] = 1;
  680. $Ignore::User[%oldName] = "";
  681. }
  682. }
  683.  
  684. RTBIC_removeUser(%oldName);
  685. RTBIC_addUser(%params);
  686.  
  687. if(RTBIC_hasSession(%oldName))
  688. {
  689. %session = RTBIC_getSession(%oldName);
  690. %session.username = %params;
  691. %session.tab.text = RTBIC_subTabName(%params);
  692. %session.tab.getObject(0).command = "RTBIC_endSession(\""@%params@"\");";
  693. %session.window.messageBox.altCommand = "RTBIC_sendSessionMessage(\""@%params@"\");";
  694. %session.window.getObject(3).command = "RTBIC_sendSessionMessage(\""@%params@"\");";
  695. %session.window.getObject(4).command = "RTBIC_endSession(\""@%params@"\");";
  696. %session.window.messageVector.pushBackLine("\c5* "@%oldName@" is now known as "@%params@".",0);
  697. }
  698. }
  699.  
  700. RTBIC_SC.addHandle("MODE","onMode");
  701. function RTBIC_SC::onMode(%this,%prefix,%params)
  702. {
  703. nextToken(%prefix,nick," !");
  704. %mode = getSubStr(%params, StrLen(getWord(%params,0))+1, StrLen(%params));
  705. RTBIC_addLine("\c5* "@%nick@" has set mode: "@%mode);
  706.  
  707. RTBIC_SC.sendLine("NAMES "@%this.currentChannel);
  708. }
  709.  
  710. RTBIC_SC.addHandle("391","onTime");
  711. function RTBIC_SC::onTime(%this,%prefix,%params)
  712. {
  713. %time = getWord(%params,7);
  714. RTBIC_addLine("\c3Time: "@%time);
  715. }
  716.  
  717. RTBIC_SC.addHandle("PRIVMSG","onMessage");
  718. function RTBIC_SC::onMessage(%this,%prefix,%params)
  719. {
  720. nextToken(%prefix,username,"!");
  721. %message = stripMLControlChars(nextToken(%params,destination," :"));
  722. %message = getSubStr(%params,strPos(%params,":")+1,strLen(%params));
  723. %message = stripMLControlChars(%message);
  724.  
  725. if($Ignore::User[%username])
  726. {
  727. return;
  728. }
  729.  
  730. if(%destination $= %this.currentChannel)
  731. {
  732. if(strPos(%message,"ACTION") $= 0)
  733. {
  734. if($RTB::Options::IC::Filter::ShowActions)
  735. {
  736. %message = "\c4* "@%username SPC getWords(%message,1,getWordCount(%message));
  737. RTBIC_addLine(%message);
  738. }
  739. return;
  740. }
  741. RTBIC_addLine("\c0<"@%username@"> "@%message);
  742.  
  743. if(!RTBIC_Window_Channel.visible)
  744. RTBIC_startFlashTab(RTBIC_SC.channelTab);
  745. }
  746. else if(%destination $= $RTB::CIRCClient::Cache::NickName && $RTB::Options::IC::AllowPM)
  747. {
  748. if(%username $= "StatServ" || %message $= "VERSION")
  749. return;
  750.  
  751. if(RTBIC_hasSession(%username))
  752. %sess = RTBIC_getSession(%username);
  753. else
  754. %sess = RTBIC_createSession(%username);
  755.  
  756. %sess.window.messageVector.pushBackLine("\c0<"@%username@"> "@%message,0);
  757.  
  758. if(!%sess.window.visible)
  759. RTBIC_startFlashTab(%sess.tab);
  760.  
  761. RTBIC_makeFirstResponder();
  762.  
  763. if(!RTB_IRCClient.isAwake())
  764. {
  765. if($RTB::Options::IC::PMVisualNotify)
  766. {
  767. if(strLen(%message) > 40)
  768. %message = getSubStr(%message,0,40)@"...";
  769. RTBIC_pushNotification(%username,%message);
  770. }
  771.  
  772. if($RTB::Options::IC::PMAudioNotify)
  773. alxPlay(RTBIC_PMSound);
  774. }
  775. }
  776. }
  777.  
  778. RTBIC_SC.addHandle("303","onPresenceQueryReply");
  779. function RTBIC_SC::onPresenceQueryReply(%this,%prefix,%params)
  780. {
  781. %name = firstWord(nextToken(%params,prefix,":"));
  782. if(%name $= $RTB::CIRCClient::Cache::NickName)
  783. {
  784. if($RTB::Options::IC::CustomUsername && $RTB::Options::IC::CustomUser !$= "")
  785. {
  786. %this.sendLine("NICK "@$RTB::Options::IC::CustomUser);
  787. if($RTB::Options::IC::CustomPass !$= "")
  788. %this.sendLine("PRIVMSG NickServ IDENTIFY "@$RTB::Options::IC::CustomPass);
  789. }
  790. else
  791. {
  792. if($RTB::CIRCClient::Cache::DesNickName !$= "")
  793. %this.sendLine("NICK "@$RTB::CIRCClient::Cache::DesNickName);
  794. }
  795.  
  796. RTBIC_UserManifest.clear();
  797. %this.sendLine("JOIN #rtb");
  798. }
  799. }
  800.  
  801. RTBIC_SC.addHandle("353","onNameList");
  802. function RTBIC_SC::onNameList(%this,%prefix,%params)
  803. {
  804. if(!%this.receivingNames)
  805. {
  806. %this.receivingNames = 1;
  807. RTBIC_UserManifest.clear();
  808. }
  809.  
  810. %nameList = nextToken(%params,prefix,":");
  811. for(%i=0;%i<getWordCount(%nameList);%i++)
  812. {
  813. %name = getWord(%nameList,%i);
  814. RTBIC_addUser(%name,1);
  815. }
  816. }
  817.  
  818. RTBIC_SC.addHandle("311","onWhoisPartA");
  819. function RTBIC_SC::onWhoisPartA(%this,%prefix,%params)
  820. {
  821. %username = getWord(%params,1);
  822. %nick = getWord(%params,2);
  823. %host = getWord(%params,3);
  824. %realname = nextToken(%params,prefix,":");
  825.  
  826. RTBIC_addLine("\c4"@%username@" is "@%nick@"@"@%host@" * "@%realname);
  827. }
  828.  
  829. RTBIC_SC.addHandle("307","onWhoisPartB");
  830. function RTBIC_SC::onWhoisPartB(%this,%prefix,%params)
  831. {
  832. %username = getWord(%params,1);
  833.  
  834. RTBIC_addLine("\c4"@%username@" is a registered nick");
  835. }
  836.  
  837. RTBIC_SC.addHandle("319","onWhoisPartC");
  838. function RTBIC_SC::onWhoisPartC(%this,%prefix,%params)
  839. {
  840. %username = getWord(%params,1);
  841. %channels = nextToken(%params,%prefix,":");
  842.  
  843. RTBIC_addLine("\c4"@%username@" on "@%channels);
  844. }
  845.  
  846. RTBIC_SC.addHandle("312","onWhoisPartD");
  847. function RTBIC_SC::onWhoisPartD(%this,%prefix,%params)
  848. {
  849. %username = getWord(%params,1);
  850. %server = getWord(%params,2);
  851. %servername = nextToken(%params,%prefix,":");
  852.  
  853. RTBIC_addLine("\c4"@%username@" using "@%server@" "@%servername);
  854. }
  855.  
  856. RTBIC_SC.addHandle("KICK","onKick");
  857. function RTBIC_SC::onKick(%this,%prefix,%params)
  858. {
  859. nextToken(%prefix,kicker,"!");
  860. %message = nextToken(%params,kickee,":");
  861. %kickee = getWord(%params,1);
  862.  
  863. if(%kickee $= $RTB::CIRCClient::Cache::NickName)
  864. {
  865. if(%message $= %kicker)
  866. {
  867. RTBIC_addLine("\c2* You have been kicked by "@%kicker@". (No Reason)");
  868. RTBIC_popTab(RTBIC_SC.channelTab);
  869. RTBIC_UserManifest.clear();
  870. RTBIC_drawUserList();
  871. return;
  872. }
  873. else
  874. {
  875. RTBIC_addLine("\c2* You have been kicked by "@%kicker@". ("@%message@")");
  876. RTBIC_popTab(RTBIC_SC.channelTab);
  877. RTBIC_UserManifest.clear();
  878. RTBIC_drawUserList();
  879. return;
  880. }
  881. }
  882. else
  883. {
  884. if(%message $= %kicker)
  885. RTBIC_addLine("\c2* "@%kickee@" has been kicked by "@%kicker@". (No Reason)");
  886. else
  887. RTBIC_addLine("\c2* "@%kickee@" has been kicked by "@%kicker@". ("@%message@")",0);
  888.  
  889. RTBIC_removeUser(%kickee);
  890. }
  891. }
  892.  
  893. RTBIC_SC.addHandle("433","onNickInUse");
  894. function RTBIC_SC::onNickInUse(%this,%prefix,%params)
  895. {
  896. %name = getWord(%params,1);
  897. RTBIC_addLine("\c2* Your name could not be changed to "@%name@" since it is already in use.");
  898. }
  899.  
  900. RTBIC_SC.addHandle("366","onNameListDone");
  901. function RTBIC_SC::onNameListDone(%this,%prefix,%params)
  902. {
  903. %this.receivingNames = 0;
  904. RTBIC_drawUserList();
  905. }
  906.  
  907. RTBIC_SC.addHandle("PING","onPing");
  908. function RTBIC_SC::onPing(%this,%prefix,%params)
  909. {
  910. %this.sendLine("PONG "@%params);
  911. }
  912.  
  913. function RTBIC_ColorTest()
  914. {
  915. RTBIC_addLine("\c00");
  916. RTBIC_addLine("\c11");
  917. RTBIC_addLine("\c22");
  918. RTBIC_addLine("\c33");
  919. RTBIC_addLine("\c44");
  920. RTBIC_addLine("\c55");
  921. RTBIC_addLine("\c66");
  922. RTBIC_addLine("\c77");
  923. RTBIC_addLine("\c88");
  924. RTBIC_addLine("\c99");
  925. }
  926.  
  927. //*********************************************************
  928. //* User Manifest
  929. //*********************************************************
  930. function RTBIC_lightRefresh()
  931. {
  932. %value = $RTB::CIRCClient::Cache::SortSel;
  933. RTBIC_UserList.sort(0,1);
  934. RTBIC_drawBadges();
  935.  
  936. if(%value !$= "" && %value > -1)
  937. {
  938. $RTB::CIRCClient::Cache::WasSort = 1;
  939. RTBIC_UserList.setSelectedById(%value);
  940. }
  941. }
  942.  
  943. function RTBIC_drawUserList()
  944. {
  945. %value = RTBIC_UserList.getSelectedId();
  946.  
  947. RTBIC_UserList.clear();
  948. if(RTBIC_SC.currentChannel $= "")
  949. {
  950. RTBIC_drawBadges();
  951. return;
  952. }
  953.  
  954. for(%i=0;%i<RTBIC_UserManifest.getCount();%i++)
  955. {
  956. %user = RTBIC_UserManifest.getObject(%i);
  957. RTBIC_UserList.addRow(%user,%user.status TAB %user.username,0);
  958. }
  959.  
  960. RTBIC_UserList.sort(0,1);
  961. RTBIC_drawBadges();
  962.  
  963. RTBIC_UserList.setSelectedById(%value);
  964. }
  965.  
  966. function RTBIC_drawBadges()
  967. {
  968. RTBIC_UserSwatch.clear();
  969. for(%i=0;%i<RTBIC_UserList.rowCount();%i++)
  970. {
  971. %entry = RTBIC_UserList.getRowText(%i);
  972. %status = getField(%entry,0);
  973.  
  974. if(%status < 2)
  975. {
  976. %badgeBitmap = (%status $= 1) ? "./images/icon_silverBadge" : "./images/icon_goldBadge";
  977. %bitmap = new GuiBitmapCtrl()
  978. {
  979. position = "1" SPC (%i*16)+1;
  980. extent = "16 16";
  981. bitmap = %badgeBitmap;
  982. };
  983. RTBIC_UserSwatch.add(%bitmap);
  984. }
  985. else
  986. {
  987. %swatch = new GuiSwatchCtrl()
  988. {
  989. position = "1" SPC (%i*16)+1;
  990. extent = "16 16";
  991. color = "255 255 255 255";
  992. };
  993. RTBIC_UserSwatch.add(%swatch);
  994. }
  995. }
  996. if(RTBIC_UserSwatch.getCount() >= 1)
  997. %extentY = getWord(RTBIC_UserSwatch.getObject(RTBIC_UserSwatch.getCount()-1).position,1)+16;
  998. else
  999. %extentY = 16;
  1000. RTBIC_UserSwatch.extent = "18" SPC %extentY;
  1001. }
  1002.  
  1003. function RTBIC_addUser(%username,%mass)
  1004. {
  1005. %this = RTBIC_UserManifest;
  1006.  
  1007. if(getSubStr(%username,0,1) $= "~")
  1008. %status = "0";
  1009. else if(getSubStr(%username,0,1) $= "@")
  1010. %status = "0";
  1011. else if(getSubStr(%username,0,1) $= "&")
  1012. %status = "0";
  1013. else if(getSubStr(%username,0,1) $= "+")
  1014. %status = "1";
  1015. else
  1016. %status = "2";
  1017.  
  1018. if(%status !$= "2")
  1019. %fusername = getSubStr(%username,1,strLen(%username));
  1020. else
  1021. %fusername = %username;
  1022.  
  1023. if(RTBIC_hasUser(%fusername))
  1024. {
  1025. %user = RTBIC_getUser(%fusername);
  1026. %user.status = %status;
  1027. %user.rawusername = %username;
  1028. }
  1029. else
  1030. {
  1031. %userSO = new ScriptObject()
  1032. {
  1033. class = "RTBIC_UserSO";
  1034. username = %fusername;
  1035. status = %status;
  1036. rawusername = %username;
  1037. };
  1038. %this.add(%userSO);
  1039.  
  1040. if(!%mass)
  1041. {
  1042. $RTB::CIRCClient::Cache::SortSel = RTBIC_UserList.getSelectedId();
  1043. RTBIC_UserList.addRow(%userSO,%status TAB %fusername,0);
  1044. RTBIC_lightRefresh();
  1045. }
  1046. }
  1047. }
  1048. function RTBIC_removeUser(%username)
  1049. {
  1050. %this = RTBIC_UserManifest;
  1051. if(!RTBIC_hasUser(%username))
  1052. return;
  1053.  
  1054. for(%i=0;%i<%this.getCount();%i++)
  1055. {
  1056. %so = %this.getObject(%i);
  1057. if(%so.username $= %username)
  1058. {
  1059. $RTB::CIRCClient::Cache::SortSel = RTBIC_UserList.getSelectedId();
  1060. RTBIC_UserList.removeRowById(%so);
  1061. RTBIC_lightRefresh();
  1062. %so.delete();
  1063. return 1;
  1064. }
  1065. }
  1066. return 0;
  1067. }
  1068. function RTBIC_getRawUser(%username)
  1069. {
  1070. %this = RTBIC_UserManifest;
  1071. for(%i=0;%i<%this.getCount();%i++)
  1072. {
  1073. %so = %this.getObject(%i);
  1074. if(%so.rawusername $= %username)
  1075. return %so;
  1076. }
  1077. return 0;
  1078. }
  1079. function RTBIC_getUser(%username)
  1080. {
  1081. %this = RTBIC_UserManifest;
  1082. for(%i=0;%i<%this.getCount();%i++)
  1083. {
  1084. %so = %this.getObject(%i);
  1085. if(%so.username $= %username)
  1086. return %so;
  1087. }
  1088. return 0;
  1089. }
  1090. function RTBIC_hasUser(%username)
  1091. {
  1092. %this = RTBIC_UserManifest;
  1093. for(%i=0;%i<%this.getCount();%i++)
  1094. {
  1095. %so = %this.getObject(%i);
  1096. if(%so.username $= %username)
  1097. return 1;
  1098. }
  1099. return 0;
  1100. }
  1101. function RTBIC_hasRawUser(%username)
  1102. {
  1103. %this = RTBIC_UserManifest;
  1104. for(%i=0;%i<%this.getCount();%i++)
  1105. {
  1106. %so = %this.getObject(%i);
  1107. if(%so.rawusername $= %username)
  1108. return 1;
  1109. }
  1110. return 0;
  1111. }
  1112. function RTBIC_UserManifest::dump(%this)
  1113. {
  1114. echo(" RTBIC_UserManifest");
  1115. echo("-------------------------------------");
  1116. for(%i=0;%i<%this.getCount();%i++)
  1117. {
  1118. %so = %this.getObject(%i);
  1119. echo(" "@%so.rawusername);
  1120. }
  1121. echo("-------------------------------------");
  1122. }
  1123. function RTBIC_forcePart()
  1124. {
  1125. if(RTBIC_SC.currentChannel !$= "")
  1126. {
  1127. RTBIC_SC.sendLine("PART "@RTBIC_SC.currentChannel);
  1128. RTBIC_popTab(RTBIC_SC.channelTab);
  1129. }
  1130. }
  1131.  
  1132. //*********************************************************
  1133. //* Pane Management
  1134. //*********************************************************
  1135. function RTBIC_SetPane(%pane)
  1136. {
  1137. for(%i=0;%i<RTB_IRCClient.getObject(0).getCount();%i++)
  1138. {
  1139. %ctrl = RTB_IRCClient.getObject(0).getObject(%i);
  1140. if(%ctrl.isPane)
  1141. %ctrl.setVisible(0);
  1142. }
  1143.  
  1144. for(%i=0;%i<RTBIC_TabSwatch.getCount();%i++)
  1145. {
  1146. %tab = RTBIC_TabSwatch.getObject(%i);
  1147. %tab.setBitmap("base/client/ui/tab1");
  1148. }
  1149.  
  1150. if(%pane !$= "" && %pane !$= "main")
  1151. {
  1152. if(RTBIC_SessionManifest.isMember(%pane))
  1153. {
  1154. %pane.window.setVisible(1);
  1155. %pane.window.messageBox.makeFirstResponder(1);
  1156. if(%pane.tab.isFlashing)
  1157. RTBIC_stopFlashTab(%pane.tab);
  1158. %pane.tab.setBitmap("base/client/ui/tab1Use");
  1159. }
  1160. else
  1161. {
  1162. RTBIC_Window_Channel.setVisible(1);
  1163. RTBIC_SendMessage.makeFirstResponder(1);
  1164. if(RTBIC_SC.channelTab.isFlashing)
  1165. RTBIC_stopFlashTab(RTBIC_SC.channelTab);
  1166. RTBIC_SC.channelTab.setBitmap("base/client/ui/tab1Use");
  1167. }
  1168. }
  1169. else
  1170. {
  1171. RTBIC_Window_Channel.setVisible(1);
  1172. RTBIC_MessageBox.makeFirstResponder(1);
  1173. if(RTBIC_SC.channelTab.isFlashing)
  1174. RTBIC_stopFlashTab(RTBIC_SC.channelTab);
  1175. RTBIC_SC.channelTab.setBitmap("base/client/ui/tab1Use");
  1176. }
  1177. if(%pane $= "")
  1178. %pane = "main";
  1179. $RTB::CIRCClient::CurrPane = %pane;
  1180. }
  1181.  
  1182. function RTBIC_coldOpenPane(%title)
  1183. {
  1184. if(!RTBIC_hasTab(%title))
  1185. return;
  1186.  
  1187. canvas.pushDialog(RTB_IRCClient);
  1188. %tab = RTBIC_getTab(%title);
  1189. RTBIC_SetPane(%tab.session);
  1190. RTBIC_ScrollToTab(%title);
  1191. $RTB::CIRCClient::CurrPane.window.messageBox.makeFirstResponder(1);
  1192. }
  1193.  
  1194. //*********************************************************
  1195. //* Popup Management
  1196. //*********************************************************
  1197. function RTBIC_pushNotification(%title,%message)
  1198. {
  1199. if(RTBIC_NotificationManifest.getCount() > 3)
  1200. return;
  1201.  
  1202. for(%i=0;%i<RTBIC_NotificationManifest.getCount();%i++)
  1203. {
  1204. if(RTBIC_NotificationManifest.getObject(%i).name $= %title)
  1205. {
  1206. %window = RTBIC_NotificationManifest.getObject(%i).window;
  1207. %window.getObject(0).getObject(0).setText("<just:center>"@%message);
  1208. %window.getObject(0).getObject(0).forceReflow();
  1209.  
  1210. if(getWord(%window.getObject(0).getObject(0).extent,1) <= 24)
  1211. %window.getObject(1).setVisible(0);
  1212. else
  1213. %window.getObject(1).setVisible(1);
  1214.  
  1215. if(%window.status $= "goingDown")
  1216. {
  1217. cancel(%window.moveSchedule);
  1218. RTBIC_scrollNotificationUp(%window);
  1219. }
  1220. else if(%window.status $= "holding")
  1221. {
  1222. cancel(%window.moveSchedule);
  1223. %window.moveSchedule = schedule(3000,0,"RTBIC_scrollNotificationDown",%window);
  1224. }
  1225. return;
  1226. }
  1227. }
  1228.  
  1229. %resX = getWord(getRes(),0);
  1230. %resY = getWord(getRes(),1);
  1231.  
  1232. %posX = %resX-150;
  1233. %posY = %resY-(70*RTBIC_NotificationManifest.getCount());
  1234.  
  1235. %window = new GuiWindowCtrl()
  1236. {
  1237. profile = GuiWindowProfile;
  1238. position = %posX SPC %posY;
  1239. extent = "150 70";
  1240. horizSizing = "left";
  1241. vertSizing = "top";
  1242. text = %title;
  1243. target = %resY-70;
  1244.  
  1245. canClose = 1;
  1246. canMinimize = 0;
  1247. canMaximize = 0;
  1248. canMove = 0;
  1249. resizeWidth = 0;
  1250. resizeHeight = 0;
  1251.  
  1252. new GuiSwatchCtrl()
  1253. {
  1254. position = "9 33";
  1255. extent = "132 25";
  1256. color = "0 0 0 0";
  1257.  
  1258. new GuiMLTextCtrl()
  1259. {
  1260. profile = RTB_Verdana12Pt;
  1261. position = "0 0";
  1262. vertSizing = "bottom";
  1263. extent = "132 12";
  1264. text = "<just:center>"@%message;
  1265. };
  1266. };
  1267.  
  1268. new GuiTextCtrl()
  1269. {
  1270. profile = RTB_Verdana12Pt;
  1271. position = "129 42";
  1272. extent = "9 18";
  1273. text = "...";
  1274. };
  1275.  
  1276. new GuiBitmapButtonCtrl()
  1277. {
  1278. position = "6 27";
  1279. extent = "140 44";
  1280. text = " ";
  1281. bitmap = "./images/buttons/btnInvisible";
  1282. };
  1283. };
  1284. Canvas.getObject(canvas.getCount()-1).add(%window);
  1285.  
  1286. %so = new ScriptObject()
  1287. {
  1288. name = %title;
  1289. window = %window;
  1290. };
  1291. RTBIC_NotificationManifest.add(%so);
  1292. %window.manifest = %so;
  1293.  
  1294. %window.closeCommand = %window.manifest@".delete();"@%window@".delete();";
  1295. %window.getObject(2).command = %window.manifest@".delete();RTBIC_coldOpenPane(\""@%title@"\");"@%window@".delete();";
  1296. %window.getObject(0).getObject(0).forceReflow();
  1297. if(getWord(%window.getObject(0).getObject(0).extent,1) <= 24)
  1298. %window.getObject(1).setVisible(0);
  1299.  
  1300. RTBIC_scrollNotificationUp(%window);
  1301. }
  1302. function RTBIC_scrollNotificationUp(%window)
  1303. {
  1304. if(!isObject(%window))
  1305. return;
  1306.  
  1307. %window.status = "goingUp";
  1308. %target = %window.target;
  1309. %current = getWord(%window.position,1);
  1310.  
  1311. if(%current > %target)
  1312. %window.position = vectorSub(%window.position,"0 5");
  1313. else
  1314. {
  1315. %window.moveSchedule = schedule(5000,0,"RTBIC_scrollNotificationDown",%window);
  1316. %window.status = "holding";
  1317. return;
  1318. }
  1319.  
  1320. %window.moveSchedule = schedule(40,0,"RTBIC_scrollNotificationUp",%window);
  1321. }
  1322.  
  1323. function RTBIC_scrollNotificationDown(%window)
  1324. {
  1325. if(!isObject(%window))
  1326. return;
  1327.  
  1328. %window.status = "goingDown";
  1329. %target = getWord(getRes(),1);
  1330. %current = getWord(%window.position,1);
  1331.  
  1332. if(%current < %target)
  1333. %window.position = vectorAdd(%window.position,"0 5");
  1334. else
  1335. {
  1336. %window.manifest.delete();
  1337. %window.delete();
  1338. return;
  1339. }
  1340.  
  1341. %window.moveSchedule = schedule(40,0,"RTBIC_scrollNotificationDown",%window);
  1342. }
  1343.  
  1344. //*********************************************************
  1345. //* Tab Scrolling
  1346. //*********************************************************
  1347. function RTBIC_refreshScroll()
  1348. {
  1349. for(%i=0;%i<RTBIC_TabSwatch.getCount();%i++)
  1350. {
  1351. %tab = RTBIC_TabSwatch.getObject(%i);
  1352. %tab.position = (138*%i)+(%i) SPC "1";
  1353. }
  1354. if(RTBIC_TabSwatch.getCount() >= 1)
  1355. %xMax = getWord(RTBIC_TabSwatch.getObject(RTBIC_TabSwatch.getCount()-1).position,0)+136;
  1356. else
  1357. %xMax = 0;
  1358. RTBIC_TabSwatch.extent = %xMax SPC "27";
  1359.  
  1360. if(RTBIC_TabSwatch.getCount() < 5)
  1361. {
  1362. RTBIC_RightScroll.setVisible(0);
  1363. RTBIC_LeftScroll.setVisible(0);
  1364. RTBIC_TabSwatch.position = "0 0";
  1365. }
  1366. else
  1367. {
  1368. RTBIC_RightScroll.setVisible(1);
  1369. RTBIC_LeftScroll.setVisible(1);
  1370. RTBIC_RightScroll.setActive(1);
  1371. RTBIC_LeftScroll.setActive(1);
  1372.  
  1373. if(getWord(RTBIC_TabSwatch.position,0) < 0)
  1374. {
  1375. if(getWord(RTBIC_TabSwatch.extent,0)+getWord(RTBIC_TabSwatch.position,0) < 553)
  1376. RTBIC_TabSwatch.position = vectorAdd(RTBIC_TabSwatch.position,553-(getWord(RTBIC_TabSwatch.extent,0)+getWord(RTBIC_TabSwatch.position,0)) SPC "0");
  1377. }
  1378.  
  1379. if(getWord(RTBIC_TabSwatch.extent,0)+getWord(RTBIC_TabSwatch.position,0) $= "553")
  1380. RTBIC_RightScroll.setActive(0);
  1381.  
  1382. if(getWord(RTBIC_TabSwatch.position,0) $= 0)
  1383. RTBIC_LeftScroll.setActive(0);
  1384. }
  1385.  
  1386. %flashL = 0;
  1387. %flashR = 0;
  1388. for(%i=0;%i<RTBIC_TabSwatch.getCount();%i++)
  1389. {
  1390. %tab = RTBIC_TabSwatch.getObject(%i);
  1391. if(%tab.isFlashing && !RTBIC_isTabVisible(%tab.text))
  1392. {
  1393. if(RTBIC_getTabDirection(%tab.text) $= "l")
  1394. %flashL = 1;
  1395. else if(RTBIC_getTabDirection(%tab.text) $= "r")
  1396. %flashR = 1;
  1397. }
  1398. }
  1399.  
  1400. if(%flashL && !RTBIC_LeftScroll.isFlashing)
  1401. RTBIC_startFlashTab(RTBIC_LeftScroll);
  1402. else if(!%flashL && RTBIC_LeftScroll.isFlashing)
  1403. RTBIC_stopFlashTab(RTBIC_LeftScroll);
  1404.  
  1405. if(%flashR && !RTBIC_RightScroll.isFlashing)
  1406. RTBIC_startFlashTab(RTBIC_RightScroll);
  1407. else if(!%flashR && RTBIC_RightScroll.isFlashing)
  1408. RTBIC_stopFlashTab(RTBIC_RightScroll);
  1409. }
  1410. function RTBIC_ScrollRight()
  1411. {
  1412. if(getWord(RTBIC_TabSwatch.extent,0)+getWord(RTBIC_TabSwatch.position,0) $= "553")
  1413. return;
  1414. RTBIC_TabSwatch.position = vectorSub(RTBIC_TabSwatch.position,"139 0");
  1415. RTBIC_refreshScroll();
  1416. }
  1417. function RTBIC_ScrollLeft()
  1418. {
  1419. if(getWord(RTBIC_TabSwatch.position,0) $= 0)
  1420. return;
  1421. RTBIC_TabSwatch.position = vectorAdd(RTBIC_TabSwatch.position,"139 0");
  1422. RTBIC_refreshScroll();
  1423. }
  1424. function RTBIC_isTabVisible(%name)
  1425. {
  1426. if(!RTBIC_hasTab(%name))
  1427. return;
  1428.  
  1429. %tab = RTBIC_getTab(%name);
  1430. %virtPos = getWord(%tab.position,0)+getWord(RTBIC_TabSwatch.position,0);
  1431. if(%virtPos >= 0 && %virtPos <= 417)
  1432. return 1;
  1433. else
  1434. return 0;
  1435. }
  1436. function RTBIC_getTabVirtPos(%name)
  1437. {
  1438. if(!RTBIC_hasTab(%name))
  1439. return 0;
  1440.  
  1441. %tab = RTBIC_getTab(%name);
  1442. %virtPos = getWord(%tab.position,0)+getWord(RTBIC_TabSwatch.position,0);
  1443. return %virtPos;
  1444. }
  1445. function RTBIC_getTabDirection(%name)
  1446. {
  1447. if(!RTBIC_hasTab(%name))
  1448. return 0;
  1449.  
  1450. %tab = RTBIC_getTab(%name);
  1451. %virtPos = RTBIC_getTabVirtPos(%name);
  1452. if(%virtPos < 0)
  1453. return "l";
  1454. else if(%virtPos > 417)
  1455. return "r";
  1456. else
  1457. return "v";
  1458. }
  1459. function RTBIC_hasTab(%name)
  1460. {
  1461. for(%i=0;%i<RTBIC_TabSwatch.getCount();%i++)
  1462. {
  1463. %tab = RTBIC_TabSwatch.getObject(%i);
  1464. if(%tab.text $= %name)
  1465. return 1;
  1466. }
  1467. return 0;
  1468. }
  1469. function RTBIC_getTab(%name)
  1470. {
  1471. for(%i=0;%i<RTBIC_TabSwatch.getCount();%i++)
  1472. {
  1473. %tab = RTBIC_TabSwatch.getObject(%i);
  1474. if(%tab.text $= %name)
  1475. return %tab;
  1476. }
  1477. return 0;
  1478. }
  1479. function RTBIC_ScrollToTab(%name)
  1480. {
  1481. if(!RTBIC_hasTab(%name))
  1482. return;
  1483. if(RTBIC_isTabVisible(%name))
  1484. return;
  1485.  
  1486. %tab = RTBIC_getTab(%name);
  1487. %dir = RTBIC_getTabDirection(%name);
  1488. %virtPos = getWord(%tab.position,0)+getWord(RTBIC_TabSwatch.position,0);
  1489. if(%dir $= "l")
  1490. {
  1491. RTBIC_TabSwatch.position = vectorSub(RTBIC_TabSwatch.position,%virtPos SPC "0");
  1492. RTBIC_refreshScroll();
  1493. }
  1494. else if(%dir $= "r")
  1495. {
  1496. %moveDist = %virtPos-417;
  1497. if(%moveDist < 0)
  1498. %moveDist = %moveDist-139;
  1499. RTBIC_TabSwatch.position = vectorSub(RTBIC_TabSwatch.position,%moveDist SPC "0");
  1500. RTBIC_refreshScroll();
  1501. }
  1502. }
  1503.  
  1504. //*********************************************************
  1505. //* Session Manifest Management
  1506. //*********************************************************
  1507. function RTBIC_createSession(%username)
  1508. {
  1509. if(RTBIC_hasSession(%username))
  1510. return;
  1511.  
  1512. %sess = new ScriptObject()
  1513. {
  1514. username = %username;
  1515. };
  1516. RTBIC_SessionManifest.add(%sess);
  1517.  
  1518. %sess.tab = RTBIC_pushTab(RTBIC_subTabName(%username),%sess,"RTBIC_endSession(\""@%username@"\");");
  1519. %sess.window = RTBIC_generateWindow(%sess);
  1520. %sess.tab.session = %sess;
  1521. RTBIC_makeFirstResponder();
  1522.  
  1523. return %sess;
  1524. }
  1525. function RTBIC_hasSession(%username)
  1526. {
  1527. for(%i=0;%i<RTBIC_SessionManifest.getCount();%i++)
  1528. {
  1529. %sess = RTBIC_SessionManifest.getObject(%i);
  1530. if(%sess.username $= %username)
  1531. return 1;
  1532. }
  1533. return 0;
  1534. }
  1535. function RTBIC_getSession(%username)
  1536. {
  1537. for(%i=0;%i<RTBIC_SessionManifest.getCount();%i++)
  1538. {
  1539. %sess = RTBIC_SessionManifest.getObject(%i);
  1540. if(%sess.username $= %username)
  1541. return %sess;
  1542. }
  1543. return 0;
  1544. }
  1545. function RTBIC_sendSessionMessage(%username)
  1546. {
  1547. if(!RTBIC_hasSession(%username))
  1548. return;
  1549.  
  1550. %sess = RTBIC_getSession(%username);
  1551. %message = %sess.window.messageBox.getValue();
  1552. if(%message $= "")
  1553. return;
  1554.  
  1555. if(filterKey(%message))
  1556. {
  1557. %sess.window.messageBox.setValue("");
  1558. %sess.window.messageVector.pushBackLine("\c2** DO NOT TELL PEOPLE YOUR BLOCKLAND KEY! **",0);
  1559. return;
  1560. }
  1561.  
  1562. if(!RTBIC_SC.connected)
  1563. {
  1564. %sess.window.messageVector.pushBackLine("\c2ERROR: You are not connected.",0);
  1565. %sess.window.messageBox.setValue("");
  1566. return;
  1567. }
  1568.  
  1569. if(getSubStr(%message,0,1) $= "/")
  1570. {
  1571. if(getWord(%message, 0) $= "/me" || getWord(%message, 0) $= "/action")
  1572. {
  1573. %vars = getWords(%message,1,getWordCount(%message)-1);
  1574. %message = "PRIVMSG "@%sess.username@" :\c0ACTION "@%vars@"\c0";
  1575. RTBIC_SC.sendLine(%message);
  1576. %sess.window.messageVector.pushBackLine("\c4* "@$RTB::CIRCClient::Cache::NickName SPC %vars,0);
  1577. }
  1578. else if(getWord(%message,0) $= "/ignore")
  1579. {
  1580. %user = getWord(%message,1);
  1581. if($Ignore::User[%user])
  1582. {
  1583. $Ignore::User[%user] = "";
  1584. %sess.window.messageVector.pushBackLine("\c6* You are no longer ignoring "@%user@".",0);
  1585. }
  1586. else
  1587. {
  1588. $Ignore::User[%user] = 1;
  1589. %sess.window.messageVector.pushBackLine("\c6* You are now ignoring "@%user@".",0);
  1590. }
  1591. }
  1592. else if(getWord(%message,0) $= "/unignore")
  1593. {
  1594. %user = getWord(%message,1);
  1595. if($Ignore::User[%user])
  1596. {
  1597. $Ignore::User[%user] = "";
  1598. %sess.window.messageVector.pushBackLine("\c6* You are no longer ignoring "@%user@".",0);
  1599. }
  1600. }
  1601. else if(getWord(%message,0) $= "/msg")
  1602. {
  1603. %vars = getWords(%message,1,getWordCount(%message)-1);
  1604. RTBIC_SC.sendLine("PRIVMSG "@%vars);
  1605.  
  1606. %username = getWord(%message,1);
  1607. if(RTBIC_hasSession(%username))
  1608. {
  1609. %sess = RTBIC_getSession(%username);
  1610. RTBIC_SetPane(%sess);
  1611. RTBIC_ScrollToTab(%username);
  1612. }
  1613. else
  1614. {
  1615. %sess = RTBIC_createSession(%username);
  1616. RTBIC_SetPane(%sess);
  1617. %sess.window.messageVector.pushBackLine("\c6* Now talking to "@%username@"...",0);
  1618. RTBIC_ScrollToTab(%username);
  1619. }
  1620. %sess.window.messageVector.pushBackLine("\c0<"@$RTB::CIRCClient::Cache::NickName@"> "@getWords(%message,2,getWordCount(%message)-1),0);
  1621. }
  1622. else if(getWord(%message,0) $= "/slap")
  1623. {
  1624. %name = getField(RTBIC_UserList.getValue(),1);
  1625. %num = getRandom(1,2);
  1626. if(%num $= 1)
  1627. {
  1628. if(%name !$= "")
  1629. %vars = "slaps "@%name@" around with a moose at large!";
  1630. else
  1631. %vars = "gets slapped around with a moose at large!";
  1632. }
  1633. else if(%num $= 2)
  1634. {
  1635. if(%name !$= "")
  1636. %vars = "slaps "@%name@" around with a whale bone!";
  1637. else
  1638. %vars = "gets slapped around with a whale bone!";
  1639. }
  1640. %message = "PRIVMSG "@RTBIC_SC.currentchannel@" :\c0ACTION "@%vars@"\c0";
  1641.  
  1642. RTBIC_SC.sendLine(%message);
  1643. RTBIC_addLine("\c4* "@$RTB::CIRCClient::Cache::NickName SPC %vars);
  1644. }
  1645. else if(getWord(%message,0) $= "/kick")
  1646. {
  1647. RTBIC_SC.sendLine("KICK "@RTBIC_SC.currentchannel@" "@getWord(%message,1));
  1648. }
  1649. else if(getWord(%message,0) $= "/join")
  1650. {
  1651. if(RTBIC_SC.currentChannel !$= "")
  1652. RTBIC_SC.sendLine("PART "@RTBIC_SC.currentChannel);
  1653. RTBIC_SC.sendLine(getSubStr(%message,1,strLen(%message)));
  1654. }
  1655. else
  1656. RTBIC_SC.sendLine(getSubStr(%message,1,strLen(%message)));
  1657. }
  1658. else
  1659. {
  1660. RTBIC_SC.sendLine("PRIVMSG "@%sess.username SPC %message);
  1661. %sess.window.messageVector.pushBackLine("<"@$RTB::CIRCClient::Cache::NickName@">" SPC %message,0);
  1662. }
  1663. %sess.window.messageBox.setValue("");
  1664. }
  1665. function RTBIC_endSession(%username)
  1666. {
  1667. if(!RTBIC_hasSession(%username))
  1668. return;
  1669.  
  1670. %sess = RTBIC_getSession(%username);
  1671. if(%sess.window.visible)
  1672. {
  1673. for(%i=0;%i<RTBIC_TabSwatch.getCount();%i++)
  1674. {
  1675. %tab = RTBIC_TabSwatch.getObject(%i);
  1676. if(%tab $= %sess.tab)
  1677. {
  1678. if(%i $= 0)
  1679. break;
  1680. %nextTab = RTBIC_TabSwatch.getObject(%i-1).session;
  1681. break;
  1682. }
  1683. }
  1684. RTBIC_SetPane(%nextTab);
  1685. }
  1686. %sess.window.delete();
  1687. %sess.tab.delete();
  1688. %sess.delete();
  1689.  
  1690. RTBIC_refreshScroll();
  1691. }
  1692.  
  1693. //*********************************************************
  1694. //* GUI Manipulation
  1695. //*********************************************************
  1696. function RTBIC_addLine(%line)
  1697. {
  1698. RTBIC_MessageVector.pushBackLine(%line,0);
  1699. }
  1700. function RTBIC_pushTab(%title,%window,%closeCommand)
  1701. {
  1702. %button = new GuiBitmapButtonCtrl()
  1703. {
  1704. profile = BlockButtonProfile;
  1705. extent = "136 25";
  1706. position = (138*RTBIC_TabSwatch.getCount())+(RTBIC_TabSwatch.getCount()) SPC "1";
  1707. command = "RTBIC_SetPane("@%window@");";
  1708. text = %title;
  1709. bitmap = "base/client/ui/tab1";
  1710. color = "255 255 255 255";
  1711.  
  1712. new GuiBitmapButtonCtrl()
  1713. {
  1714. position = "117 8";
  1715. extent = "11 11";
  1716. bitmap = "./images/buttons/small/btnDelete";
  1717. text = " ";
  1718. command = %closeCommand;
  1719. };
  1720. };
  1721. RTBIC_TabSwatch.add(%button);
  1722.  
  1723. if(%closeCommand $= "")
  1724. %button.getObject(0).delete();
  1725.  
  1726. if(RTBIC_TabSwatch.getCount() >= 1)
  1727. %xMax = getWord(RTBIC_TabSwatch.getObject(RTBIC_TabSwatch.getCount()-1).position,0)+136;
  1728. else
  1729. %xMax = 0;
  1730. RTBIC_TabSwatch.extent = %xMax SPC "27";
  1731. RTBIC_refreshScroll();
  1732.  
  1733. return %button;
  1734. }
  1735. function RTBIC_popTab(%id)
  1736. {
  1737. if(!isObject(%id))
  1738. return;
  1739.  
  1740. %id.delete();
  1741. RTBIC_refreshScroll();
  1742. }
  1743. function RTBIC_startFlashTab(%tab)
  1744. {
  1745. if(!isObject(%tab))
  1746. return;
  1747.  
  1748. %tab.isFlashing = 1;
  1749. if(isEventPending(%tab.flashSchedule1))
  1750. cancel(%tab.flashSchedule1);
  1751. if(isEventPending(%tab.flashSchedule2))
  1752. cancel(%tab.flashSchedule2);
  1753. if(isEventPending(%tab.flashSchedule3))
  1754. cancel(%tab.flashSchedule3);
  1755. RTBIC_FlashTab(%tab);
  1756.  
  1757. RTBIC_refreshScroll();
  1758. }
  1759. function RTBIC_FlashTab(%tab)
  1760. {
  1761. if(!isObject(%tab))
  1762. return;
  1763.  
  1764. %tab.flashSchedule1 = %tab.schedule(500,"setColor","255 0 0 255");
  1765. %tab.flashSchedule2 = %tab.schedule(750,"setColor","255 255 255 255");
  1766. %tab.flashSchedule3 = schedule(750,0,"RTBIC_FlashTab",%tab);
  1767. }
  1768. function RTBIC_stopFlashTab(%tab)
  1769. {
  1770. if(!isObject(%tab))
  1771. return;
  1772.  
  1773. %tab.setColor("255 255 255 255");
  1774. cancel(%tab.flashSchedule1);
  1775. cancel(%tab.flashSchedule2);
  1776. cancel(%tab.flashSchedule3);
  1777. %tab.isFlashing = 0;
  1778. }
  1779. function RTBIC_generateWindow(%sess)
  1780. {
  1781. %swatch = new GuiSwatchCtrl()
  1782. {
  1783. profile = GuiDefaultProfile;
  1784. position = "8 64";
  1785. extent = "601 383";
  1786. color = "0 0 0 0";
  1787. visible = 0;
  1788. isPane = 1;
  1789. };
  1790. RTB_IRCClient.getObject(0).add(%swatch);
  1791.  
  1792. %scroll = new GuiScrollCtrl()
  1793. {
  1794. profile = GuiScrollProfile;
  1795. position = "4 2";
  1796. extent = "591 352";
  1797. childMargin = "4 0";
  1798. columnWidth = 30;
  1799. hScrollBar = "alwaysOff";
  1800. vScrollBar = "dynamic";
  1801. };
  1802. %swatch.add(%scroll);
  1803.  
  1804. %mVector = new GuiMessageVectorCtrl()
  1805. {
  1806. profile = RTBIC_VectorProfile;
  1807. position = "5 0";
  1808. extent = "568 2";
  1809. };
  1810. %scroll.add(%mVector);
  1811.  
  1812. %rVector = new MessageVector();
  1813. %mVector.attach(%rVector);
  1814. %swatch.messageVector = %rVector;
  1815. %swatch.messageVectorCtrl = %mVector;
  1816.  
  1817. %messageBox = new GuiTextEditCtrl()
  1818. {
  1819. profile = RTBIC_MessageProfile;
  1820. position = "55 362";
  1821. extent = "422 16";
  1822. accelerator = "enter";
  1823. historySize = 10;
  1824. };
  1825. %swatch.add(%messageBox);
  1826. %messageBox.altCommand = "RTBIC_sendSessionMessage(\""@%sess.username@"\");";
  1827.  
  1828. %text = new GuiTextCtrl()
  1829. {
  1830. profile = RTB_Verdana12Pt;
  1831. position = "3 361";
  1832. extent = "47 18";
  1833. text = "Message:";
  1834. };
  1835. %swatch.add(%text);
  1836.  
  1837. %button = new GuiBitmapButtonCtrl()
  1838. {
  1839. profile = BlockButtonProfile;
  1840. position = "483 358";
  1841. extent = "54 22";
  1842. command = "RTBIC_sendSessionMessage(\""@%sess.username@"\");";
  1843. text = "Send";
  1844. bitmap = "base/client/ui/button2";
  1845. mColor = "255 255 255 255";
  1846. };
  1847. %swatch.add(%button);
  1848.  
  1849. %button = new GuiBitmapButtonCtrl()
  1850. {
  1851. profile = BlockButtonProfile;
  1852. position = "541 358";
  1853. extent = "55 22";
  1854. command = "RTBIC_endSession(\""@%sess.username@"\");";
  1855. text = "Close";
  1856. bitmap = "base/client/ui/button2";
  1857. mColor = "255 255 255 255";
  1858. };
  1859. %swatch.add(%button);
  1860. %swatch.session = %sess;
  1861. %swatch.messageBox = %messageBox;
  1862. return %swatch;
  1863. }
  1864.  
  1865. //*********************************************************
  1866. //* Support Functions
  1867. //*********************************************************
  1868. function RTBIC_subTabName(%name)
  1869. {
  1870. if(strLen(%name) > 15)
  1871. %name = getSubStr(%name,0,14)@"...";
  1872. return %name;
  1873. }
  1874.  
  1875. function RTBIC_getNameList()
  1876. {
  1877. if(RTBIC_SC.connected && RTBIC_SC.currentChannel !$= "")
  1878. {
  1879. RTBIC_SC.sendLine("NAMES "@RTBIC_SC.currentChannel);
  1880. }
  1881. }
  1882.  
  1883. function RTBIC_parseMessageText(%text)
  1884. {
  1885. for(%i=0;%i<strLen(%text);%i++)
  1886. {
  1887. if(getSubStr(%text,%i,7) $= "http://")
  1888. {
  1889. %beforeText = getSubStr(%text,0,%i);
  1890. %middleText = "<a:";
  1891. }
  1892. }
  1893. }
  1894.  
  1895. //*********************************************************
  1896. //* Package
  1897. //*********************************************************
  1898. package RTBC_IRCClient
  1899. {
  1900. function Canvas::setContent(%this,%content)
  1901. {
  1902. Parent::setContent(%this,%content);
  1903.  
  1904. for(%i=0;%i<RTBIC_NotificationManifest.getCount();%i++)
  1905. {
  1906. %not = RTBIC_NotificationManifest.getObject(%i);
  1907. %content.add(%not.window);
  1908. }
  1909. }
  1910.  
  1911. function Canvas::pushDialog(%this,%content)
  1912. {
  1913. Parent::pushDialog(%this,%content);
  1914.  
  1915. for(%i=0;%i<RTBIC_NotificationManifest.getCount();%i++)
  1916. {
  1917. %not = RTBIC_NotificationManifest.getObject(%i);
  1918. %this.getObject(%this.getCount()-1).add(%not.window);
  1919. }
  1920. }
  1921.  
  1922. function Canvas::popDialog(%this,%content)
  1923. {
  1924. Parent::popDialog(%this,%content);
  1925.  
  1926. for(%i=0;%i<RTBIC_NotificationManifest.getCount();%i++)
  1927. {
  1928. %not = RTBIC_NotificationManifest.getObject(%i);
  1929. %this.getObject(%this.getCount()-1).add(%not.window);
  1930. }
  1931. }
  1932. };
  1933. activatePackage(RTBC_IRCClient);
  1934.  
  1935. //*********************************************************
  1936. //* Execute-Time Instructions
  1937. //*********************************************************
  1938. if($RTB::Options::IC::AutoConnect && !RTBIC_SC.connected)
  1939. {
  1940. RTBIC_Connect();
  1941. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement