Omnimaga

General Discussion => Technology and Development => Computer Projects and Ideas => Topic started by: Juju on March 24, 2013, 07:40:36 pm

Title: nOmnomIRC - A command-line OmnomIRC client in php and ncurses
Post by: Juju on March 24, 2013, 07:40:36 pm
Well, this is whatever I worked on since yesterday evening, it's a command-line OmnomIRC client made in php using ncurses and readline, so it kinda looks like irssi and it supports input line edition and stuff like that (just like in irssi) and userlist. So yeah, pretty useful if you like irssi and you don't feel like firing up graphics. Oh, and don't forget editing the stuff at the beginning of file.

Source: https://raw.github.com/juju2143/nOmnomIRC/master/nomnomirc.php

TODO: Colors!
Title: Re: nOmnomIRC - A command-line OmnomIRC client in php and ncurses
Post by: Sorunome on March 24, 2013, 08:55:49 pm
sorunome-laptop% php ./nomnomirc.php
PHP Fatal error:  Call to undefined function ncurses_init() in /home/sorunome/Desktop/nomnomirc.php on line 212


And OmnomIRC works by now over elinks, so you don't need to fire up a GUI anyways :P
If you want to juju fork the project on github and do more stuff with it :)


EDIT: yeah, i have ncurses installed, it still doesn't work
Title: Re: nOmnomIRC - A command-line OmnomIRC client in php and ncurses
Post by: Juju on March 24, 2013, 09:21:17 pm
You should apt-get install php5-ncurses, then uncomment both extension=sqlite3.so (if you use Chrome or Firefox) and extension=ncurses.so in php.ini.

And yeah well, this one should be more convenient as it uses ncurses and it has a irssi look-and-feel.

Plus if you read the code, it's a pretty perfect example on how to use the OmnomIRC API, ncurses and readline.
Title: Re: nOmnomIRC - A command-line OmnomIRC client in php and ncurses
Post by: Sorunome on March 24, 2013, 09:22:29 pm
I use archlinux and that is not in the official repo or in the aur
Title: Re: nOmnomIRC - A command-line OmnomIRC client in php and ncurses
Post by: Juju on March 24, 2013, 09:27:17 pm
pacman -S php-ncurses, then.

EDIT: Wait got it wrong, was confused.
sudo pacman -S php-pear php-sqlite
sudo pecl install ncurses
Title: Re: nOmnomIRC - A command-line OmnomIRC client in php and ncurses
Post by: Sorunome on March 24, 2013, 09:28:12 pm
Nope, doesn't exist :(
Title: Re: nOmnomIRC - A command-line OmnomIRC client in php and ncurses
Post by: Juju on March 24, 2013, 10:17:31 pm
Now it works.

Also Sorunome wanted it in GitHub, there we go: https://github.com/juju2143/nOmnomIRC
Title: Re: nOmnomIRC - A command-line OmnomIRC client in php and ncurses
Post by: Juju on May 19, 2013, 04:51:51 am
Update! Colors! They work!

