Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Netham45

Pages: 1 [2] 3 4
17
News / OmnomIRC Release - Current Version: Alpha 2
« on: June 24, 2011, 05:39:55 pm »
Here's a release of OmnomIRC Alpha 1!


I just finished the installer, so I cannot guarantee that it is bug-free, but it seems to be working for me. It currently doesn't have any of the forum integration with it.

To use: Upload to a web server. Make sure that the web server has write permissions to the folder(for writing the config)
Go to the folder. The installer will request SQL information from you and set up the config and everything. Then go back to the index and enter a username.

Right now, there is no login system either(To be coming soon!), so usernames are unprotected(anyone can use anyones name.)

Download: http://netham45.org/OmnomIRC_Releases/OmnomIRC_Alpha2.zip

Also, along with this release, I will be temporarily ceasing updates on Omnimaga's OmnomIRC while I work on getting this version compatible with SMFs login system.

EDIT: Ohey, we're up to Alpha 2 already! Fixed file paths(were windows paths, now unix paths), and fixed a bug corrupting cookies.

18
Computer Projects and Ideas / Seamless RDP
« on: June 24, 2011, 01:44:49 am »
Just made this nifty program that makes RDP somewhat more seamless to the host desktop. It's really small, and pretty much complete for what I'm going to do with it.

What I'm doing to make it work is this: Set the wallpaper on the client to 77,77,77 RGB, and set that as the RDP window's transparency key.

Known bugs: 77,77,77 RGB requires 24-bit color depth


Attached is the a bin.


Doesn't relate to calcs, but it's still nifty. :P

Edit: SCREENSHOT!

EDIT2: No need for the entire project. Here's the source in entirety (Set as multi-byte in project properties):
Code: [Select]
#include <windows.h>
#include <iostream>
#include <Psapi.h>

BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam);

//Defining these obviously local vars as global so they don't get re-defined every time. Trying to speed shit up.
COLORREF getColor = RGB(0,0,0);
COLORREF transKey = RGB(77,77,77);
unsigned char alpha = 0;
const unsigned char unfocused = 180;
const unsigned char focused = 255;
HWND hwndCurrent;
TCHAR WindowTitle[MAX_PATH] = "";

int main()
{
printf("Press CTRL+C to quit\n");
while(true)
{
EnumWindows(EnumWindowsProc, 0);
Sleep(20);
}
}

BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam) {

GetWindowText(hwnd, WindowTitle, sizeof(WindowTitle));
if (strstr(WindowTitle,"- Remote Desktop Connection"))
{
if (!GetLayeredWindowAttributes(hwnd,&getColor,&alpha,NULL)) SetWindowLong(hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED);

if (GetForegroundWindow() != hwnd)
{
if (alpha != unfocused) SetLayeredWindowAttributes(hwnd,transKey,unfocused,LWA_COLORKEY + LWA_ALPHA);
}
else if (alpha != focused) SetLayeredWindowAttributes(hwnd,transKey,focused,LWA_COLORKEY + LWA_ALPHA);

}
return true;
}

Edit3:
Here's a lite version. run it once on launch. Bin attached.
Code: [Select]
#include <windows.h>
#include <iostream>
#include <Psapi.h>
BOOL CALLBACK EnumWindowsProcess(HWND hwnd, LPARAM lParam);

const COLORREF transKey = RGB(77,77,77);

int main()
{
EnumWindows(EnumWindowsProcess, 0);
}

BOOL CALLBACK EnumWindowsProcess(HWND hwnd, LPARAM lParam)
{
TCHAR WindowTitle[MAX_PATH] = "";
GetWindowText(hwnd, WindowTitle, sizeof(WindowTitle));
if (strstr(WindowTitle,"- Remote Desktop Connection") && !GetLayeredWindowAttributes(hwnd,NULL,NULL,NULL))
{
SetWindowLong(hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED);
SetLayeredWindowAttributes(hwnd,transKey,255,LWA_COLORKEY + LWA_ALPHA);
}
return true;
}

Edit4:
Performance is awful when Aero is disabled on the host.

