This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Starting a Project - Advice requested

Old posts that have not been replied to for several years.
Locked
U
Ulath
Voice
Posts: 4
Joined: Sun Oct 31, 2004 4:39 pm

Starting a Project - Advice requested

Post by Ulath »

I'm a third year CS student in England, and am starting my dissertation project, which I have the topic for myself, I intend to write something that in its simplest form allows messages to be sent from the MSN messenger network (or any IM network in theory), and arrive in a IRC channel, and back again - More features and so forth depend on how long it takes me to get this working.

I intend to use the gaim source code for connecting to the IM network, and an Eggdrop bot to handle the IRC side of things.

I've not yet coded anything, but hope to start this week. Just a few questions I'd like answers or opinons on:

1) Is it feasible? I have until next April, working on my own with my supervisors limited help. I'd say I'm an average programmer, not a genius one, but not someone who gets scared of anything apart from Java on Windows (what we get taught and that many of my classmates love, shunning everything else) - My fave language is Perl and I have done little bits of C, TCL, Python, shell.

2) What would be the best way of linking the 2 parts of the project together? My thoughts are either:
a TCL script that calls C functions (from gaim) for the IM connection & msg sending/recieveing probably via an extension (or other method - Read something about procs?)

or:

An Eggdrop module which directly uses the gaim code. I'm not really sure about either, I have had a look at sample TCL scripts and Woobie (sample module), and can't decide which is better

3)Would there be interest If I released the project (after marking/moderation/whatever else they need to do), under GPL or similar license? My main reason for picking this topic is that it would be useful to me, just wondering if anyone else would have a use for it?

Any hints, suggestions, critisisms gratefully accepted. If you need any additional Info just ask.
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

here's an unreleased script of mine which I've been using to get notified via MSN when a friend joins IRC; feel free to use it as you wish:

Code: Select all

set msn_version "v1.1"

set msn_watchlist "+astra +MARI-ANA +foobar"

set msn_passport "demond@gmx.net"
set msn_password "parola"
set msn_who "lubomirr@hotmail.com"

set msn_header "MIME-Version: 1.0\r\nContent-Type: text/plain; charset=UTF-8\r\n"
set msn_header2 "X-MMS-IM-Format: FN=Microsoft%20Sans%20Serif; EF=B; CO=0000FF; CS=0; PF=22\r\n"

set msn_didx 0
set msn_nidx 0
set msn_sidx 0
set msn_inuse 0

proc msn {message} {
	global msn_didx msn_message
	global msn_inuse
	if {$msn_inuse} {return}
	set msn_message $message
	set msn_didx [connect messenger.hotmail.com 1863]
	control $msn_didx msn_control
	putdcc $msn_didx "VER 0 MSNP7 MSNP6 MSNP5 MSNP4 CVR0"
	set msn_inuse 1
	utimer 15 "set msn_inuse 0"
}

proc msn_control {idx text} {
	global msn_didx msn_nidx msn_sidx
	global msn_passport msn_password
	global msn_message msn_who
	global msn_header msn_header2
if {$text != ""} {putlog "MSN<<< $text"}
	set reply [lrange $text 0 1]
	if {$idx == $msn_didx} {
if {$text == ""} {putlog "MSN<<< (Dispatch closed connection)"; set msn_didx 0}
		switch $reply {
			"VER 0" {putdcc $msn_didx "INF 1"}
			"INF 1" {putdcc $msn_didx "USR 2 MD5 I $msn_passport"}
			"XFR 2" {
				set msn_nhost [lindex [split [lindex $text 3] :] 0]
				set msn_nport [lindex [split [lindex $text 3] :] 1]
				set msn_nidx [connect $msn_nhost $msn_nport]
				control $msn_nidx msn_control
				putdcc $msn_nidx "VER 3 MSNP7 MSNP6 MSNP5 MSNP4 CVR0"
			}
		}
	}
	if {$idx == $msn_nidx} {
if {$text == ""} {putlog "MSN<<< (Notification closed connection)"; set msn_nidx 0}
		switch $reply {
			"VER 3" {putdcc $msn_nidx "INF 4"}
			"INF 4" {putdcc $msn_nidx "USR 5 MD5 I $msn_passport"}
			"USR 5" {
				set msn_hash [lindex $text 4]
				putdcc $msn_nidx "USR 6 MD5 S [md5 "${msn_hash}${msn_password}"]"
			}
			"USR 6" {putdcc $msn_nidx "CHG 7 NLN"}
			"CHG 7" {putdcc $msn_nidx "SYN 8 0"}
			"SYN 8" {utimer 5 "putdcc $msn_nidx \"ADD 9 AL $msn_who $msn_who\""}
			"ADD 9" {putdcc $msn_nidx "XFR 10 SB"}
			"215 9" {putdcc $msn_nidx "XFR 10 SB"}
			"XFR 10" {
				set msn_shost [lindex [split [lindex $text 3] :] 0]
				set msn_sport [lindex [split [lindex $text 3] :] 1]
				set msn_hash [lindex $text 5]
				set msn_sidx [connect $msn_shost $msn_sport]
				control $msn_sidx msn_control
				putdcc $msn_sidx "USR 11 $msn_passport $msn_hash"
			}
			"CHL 0" {putdcc $msn_nidx "OUT"}
		}
	}
	if {$idx == $msn_sidx} {
if {$text == ""} {putlog "MSN<<< (Switchboard closed connection)"; set msn_sidx 0}
		switch -glob $reply {
			"USR 11" {putdcc $msn_sidx "CAL 12 $msn_who"}
			"JOI *" {
				set message "${msn_header}${msn_header2}\r\n${msn_message}"
				putdcc $msn_sidx "MSG 13 A [string length $message]"
				putdcc $msn_sidx $message
putlog "MSG 13 A [string length $message]\n$message"
			}
		}
	}
}