EDIT: They work even more!
Title: Re: nOmnomIRC - A command-line OmnomIRC client in php and ncurses
Post by: Sorunome on May 19, 2013, 04:11:52 pm
Nice! How about other text decorations?
Title: Re: nOmnomIRC - A command-line OmnomIRC client in php and ncurses
Post by: Juju on May 19, 2013, 04:13:51 pm
Nice! How about other text decorations?
They also work! 16 colors (or 8, dunno, it's hard to tell), bold, underline and reverse, they all work!
Title: Re: nOmnomIRC - A command-line OmnomIRC client in php and ncurses
Post by: Sorunome on May 19, 2013, 04:20:05 pm
also reversing reversed? (that doesn't work on omnomirc O.O)
(and italic? :P)
Title: Re: nOmnomIRC - A command-line OmnomIRC client in php and ncurses
Post by: Juju on May 19, 2013, 04:24:03 pm
Yes. No italics though.
Title: Re: nOmnomIRC - A command-line OmnomIRC client in php and ncurses
Post by: Sorunome on May 19, 2013, 04:25:26 pm
then add italic :P it is \x1d
Title: Re: nOmnomIRC - A command-line OmnomIRC client in php and ncurses
Post by: Juju on May 19, 2013, 04:35:53 pm
How you can italics in a terminal?
Title: Re: nOmnomIRC - A command-line OmnomIRC client in php and ncurses
Post by: Streetwalrus on June 10, 2013, 04:26:39 pm
Well, I get that :
PHP Fatal error:  Uncaught exception 'Exception' with message 'Unable to open database: unable to open database file' in /home/danelkouby/nomnomirc.php:330
                                                                                                                                                           Stack trace:
                                                                                                                                                                       #0 /home/danelkouby/nomnomirc.php(330): SQLite3->__construct('/home/danelkoub...')
                                                            #1 {main}
                                                                       thrown in /home/danelkouby/nomnomirc.php on line 330

I installed all the stuff correctly so I don't know what's wrong. :/
Title: Re: nOmnomIRC - A command-line OmnomIRC client in php and ncurses
Post by: Juju on June 10, 2013, 05:48:29 pm
It can't open the database where the cookies are stored. Which browser do you use? Did you tweaked the first lines or so of the php file?
Title: Re: nOmnomIRC - A command-line OmnomIRC client in php and ncurses
Post by: Streetwalrus on June 10, 2013, 05:55:19 pm
I just added #! /usr/bin/php to the top (obvious reason) and run it with ./nomnomirc.php.
I don't know how my browser could be related to this but I use Chromium from the Arch official repos.
Title: Re: nOmnomIRC - A command-line OmnomIRC client in php and ncurses
Post by: Juju on June 10, 2013, 10:10:52 pm
It uses Chromium's data to login to Omnimaga. So if you're logged in to Omni in Chromium and you gave the right path to the cookies database, you might be okay.
Title: Re: nOmnomIRC - A command-line OmnomIRC client in php and ncurses
Post by: Streetwalrus on June 11, 2013, 03:18:15 am
Oh well I did not edit anything else than that first line. :/ I guess that might be the issue.
Title: Re: nOmnomIRC - A command-line OmnomIRC client in php and ncurses
Post by: Streetwalrus on June 11, 2013, 12:22:03 pm
:P
I just changed the cookie path to the chromium one (changed google-chrome to chromium) and left the browser set as Chrome since both are nearly identical.
Title: Re: nOmnomIRC - A command-line OmnomIRC client in php and ncurses
Post by: Eeems on June 12, 2013, 11:35:09 am
Looks like you have to set the timezone in the script.
http://us2.php.net/manual/en/function.date-default-timezone-set.php  <-- Function you need to call at the start of the script.
http://us2.php.net/manual/en/timezones.php  <-- List of supported timezones to use.
Title: Re: nOmnomIRC - A command-line OmnomIRC client in php and ncurses
Post by: Juju on June 12, 2013, 01:31:57 pm
Actually you might want to set your timezone in php.ini. http://www.php.net/manual/en/datetime.configuration.php#ini.date.timezone
Title: Re: nOmnomIRC - A command-line OmnomIRC client in php and ncurses
Post by: Streetwalrus on June 12, 2013, 01:52:30 pm
I just updated my php.ini. It works now. :D
Seems to lag quite a bit though.
Title: Re: nOmnomIRC - A command-line OmnomIRC client in php and ncurses
Post by: Juju on June 12, 2013, 02:47:23 pm
It does yeah. It's not threaded, so it might freeze while it does the http requests. I gave a 1-second timeout though, so it won't freeze for like 60 seconds everytime.
Title: Re: nOmnomIRC - A command-line OmnomIRC client in php and ncurses
Post by: Dapianokid on June 12, 2013, 02:53:16 pm
I read the topic and assume it's for Nspires because of the n. Then, I get giddy because I assumed php was ported to Nspires.
Right.
Just...this.
I'll go put the fireworks away.

Not really, this is actually quite cool. Might help for those of us who can't use the widget :) Like at my mom's house, the computer there! because it is terrible using Windows Server and Chrome.
Title: Re: nOmnomIRC - A command-line OmnomIRC client in php and ncurses
Post by: Juju on June 12, 2013, 03:03:37 pm
That might work if you use Nspire Linux, actually, if you compile php for ARM and get Internet access to your calc.
Title: Re: nOmnomIRC - A command-line OmnomIRC client in php and ncurses
Post by: Dapianokid on June 12, 2013, 05:17:27 pm
Well that's much easier said than done.