19
Archive / OmnomIRC Protocol Information
« on: June 20, 2011, 01:22:28 am »
OmnomIRC Protocol Stuffs (Giant wall of post go!)
All code is javascript
Required functions:

addLine(ircMessage) - This function is called from the load.php to load messages.
addUser(userMessage) - This function is called from the load.php to keep track of users.


The ircMessage message is pretty simple.
There is a common header.

Common Header:
   Message Number:Message Type:Online:Time
   Message Number -- Corresponds to the auto-incrementing primary key in the SQL DB. You will need to put this on the update.php call to not return already-parsed lines.
   Message Type -- pm,message,action,join,part,kick,quit,mode,nick,topic,curline, check the next section.
   Online -- Boolean value to tell if the source was from OmnomIRC or IRC. I use this to check if I should apply links to OmnomIRC names.
   Time -- UNIX Timestamp

After the common header, all elements are base64 encoded. Check btoa.js for a cross-browser base64 implementation.
   
Specific Types:
   pm, message, action, part, quit, mode, topic - These share paramaters
      :Name 1:Message
   join
      :Name 1
   nick
      :Name 1:Name 2
   curline
      No parts, used to set the current line.
      
Examples:
   pm, message, action, part, quit, mode, topic
   Decoded:
      1:message:0:12345:Netham45:Test
   Encoded:
      1:message:0:12345:TmV0aGFtNDU=:VGVzdA==
   
   Join
   Decoded:
      1:join:0:12345:Netham45
   Encoded:
      1:message:0:12345:TmV0aGFtNDU=
   Nick
   Decoded:
      1:nick:0:12345:Netham45:Netham46
   Encoded:
      1:nick:0:12345:TmV0aGFtNDU=:TmV0aGFtNDY=
   curline: -- This does not return a proper timestamp, as it is not actually matched to an event in the SQL DB.
      1:curline:0:0
      