proc msn_initserver {type} {
	global msn_watchlist
	puthelp "WATCH $msn_watchlist"
}

proc msn_rawwatch {from keyword args} {
	set args [lindex $args 0]
	set nick [lindex $args 1]
	set user [lindex $args 2]
	set host [lindex $args 3]
	switch $keyword {
		"600" {set what "is on IRC!"}
		"601" {set what "has left IRC"}
	}
	msn "${nick}!${user}@${host} $what"
}

proc msn_msnsay {hand idx args} {
	set args [lindex $args 0]
	if {$args == ""} {putdcc $idx "Usage: .msnsay <message>"; return}
	putlog "#$hand# msnsay $args"
	msn "<$hand> $args"	
}

bind evnt - init-server msn_initserver
bind raw - 600 msn_rawwatch
bind raw - 601 msn_rawwatch
bind dcc o|o msnsay msn_msnsay

putlog "MSN notify pager $msn_version by demond loaded"
(IRC notification is done via WATCH command, which you might not have on your server; I ported it from DALnet's df to my ircd-hybrid-7-bg)
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

you might want to check out centericq's libmsn as well

the proper way of implementing this would be an eggdrop interface module, which would add TCL commands interfacing gaim/libmsn functions, plus an eggdrop TCL script which would utilize these commands to create MSN functionality for IRC users
g
greenbear
Owner
Posts: 733
Joined: Mon Sep 24, 2001 8:00 pm
Location: Norway

Post by greenbear »

i guess you should be changing your msn password now :-?
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

gb wrote:i guess you should be changing your msn password now :-?
wrong guess :P
U
Ulath
Voice
Posts: 4
Joined: Sun Oct 31, 2004 4:39 pm

Post by Ulath »

Thanks for the responses.

I will play with that script and see how it goes after talking to my supervisor next week, the only problem I can see with it is it is hard to add additional protocols, for example AIM, but its a good starting point.

One last question, any one know any good books for C / TCL?
I took out "the C Programming Language" book today as a starting point for C, as it seems to be the definative reference, is there a similar one for TCL?
G
Galadhrim
Op
Posts: 123
Joined: Fri Apr 11, 2003 8:38 am
Location: Netherlands, Enschede

Post by Galadhrim »

Personally I would use TCL as little as possible. I have picked up a TCL script and they language is quite nasty. Unless you are good at it and you know how to markup the code you might be able to keep it going for a while.

At the other hand C is easy to use alot of people know how C and there are alot of libraries ready for use like the centericq's libmsn. So anyone can pick up your project and extend it. The last is, imo, the biggest pro. If there is one thing us open-source coders need is reusability!
U
Ulath
Voice
Posts: 4
Joined: Sun Oct 31, 2004 4:39 pm

Post by Ulath »

Ok, I've been playing around a bit the last week trying to find the best way of getting a connection to MSN to work, Ive looked at:

GAIM (C) - Has all the functionality required, but trying to extract it out of the mix of GTK and other non useful parts seems like suicide for an inexperienced C programmer.

libmsn - Documentation sucks which makes it very difficult to understand, it seems to do everything I want it to, but once again my limited C experience is hindering me, but seems to be the best bet.

I've looked at the TCL script posted above, loaded it into my eggdrop, but it dosnt seem to work (replaced all the user variables etc), it does a
"MSN <<< VER 0 CV0" which gets followed by a
"MSN<<< (Dispatch closed connection)

Which looks like its having problems connecting to the msn server, or am I on totally the wrong track?

I think the best way for me to get something working would be to map libmsn functions into TCL, I have aquaired Welches "Practical Programming in TCL and TK" which I have been reading, but without much sucess, it seems I may have bitten off a bit more than I can chew for a first time C/TCL project :oops: . Anyone out there fancy giving me a hand?

I think the best bet at the moment is to devote my attention to linking libmsn into TCL, once I have access to the functions I need (connect to server, send msg etc), I think I should be able to code up some TCL to do something with them. Any guides, advice or critisism appreciated

Thanks In advance
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

Hi,

One thing that may make things harder is that libmsn seems to be a C++ library, not a C library. I think your best bet is to use something like libgaim. I don't think you have to bother with gtk and all that, from what I've read -- libgaim is just the gaim library, there is no user interface.

I have no idea where to get it, although I would guess it's available through gaim.sf.net somehow.

On the other hand, you can write a module in C++, you just have to do some fancy things with the extern "C" directive.

Have you looked at amsn? It's a tcl client.
Locked