Skip to content
Browse files

Fixed remove contact

  • Loading branch information...
1 parent f9d9a1a commit 6d0b72d6fd6db593c809760e8855ad53ba6a01a1 @lifely committed Mar 15, 2012
Showing with 16 additions and 2 deletions.
  1. +16 −2 lib/xmpp4r-simple.rb
View
18 lib/xmpp4r-simple.rb
@@ -19,6 +19,8 @@
require 'xmpp4r'
require 'xmpp4r/roster'
require 'xmpp4r/vcard'
+require 'awesome_print'
+
require 'awesome_print'
require 'rexml/document'
@@ -60,10 +62,18 @@ def ask_for_authorization!
end
def unsubscribe!
+ # unsubscription_request = Presence.new.set_type(:unsubscribe)
+ # unsubscription_request.to = jid
+ # client.send!(unsubscription_request)
+ # client.send!(unsubscription_request.set_type(:unsubscribed))
unsubscription_request = Presence.new.set_type(:unsubscribe)
unsubscription_request.to = jid
client.send!(unsubscription_request)
client.send!(unsubscription_request.set_type(:unsubscribed))
+ roster_item = client.roster.items[jid]
+ if roster_item
+ roster_item.remove()
+ end
end
def jid(bare=true)
@@ -108,7 +118,6 @@ def set_gravatar(email)
hash = Digest::MD5.hexdigest(email.downcase)
gravatar = "http://www.gravatar.com/avatar/#{hash}"
-
puts "[Debug] Here the GravatarURI: #{gravatar}"
# set vcard info
@@ -119,7 +128,12 @@ def set_gravatar(email)
# buddy icon stuff
vcard["PHOTO/TYPE"] = "image/png"
# open buddy icon/avatar image file
- image_file = open(gravatar)
+ begin
+ image_file = open(gravatar)
+ rescue
+ puts "Error with gravatar."
+ false
+ end
puts "[Debug] Testing opening the Gravatar:"
ap image_file
# Base64 encode the file contents

0 comments on commit 6d0b72d

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