To parse in javascript, this is a simple method (assuming you're using the btoa.js included):

Code: [Select]
function addLines(message)
{
var messageParts = message.split(":");
for (var i=4;i<messageParts.length;i++)
messageParts[i] = base64.decode(messageParts[i]);
curLine = messageParts[0]; //This is a global var for a reason
var type = messageParts[1];
var online = messageParts[2];
var time = new Date(messageParts[3]);
textBox.innerHTML += "[" + time.toLocaleString() + "] ";
switch (type)
{
case "message":
textBox.innerHTML += "&lt; " + messageParts[4] + " &gt; " + messageParts[5];
break;
case "action":
...
}
textBox.innerHTML += "<br/>";
}

userMessage information:
These are simpler, only composed of two parts. They are all the same. They are only sent from the load.php for now.

userName:Online

userName is a base64 encoded name
Online is a boolean value for if they're on OmnomIRC or not

Example:
Decoded:
   Netham45:1
Encoded:
   TmV0aGFtNDU=:1
   
Here is the code from Omnom_Parser.js that deals with users:
Code: [Select]
//******************************
// Userlist Start              *
//******************************
userListContainer = document.getElementById("UserListArrContainer");
userListDiv = document.getElementById("UserList");
UserListArr = array();

function addUser(user)
{
UserListArr.push(user);
}

function addUserJoin(user)
{
if(!hasLoaded) return;
var userp = base64.encode(user) + ":0";
UserListArr.push(userp);
parseUsers();
}

function removeUser(user)
{
if(!hasLoaded) return;
for (i in UserListArr)
{
parts = UserListArr[i].split(":");
if (base64.decode(parts[0]) == user)
UserListArr.splice(i,1);
}
parseUsers();
}

function parseUsers()
{
if (!userListDiv || userListDiv == null)
userListDiv = document.getElementById("UserList");
userText = "";
i = 0;
UserListArr.sort(function(a,b)
{
var al=base64.decode(a).toLowerCase(),bl=base64.decode(b).toLowerCase();
return al==bl?(a==b?0:a<b?-1:1):al<bl?-1:1;
});
for (i=0;i<UserListArr.length;i++)
{
parts = UserListArr[i].split(":");
if (parts[1] == "0") userText = userText + "#" + base64.decode(parts[0]) + "<br/>";
if (parts[1] == "1")
userText = userText + '<a target="_parent" href="http://www.omnimaga.org/index.php?action=ezportal;sa=page;p=13&userSearch=' +base64.decode(parts[0]) +
'"><img src="http://netham45.org/irc/efnet/ouser.png" alt="Omnimaga User" title="Omnimaga User" border=0 width=8 height=8 />' + base64.decode(parts[0]) + '</a><br/>';
if (parts[1] == "2") userText = userText + "!" + base64.decode(parts[0]) + "<br/>";
}
userText = userText + "<br/><br/>";
userListDiv.innerHTML = userText;
}

//******************************
// Userlist End                *
//******************************


To "subscribe" to updates:
Request load.php. This returns a javascript file that calls addLine and addUser
nick and signature are optional, they are only used to return PMs. Channel is required for what channel you're querying. Signature and nick need to be in place to request PMs.
All paramaters except count are base64 encoded.

Here's the URL:
Decoded:
   http://omnom.omnimaga.org/OmnomIRC_Dev/load.php?count=50&channel=#Omnimaga&nick=Netham45&signature=No sig for you!
Encoded:
   http://omnom.omnimaga.org/OmnomIRC_Dev/load.php?count=50&channel=I09tbmltYWdh&nick=TmV0aGFtNDU=&signature=Tm8gc2lnIGZvciB5b3Uh

   
Once load.php is parsed, you need to request update.php. This does not return a javascript file, but instead just returns the message.
lineNum is not base64 encoded, but everything else is.

Here's the URL:
Decoded:
   http://omnom.omnimaga.org/OmnomIRC_Dev/update.php?lineNum=1&channel=#omnimaga&nick=Netham45&signature=No sig for you!   
Encoded:
   http://omnom.omnimaga.org/OmnomIRC_Dev/update.php?lineNum=1&channel=I09tbmltYWdh&nick=TmV0aGFtNDU=&signature=Tm8gc2lnIGZvciB5b3Uh

   
Here is the code from Omnom_Parser that handles 'subscribing' and updating:
Code: [Select]
function load()
{
var body= document.getElementsByTagName('body')[0];
var script= document.createElement('script');
script.type= 'text/javascript';
script.src= 'Load.php?count=50&channel=' + base64_encode("#Omnimaga") + "&nick=" + base64.encode("Netham45") + "&signature=" + base64.encode("lolnope");
script.onload= function(){parseUsers();startLoop();mBoxCont.scrollTop = mBoxCont.scrollHeight;hasLoaded = true;};
body.appendChild(script);
}

//******************************
// Start Request Loop functions*
//******************************
function startLoop()
{
xmlhttp=getAjaxObject();
if (xmlhttp==null) {
alert ("Your browser does not support AJAX! Please update for OmnomIRC compatibility.");
return;
}
xmlhttp.onreadystatechange=getIncomingLine;
sendRequest();
}

function sendRequest()
{
url = "http://omnom.omnimaga.org/OmnomIRC_Dev/Update.php?lineNum=" + curLine + "&channel=" + getChannelEn() + "&nick=" + base64.encode(parent.userName) + "&signature=" + base64.encode(parent.Signature);
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}

function getIncomingLine()
{
if (xmlhttp.readyState==4 || xmlhttp.readyState=="complete") {
if (xmlhttp.status == 200) addLine(xmlhttp.responseText); //Filter out 500s from timeouts
sendRequest();
}
}

function getAjaxObject()
{
xmlhttp=new XMLHttpRequest(); //Decent Browsers
if (!xmlhttp || xmlhttp == undefined || xmlhttp == null) xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");  //IE7+
if (!xmlhttp || xmlhttp == undefined || xmlhttp == null) xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); //IE6-
return xmlhttp;
}

//******************************
// End Request Loop functions  *
//******************************

