Ejemplo n.º 1
0
mainbuffer = gtk.TextBuffer()
mainview = gtk.TextView(mainbuffer)
chathbox = gtk.HBox(False, 0)
mainmessage = gtk.Entry()
mainbutton = gtk.Button("Send")

rosterstore = gtk.TreeStore(gobject.TYPE_STRING)
rosterview = gtk.TreeView(rosterstore)
rosterscroll = gtk.ScrolledWindow(None, None)
rosterscroll.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
rosterscroll.add(rosterview)
rostercell = gtk.CellRendererText()


client = fbchatlib.get_facebook_client()
xmpp_client = fbchatlib.setup_chat(client, mainbuffer)

mainbutton.connect("clicked", send_message_gui, xmpp_client, None, mainmessage.get_text())
mainmessage.connect("activate", send_message_gui, xmpp_client, None, mainmessage.get_text())

mainview.set_editable(False)
chathbox.pack_start(mainmessage, True, True, 0)
chathbox.pack_start(mainbutton, False, True, 0)
mainscroll.add(mainview)
mainscroll.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
chatbox.pack_start(mainscroll, True, True, 0)
chatbox.pack_start(chathbox, False, False, 0)
mainbox.pack_start(rosterscroll, True, False, 0)
mainbox.pack_start(chatbox, True, True, 0)
mainwindow.add(mainbox)
mainwindow.show_all()
Ejemplo n.º 2
0
import fbchatlib, sys

print "Put in the UID of who you want to talk to:"
uid = sys.stdin.readline()
client = fbchatlib.get_facebook_client()
xmpp_client = fbchatlib.setup_chat(client, uid.strip(), 'lol')
xmpp_client.connect_and_loop()