Skip to content
Browse files

Version 2.3

  • Loading branch information...
1 parent c7849bf commit fcada2f7b4105236207039308bce445b39c0b9c2 @PrasannaVenkadesh committed
Showing with 111 additions and 16 deletions.
  1. +37 −0 Contacts.rb
  2. +37 −0 Login.rb
  3. +2 −2 README.txt
  4. +15 −10 chat.rb
  5. +20 −4 features.rdoc
View
37 Contacts.rb
@@ -0,0 +1,37 @@
+=begin
+Program name: Gmail contacts
+Date Written: 16/08/2011
+Date Modified: 17/08/2011
+Author : Sathianarayanan.S
+License: GPL2.0
+Version: 1.1
+=end
+class Login
+
+ require 'rubygems'
+ require 'mechanize'
+ require 'highline/import'
+
+ def do_login(uname,pwd)
+
+ username = uname
+ #password = ask("Enter the password :" ) { |p| p.echo = "*" }
+ password = pwd
+ agent = Mechanize.new
+ agent.user_agent_alias = 'Mac Safari'
+ page = agent.get("https://accounts.google.com/ServiceLogin?service=talk&passive=true&skipvpage=true&continue=https://talkgadget.google.com/talkgadget/gauth?verify%3Dtrue%26noref%3Dtrue")
+ puts 'Instant Contacts - They may be online or may not be online'
+ puts "===========================================================\n"
+ form = page.forms.first
+ form.Email = username
+ form.Passwd = password
+ page = agent.submit form
+ page = agent.get("https://talkgadget.google.com/talkgadget/notifierclient?authuser=0&client=sm&prop=homepage&nav=true&fid=gtn-roster-iframe-id&ts=0&debug=undefined&os=Linux%20i686&stime=1321542905985&fb=false&re=true&no=undefined&hc=undefined&ref=undefined&xpc={%22cn%22%3A%22l12414%22%2C%22tp%22%3A1%2C%22ifrid%22%3A%22gtn-roster-iframe-id%22%2C%22pu%22%3A%22https%3A%2F%2Ftalkgadget.google.com%2Ftalkgadget%2F%22}&pvt=AMP3uWbAWkoMlxoBoRz5blr_5GzrcOLyzFSOGz1b8v05VvY6n5Dz_MHOcGTVrYYOgXSX1jqnHyC3DSzNLh2YwVsdqd_LBB1CJA%3D%3D&href=https%3A%2F%2Fplus.google.com%2F_%2Fapps-static%2F_%2Fjs%2Fhome%2Fb%2Cs%2Frt%3Dh%2Fver%3DtsR4kt6l09w.en_GB.%2Fsv%3D1%2Fam%3D!daPtsgL6ilJKGt6e0wnY2dIyMmgIoZymxU2gzO8%2Fd%3D1%2F%3Frel%3D1&hl=en-GB&pal=1&host=1&zx=b2bdyck1y551")
+ url = page.search("script").last().attributes["src"]
+ page = agent.get(url)
+ contacts = page.body.scan(/42[a-z|A-Z|0-9._%+-]+@[a-z]+.com/)
+ contacts.uniq.each do |c|
+ puts c.gsub(/^42/,"")
+ end
+ end
+end
View
37 Login.rb
@@ -0,0 +1,37 @@
+=begin
+Program name: Gmail contacts
+Date Written: 16/08/2011
+Date Modified: 17/08/2011
+Author : Sathianarayanan.S
+License: GPL2.0
+Version: 1.1
+=end
+class Login
+
+ require 'rubygems'
+ require 'mechanize'
+ require 'highline/import'
+
+ def do_login(uname,pwd)
+
+ username = uname
+ #password = ask("Enter the password :" ) { |p| p.echo = "*" }
+ password = pwd
+ agent = Mechanize.new
+ agent.user_agent_alias = 'Mac Safari'
+ page = agent.get("https://accounts.google.com/ServiceLogin?service=talk&passive=true&skipvpage=true&continue=https://talkgadget.google.com/talkgadget/gauth?verify%3Dtrue%26noref%3Dtrue")
+ puts 'Instant Contacts - They may be online or may not be online'
+ puts "===========================================================\n"
+ form = page.forms.first
+ form.Email = username
+ form.Passwd = password
+ page = agent.submit form
+ page = agent.get("https://talkgadget.google.com/talkgadget/notifierclient?authuser=0&client=sm&prop=homepage&nav=true&fid=gtn-roster-iframe-id&ts=0&debug=undefined&os=Linux%20i686&stime=1321542905985&fb=false&re=true&no=undefined&hc=undefined&ref=undefined&xpc={%22cn%22%3A%22l12414%22%2C%22tp%22%3A1%2C%22ifrid%22%3A%22gtn-roster-iframe-id%22%2C%22pu%22%3A%22https%3A%2F%2Ftalkgadget.google.com%2Ftalkgadget%2F%22}&pvt=AMP3uWbAWkoMlxoBoRz5blr_5GzrcOLyzFSOGz1b8v05VvY6n5Dz_MHOcGTVrYYOgXSX1jqnHyC3DSzNLh2YwVsdqd_LBB1CJA%3D%3D&href=https%3A%2F%2Fplus.google.com%2F_%2Fapps-static%2F_%2Fjs%2Fhome%2Fb%2Cs%2Frt%3Dh%2Fver%3DtsR4kt6l09w.en_GB.%2Fsv%3D1%2Fam%3D!daPtsgL6ilJKGt6e0wnY2dIyMmgIoZymxU2gzO8%2Fd%3D1%2F%3Frel%3D1&hl=en-GB&pal=1&host=1&zx=b2bdyck1y551")
+ url = page.search("script").last().attributes["src"]
+ page = agent.get(url)
+ contacts = page.body.scan(/42[a-z|A-Z|0-9._%+-]+@[a-z]+.com/)
+ contacts.uniq.each do |c|
+ puts c.gsub(/^42/,"")
+ end
+ end
+end
View
4 README.txt
@@ -4,13 +4,13 @@ This is a team work of
S. Sathianarayanan(http://sathia27.wordpress.com/) &
S. Prasanna Venkadesh (http://prasopensource.wordpress.com/)
-md5Checksum - bf7ed3306ab115750a94d9c541f8e16f chat.rb
+md5checksum - 56950b231f1f8e64c6bf07924beaf426 chat.rb
Step 1: Download the file 'chat.rb' from the repository
Step 2: Make sure you have installed Ruby 1.8.x (Recommended) in your Linux box and have installed Rubygems1.8 (Recommended).
-Step 3: Run the Ruby script like 'ruby chat.rb' from your terminal.
+Step 3: Run the Ruby script like './chat.rb' or 'ruby1.8 chat.rb' from your terminal.
Step 4: Dependencies need to be satisfied for the first time, so type 'y' to satisfy dependencies from Internet.
View
25 chat.rb
@@ -11,15 +11,16 @@
require 'xmpp4r-simple' #Simple XML Protocol for Jabber API
require "highline/import" #for password protection
require 'gmail' #for gmail access
+ require "Contacts"
system('clear')
system('espeak "Welcome. Dude" >/dev/null 2>&1')
- puts "Whiz Chat Version - 2.2".colorize(:yellow)
+ puts "Whiz Chat Version - 2.3".colorize(:yellow)
puts "Developed by- S. Sathianarayanan (sathia2704@gmail.com)\nImproved by- S. Prasanna Venkadesh (prasmailme@gmail.com)\nGithub Repository: https://github.com/PrasannaVenkadesh/Whiz-Chat\n".colorize( :blue ).underline
- print 'Enter the username :'
+ print 'Enter your Gmail Username :'
username = gets.chomp #Get input from username for user-id
#gets password for mail account, ask from higline gem
- password = ask("Enter the password :" ) { |p| p.echo = "*" }
+ password = ask("Enter your password :" ) { |p| p.echo = "*" }
def quit
#type 'bye' in terminal after logging in, you will be logged out.
@@ -39,11 +40,15 @@ def quit
end
end
if(@opt == 'q')
- quit()
+ quit
end
end while(@opt!='c')
- print 'To username: '
+
+ login = Login.new
+ login.do_login(username,password)
+ puts "\n"
+ print 'To Username: '
@to_username = gets.chomp #prompt for userid to whom you want to chat with
puts "Connecting to jabber server.."
@jabber = Jabber::Simple.new(username+'@gmail.com',password) #using jabber api to connect with gmail account.
@@ -70,7 +75,7 @@ def send
@jabber.deliver(@to_username+"@gmail.com", @mess)
sleep(1) #for multithreading
end
- quit()
+ quit
end
#method to read and display the message from sender
@@ -89,7 +94,7 @@ def receive
end
end
end
- quit()
+ #quit
end #end of receive method
t1=Thread.new { send() } #instance for sending thread
@@ -104,9 +109,9 @@ def receive
a = gets.chomp
if( a == 'y')
system('sudo apt-get install rubygems1.8')
- system('sudo gem install xmpp4r-simple')
- system('sudo gem install highline')
- system('sudo gem install colorize')
+ system('gem install xmpp4r-simple')
+ system('gem install highline')
+ system('gem install colorize')
end
rescue Jabber::ClientAuthenticationFailure
View
24 features.rdoc
@@ -9,7 +9,7 @@ The Feature of latest release will be at the last.
1. If more than one user chats, then all the chats will be displayed messing up (Debugged in version 2.0)
2. Do not Works, if you are using proxy for your internet.
3. Throws some Interrupt exceptions.
--------------------------------------------------------------------------------------------------------------------
+------------------------------------------------------------------------------------------------------------------
<b>Features of Whiz-chat - 2.0:</b>
1. Basic sending and receiving messages between users by gmail account.
2. Added colors to display, differentiating messages between users.
@@ -22,7 +22,7 @@ The Feature of latest release will be at the last.
<b>Known Bugs:</b>
1. Do not works, if you are using proxy for your internet.
--------------------------------------------------------------------------------------------------------------------
+------------------------------------------------------------------------------------------------------------------
<b>Features of Whiz-chat - 2.01:</b>
1. Basic sending and receiving messages between users by gmail account.
2. Color differentiation between sender and receiver chat.
@@ -31,7 +31,7 @@ The Feature of latest release will be at the last.
No Bugs were fixed since version 2.0
------------------------------------------------------------------------------------------------------------------
-<b>Features of Whiz-chat - 2.2 (Current):</b>
+<b>Features of Whiz-chat - 2.2:</b>
1. Basic sending and receiving messages between users by gmail account.
2. Color differentiation between sender and receiver chat.
3. Welcome message. Sound Alert on each received chat, Terminatting alert.
@@ -40,5 +40,21 @@ No Bugs were fixed since version 2.0
**6. A menu drive start-up, where you can check status of mail and quit or you can Chat and quit.</i>
<b>Bugs:</b>
- The one and only known bug of not working under proxy still remains, and we are working on it.
+ 1. The known bug of not working under proxy still remains, and we are working on it.
+ 2. Dependencies being installed again and again.
+------------------------------------------------------------------------------------------------------------------
+<b>Features of Whiz-chat - 2.3 (Current):</b>
+ 1. Basic sending and receiving messages between users by gmail account.
+ 2. Color differentiation between sender and receiver chat.
+ 3. Welcome message. Sound Alert on each received chat, Terminatting alert.
+ 4. Setting the status message for your account.
+ 5. You can check the status of your mail of your same account.
+ 6. A menu drive start-up, where you can check status of mail and quit or you can Chat and quit.
+<i> **7. Displays a list of Instant Contacts (they may be online or may not be online, but they are displayed in the order like what it will be displayed in Gmail Chat plugin, so online contacts will be at top priority in the list).</i>
+
+<b>Bugs Fixed:</b>
+ 1. Dependencies being installed again and again. (Hope it is fixed, please report if it happens again).
+
+<b>Bugs:</b>
+ 1. The known bug of not working under proxy still remains, and we are working on it.
------------------------------------------------------------------------------------------------------------------

0 comments on commit fcada2f

Please sign in to comment.
Something went wrong with that request. Please try again.