20
OmnomIRC Development / OmnomIRC SVN Information
« on: June 19, 2011, 11:45:00 pm »
Here's what I believe to be the complete source code for OmnomIRC + all other things required.

Click here to open it in your browser

https://netham45.org:444/svn/OmnomIRC/

Username: guest
Password: guest
Read-Only access, sorry. :P

If anyone actually wants to get this up and running for themselves, feel free to ask for help. It will function as a full-fledged client/server architecture without the IRC bot, too.

There are a few places where I am using full file paths (includes, mostly).

Also note that the GPL'd code in btoa(the unicode conversion code) is 100% unmodified. The base64 tools (after the lower copyright notice) are slightly modified to add calls to the unicode code, and to remove errors that I thought weren't needed(My code compensated for them.)

Edit: OmnomIRC has been released under GPL. The SVN has been updated to include this license.

Edit2: The SVN was changed to port 444 from 443 due to a conflict. I forgot to update that here, mah bad.

21
OmnomIRC Development / OmnomIRC Modes
« on: June 18, 2011, 12:48:47 am »
I'm getting to the point where I can implement modes for users on OmnomIRC(per-channel).

I'm thinking this:

User modes:
+b - banned, cannot speak or view chat. Equivalent to +b on IRC.
+m - muted, cannot speak, but can view chat (This would be closest to +m -v user on IRC)
+o - operator, can set +d, +m on users, can always speak/see chat (This would be closest to +a on admin chans)
+i - invited, this user has been invited to the chan by an operator. This would be overridden by +d, +m. +o would imply

the first user to join a channel will receive a +o flag, along with all Omni staff. We can remove/add +o's.

Chan-wise modes:
+s - secret, won't be displayed on the list when I get it added
+c - closed, will only be settable by Omni admins. Effectively a ban on *. It'd be used for channels like @cemetech or @goatse, since they don't need to be on OmnomIRC.
+i - invite only, user must have +i in the chan to join (will effectively be a +b on the user unless they have +i)


Commands:
@(un)ban nick - (un)sets +b on nick
@(un)mute nick - (un)sets +m on nick
@(un)invite nick - (un)sets +i on nick
@(de)op nick - (un)sets +o on nick
@close/open chan - (un)sets mode +c on chan
@drop chan - drops chan, removes all entries from the permissions table, the next user to join would then get +o. It'd be useful for a chan that was last used 4 months ago that someone wants now.

I won't be implementing kicks, I just don't think they'd be any good to have.

Close/open will obviously only work for non-IRC chans. I will try to make invite respect the chan modes, so @(un)invite doesn't need to be set from Omnom on them.

IRC operators will also have +o on OmnomIRC for them, and will be able to execute @defaen, @mute, @op, and @invite from within the chan.


Any suggestions on this? I'ma see about getting it started tomorrow.

22
Archive / OmnomIRC updates - 06/16
« on: June 16, 2011, 07:58:56 pm »
I pushed a fair number of OmnomIRC updates today.

Server-side:
  • OmnomIRC is now a PHP bot. It won't keep disconnecting like the old mIRC bot did, and a number of exploits have been resolved thanks to this
  • Forum staff now have the ability to restart the bot

Client-side:
  • There have been more channels added. #Omnimaga, #Omnimaga-fr, #Omnimaga-Spam, and #nspire-lua are currently supported. To get the last two, please enable the 'Extra Channels' option in the options
  • The userlist updates again. It also live-updates when users sign into or out of IRC
  • Tab completion once again works
  • Moderators will find the moderator chan available




Please clear your caches on your client, if it is not working properly.
See http://ourl.ca/10749 for more help on that.

23
Archive / OmnomIRC/IRCD/SpyBot45 outage -TAKE TWO-
« on: June 06, 2011, 10:05:04 am »
Okay, once again, I'm going to be working on moving it all to a new server. Hopefully this one won't have the issues the other one did, so I won't have to revert after 12 hours.


OmnomIRC/netham45.irc.omnimaga.org/SpyBot45 is going to be periodically down throughout the day today, though I don't expect it to be down for more than an hour total. Please don't make threads when they're down. :P

