wtorek, 12 lutego 2008

[EN] Jabber extension for modrapi - rapidshare download manager for linux

Most of you know what XMPP is
(jabber communication protocol).

Most of you are using jabber clients
to communicate with friends also.

Me 2!

I am using Pidgin as my client.
Becouse of that - ive created in perl a little script that emulate modrapi interface as jabber user.

It looks a liitle bit like this:

(19:05:27) m0d@mydomain.com:
yo

(19:05:27) snake: Hi m0d!
If you want to talk with me - enter valid password :

(19:05:36) m0d@mydomain.com:
TOPSECRETPASSWORD

(19:05:36) snake:
Now i remember you - m0d!

What do you want to do now?
Options:
bye - Logout
modrapi - Manage modrapi

(19:07:03) m0d@mydomain.com:
modrapi

(19:07:03) snake:
modrapi options:
help - Display this menu
bye - Logout
main - Return to main menu
add - Add rapidshare links
import - Import rapidshare links from web
status - Check modrapi status
db - Check queue
storage - Check downloaded files
delete - Delete links from queue
download - Start download

(19:08:05) m0d@mydomain.com:
status

(19:08:05) snake:
Status: Waiting for a job
What do you want to do now?


...


What do we need for modjabber?
1) XMPP perl library ( apt-get install libnet-xmpp-perl )
2) jabber server (4 example ejabberd: apt-get install ejabberd)
3) modrapi - rc2 version (link below)
4) modjabber.pm (link below)

Basic configuration of ejabberd is verry simple
edit: /etc/ejabberd/ejabberd.cfg

find section "%% Hostname"
and place there your domain or public IP
{hosts, ["mydomain.com"]}.

restart ejabberd server :
$ ejabberdctl restart

now we need to register our modrapi jabber client:
$ ejabberdctl register snake mydomain.com JABBER_PASSWORD

We need to launch snake (login of our client) with system start
Owner of modjabber must be equal to the owner of modrapi configuration.
So...

edit: /etc/rc.local
above "exit 0" place:

su -c "perl /path/to/modjabber.pm" - SYSTEM_LOGIN
4 example:
su -c "perl /my/init/modjabber.pm" - m0d

now edit modjabber.pm (lines 11-16) and place there your data

i think thats all

package (modrapi rc2 + modjabber) download

Please leave me a comment if you are using modrapi, modjabber!

9 komentarzy:

dddaavv pisze...

I like it !! It's working fine. I'm definitely gonna use it for life :)
Keep up the good work man, i'll check your blog regularly.

dddaavv pisze...

and it would be pretty cool if the dude sends us a message when the download are done and queue now empty.
thanks man

mrmike pisze...

Your script is great!! I use it all the time, so I decided to use and the jabber mod.Although I did exactly as you said I have this problem when I try to restart ejabberdctl "RPC failed on the node 'ejabberd@user-desktop': nodedown". I am using Ubuntu 8.10. I searched around but haven't found something where solves this.
Have you maybe andy idea?
Thanks

m0d pisze...

mrmike - have you ever connected to this server? everything works but restarting is problematic?

konopka pisze...

Hi,

I have a problem with modjabber. Previously it has been working at my server (Kubuntu HH) but now I installed (after a crash) Ubuntu JJ.

I do not know how to launch modjabber.pm. I did everything as it is stated in manual but the result is as follows:

piotr@pk-server:~$ su -c "perl /etc/modrapi/modjabber.pm" - piotr
Hasło:
Connected
Authorized
There was an error in the last call to Process that you did not check for and
handle. You should always check the output of the Process call. If it was
undef then there was a fatal error that you need to check. There is an error
in your program at /etc/modrapi/modjabber.pm line 77

What should I do? Modrapi works fine in terminal. I do not know what to do with this error???

Regards
Piotr

m0d pisze...

download fresh version (without your changes)
add your account data
add file to /usr/bin and chmod it (/etc is not a good idire - permission problems i think)

logon piotr
# perl /usr/bin/modjabber.pm
and paste here

konopka pisze...

Hi

it is the same.

piotr@pk-server:~$ perl /usr/bin/modjabber.pm
Connected
Authorized
There was an error in the last call to Process that you did not check for and
handle. You should always check the output of the Process call. If it was
undef then there was a fatal error that you need to check. There is an error
in your program at /usr/bin/modjabber.pm line 77

1. I downloaded http://rapidshare.com/files/93212028/modrapi-1.0rc2_modjabber.tar.gz
2. decompressed
3. edited&saved:
my $hostName = "pk-server";
my $portNumber = 5222;
my $componentName = "pk-server";
my $userName = "snake";
my $passWord = "MYPASS";
my $MyPassword = 'MYPASS';
4. copied into /usr/bin
5. checked user rights (root - read+write, group root - read only, others - read only)
6. launched command perl perl /usr/bin/modjabber.pm

Nothing changed :(

Biednemu wiatr w oczy :D, ale dziękuję za odzew
Piotrek

m0d pisze...

niestety nie mam pomyslu
imho wydaje mi sie ze problem tkwi w bibliotekach perlowych xmpp - moze przeinstaluj? :>

kiewee123 pisze...

Hi there mr dev, if your still alive can you tell me why I keep getting this error when trying to add something to queue -

printf() on closed filehandle HANDLE at /home/kieron/.modrapi/modjabber.pm line 216.
readline() on closed filehandle DAT at /home/kieron/.modrapi/modjabber.pm line 272.

and I get told when trying to download that the queue is empty.

thanks in advanced, i'd love to get this working, my email is kiewee123 alla gmail spotty com