24
Archive / New OmnomIRC Features
« on: May 13, 2011, 06:59:19 am »
I'm going to make a new post here every time I add a major feature.

05-13-2011 Chrome Desktop Notification support
                 Audible Notification Support (Ding on Highlight)


Edit: I don't need another changelog. Go look at the other one if you want updates.

25
Site Feedback and Questions / Christmas theme!
« on: May 13, 2011, 05:40:23 am »
I used to love the Christmas theme we had in 2006, bring it back! :D

26
Archive / Merging bots
« on: May 11, 2011, 05:48:59 pm »
I'd like to merge the bots(Spybot45 & OmnomIRC) into one bot for simplicity purposes on my end, any ideas/thoughts about that?

27
Archive / OmnomIRC Numbers!
« on: May 11, 2011, 03:40:40 am »
The current version requests the chat log every 4.5 seconds. That's 4300 bytes or 4.3KB every 5 seconds.

4.3 * 12 = 51.6kb/min
51.6 * 60 = 3,096kb(3MB)/hr

One of the userlist files that refreshes every 15 seconds is 700 bytes.

700*4=2800b(2.8kb)/min

2.8*60 = 168kb/hr

3096+168 = 3264kb/hr

The other userlist is about 800b every 15 seconds.

800*4=3200b/m
3.2*60 = 192kb/hr
3264kb/hr+192kb/hr = 3456 kb/hour, or 3.4MB in usage.

The new Omnom engine uses 2,067 bytes for the initial request(only ran once per tab), and uses at max 500 bytes about every 30 seconds afterwards(45 second timeout, guesstimating the messages averaged in bring that to 30).

500 * 2 = 1000b/m
1000*60 = 60,000b(6kb/h)/h
60,000+2067 = 62,067b/hour

62kb is 1/55th of 3456kb, meaning the new Omnom engline should use about 1/55th of the bandwidth on your end, or what lasted you about a minute and 6 seconds on the old OmnomIRC will now last you for an hour on the new one.

28
Archive / Spybot45 Dev Ideas
« on: May 10, 2011, 01:44:16 am »
Since I can get external access to the Omni DB, I'ma do something like this for SpyBot45.


Code: (pseudo -almost- PHP code) [Select]
message = mysql_fetch_array(sql_query("SELECT MAX(`id_msg`) FROM `omnitempboard_messages`"));
mID = message[`ID_MSG`];
tID = message[`ID_TOPIC`];
mPoster = message[`posterName`];

topic = mysql_fetch_array(sql_query("SELECT * FROM `omnitempboard_topics` WHERE `id_topic` = %s",tID));
tBoard = topic['ID_BOARD'];
tFirstID = topic['ID_FIRST_MSG'];

fMessage = mysql_fetch_array(sql_query("SELECT * FROM `omnitempboard_messages` WHERE `id_msg` = %s",tFirstID));

tTopicName = fMessage['subject'];

echo sprintf("New Post by %s in %s http://omniurl.tk/%i/%i", mPoster,tTopicName,tID,mID);


I hate SQL sometimes. SMF DB layout even more.

What this does is:

  • Request the most recent post
  • record name, threadid
  • Request the thread associated
  • record first post ID(thread subject), board id(for filtering)
  • Request the first post in the thread
  • Record its subject, it's the title of the thread

That's actually almost all that's required for it, I just need to get it done. That will make it so the site won't slow down really bad when posting if my server is acting up. Right now it's requesting a PHP page off my server every post.

29
Archive / OmnomIRC Dev Ideas
« on: May 10, 2011, 01:21:41 am »
Posting some thoughts I've been having about updating Omnom to be less resource intensive. Just throwing some of this stuff out there if anyone wants to comment.

Don't refresh every 5 seconds or so, but use long polling loop and just return a result when something is said(Would need some sort of client-side parser, but that could be really easy to
do.)

Basically, request update.php, update.php waits with server-side sleep()'s. When something is updated, it finishes update.php and returns the event, something like this:
eventType:base64(message)
Join:base64("Netham45")

the client-side parser would then split it based off of the :, and run Join('Netham45') which would update the textbox, which would print something like 'Netham45 has joined.' or something. Here is what I was thinking for those:

names,messages,modes,targets would be base64_encode'd
line would be the current line, a unique ID for the last line its gotten, for keeping track of where it should check server-side
Code: [Select]
line:join:name
line:join:netham45

line:part:name:message
line:part:netham45:Z8015-190D

line:quit:name:message *Merge quit and part?
line:quit:netham45:Z8015-190D

line:kick:kicker:kicked:message
line:kick:netham45:netbot45:Kick!


line:message:name:message:isOmnom
line:message:netham45:Nom!:1

line:action:name:message
line:action:netham45:explodes


line:mode:modes:targets
line:mode:+ovib:Netham45 Netham45 *@*!*

I was also planning on storing however many lines I'm displaying in an array.

Code: [Select]
Lines = Array();
Lines[0] = "1:message:Netham45:NOM!";
Lines[1] = "2:kick:Netham45:Netbot45:(Netham45)";
...

addLine(message)
{
var i = 1;
for (i;i<Lines.count();i++)
{
Lines[i-1] = Lines[i];
}
Lines[i] = message;
parseMessages();
}

and to parse, something similar:

Code: (parserish thingey javascript-ish code) [Select]

parseMessages()
{
for (i = 0;i<Lines.count();i++)
{
parse(Lines[i]);
}
}

parse(message)
{
chatBox = "";
parts = message.split(":")
type = parts[1]
curLine = lines;
switch type
{
case "join":
chatBox = chatBox + join(parts[2]);break;
case "part":
chatBox = chatBox + part(parts[2],parts[3]);break;
case "quit":
chatBox = chatBox + quit(parts[2],parts[3]);break;
case "kick":
chatBox = chatBox + kick(parts[2],parts[3],parts[4]);break;
case "message":
chatBox = chatBox + message(parts[2],parts[3]);break;
case "action":
chatBox = chatBox + action(parts[2],parts[3]);break;
case "mode":
chatBox = chatBox + mode(parts[2],parts[3]);break;
}
}

join(name)
return name + " has joined";
part(name,reason)
return name + " has left #Omnimaga (" + reason + ")";
quit(name,reason)
return name + " has quit IRC (" + reason + ")";
etc...

Server-side, I plan on having an IRC bot that logs the last 1000 or so lines to a SQL table as they're said. Any more is worthless, half that would still be worthless. :P
irc_lines = (`line_number`k,ai,`name1`,`name2`,`message`)
Code: (pseudo) [Select]
curPos = sql_query("SELECT MAX(`line_number') FROM `irc_lines`");
sql_query("INSERT INTO `irc_lines` (`action`,`name1`,`name2`,`message`) VALUES ('%s','%s','%s','%s')",curPos,"Join","Netham45","0","0");
sql_query("INSERT INTO `irc_lines` (`action`,`name1`,`name2`,`message`) VALUES ('%s','%s','%s','%s')",curPos,"Kick","Netham45","Netbot45","Stop Lagging you stupid bot!");
sql_query("DELETE FROM `irc_lines` WHERE `line_number` < %s",curPos - 1000);
And to get it from the server, something like this:
Code: (more pseudo) [Select]
getLines()
{
while (true)
{
stuffs = mysql_fetch_array(sql_query("SELECT * FROM `irc_lines` WHERE 'line_number' > %s",reqLines));

for (i=0;i<count(stuffs);i++)
{
switch (stuffs['action'])
{
case "join:
echo stuffs['line_number'] . ':' . stuffs['action'] . ':' . stuffs['name1];
etc...
}
}
if (count(stuffs)) break;
sleep(50);
}
}



Gimmeh ideas/suggestions.

30
Archive / OmnomIRC temporarily disabled
« on: May 06, 2011, 06:01:24 pm »
OmnomIRC is temporarily disabled until we can track down the source of the site slowness.

iOmnom and iOmnom_Mini are unaffected.

Pages: 1 [2] 3 4