Mercurial > pidgin.yaz
annotate finch/libgnt/pygnt/dbus-gnt @ 21512:166b7949be3d
Compile when plugins are disabled
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Wed, 14 Nov 2007 23:09:03 +0000 |
parents | c1c260d41365 |
children |
rev | line source |
---|---|
15932
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1 #!/usr/bin/env python |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
2 |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
3 # This script requires Python 2.4 and pygnt bindings |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
4 # |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
5 # Note that all function names are resolved dynamically, no |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
6 # purple-specific library is needed. |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
7 |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
8 import dbus |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
9 import dbus.glib |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
10 import dbus.decorators |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
11 import gobject |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
12 import os |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
13 import gnt |
18556
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16143
diff
changeset
|
14 import sys |
15932
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
15 |
19419
6df41719037c
Utilize the message-history in dbus-gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18841
diff
changeset
|
16 import time |
15932
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
17 |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
18 convwins = {} |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
19 |
18839
ed50c9745b1d
Use appropriate text-flags depending on the message flags.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18679
diff
changeset
|
20 def buddysignedon(buddy): |
15932
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
21 pass |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
22 |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
23 def conv_closed(conv): |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
24 key = get_dict_key(conv) |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
25 stuff = convwins[key] |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
26 stuff[0].destroy() |
18841
03a0054954bb
"Bless me father for I have sinned."
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18839
diff
changeset
|
27 # if a conv window is closed, then reopened, this thing crashes |
15932
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
28 convwins[key] = None |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
29 |
19419
6df41719037c
Utilize the message-history in dbus-gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18841
diff
changeset
|
30 def add_message(conv, who, msg, flags, timestamp): |
6df41719037c
Utilize the message-history in dbus-gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18841
diff
changeset
|
31 stuff = show_conversation(conv, False) |
15932
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
32 tv = stuff[1] |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
33 tv.append_text_with_flags("\n", 0) |
19419
6df41719037c
Utilize the message-history in dbus-gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18841
diff
changeset
|
34 if timestamp: |
6df41719037c
Utilize the message-history in dbus-gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18841
diff
changeset
|
35 tv.append_text_with_flags(time.strftime("(%X) ", time.localtime(timestamp)), 8) |
6df41719037c
Utilize the message-history in dbus-gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18841
diff
changeset
|
36 else: |
6df41719037c
Utilize the message-history in dbus-gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18841
diff
changeset
|
37 tv.append_text_with_flags(time.strftime("(%X) "), 8) |
18839
ed50c9745b1d
Use appropriate text-flags depending on the message flags.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18679
diff
changeset
|
38 if flags & 3: |
ed50c9745b1d
Use appropriate text-flags depending on the message flags.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18679
diff
changeset
|
39 tv.append_text_with_flags(who + ": ", 1) |
19419
6df41719037c
Utilize the message-history in dbus-gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18841
diff
changeset
|
40 msg = purple.PurpleMarkupStripHtml(msg) |
18839
ed50c9745b1d
Use appropriate text-flags depending on the message flags.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18679
diff
changeset
|
41 tv.append_text_with_flags(msg, 0) |
ed50c9745b1d
Use appropriate text-flags depending on the message flags.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18679
diff
changeset
|
42 stuff[0].set_urgent() |
ed50c9745b1d
Use appropriate text-flags depending on the message flags.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18679
diff
changeset
|
43 else: |
ed50c9745b1d
Use appropriate text-flags depending on the message flags.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18679
diff
changeset
|
44 tv.append_text_with_flags(msg, 8) |
15932
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
45 tv.scroll(0) |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
46 |
19419
6df41719037c
Utilize the message-history in dbus-gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18841
diff
changeset
|
47 def wrote_msg(account, who, msg, conv, flags): |
6df41719037c
Utilize the message-history in dbus-gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18841
diff
changeset
|
48 add_message(conv, who, msg, flags, None) |
6df41719037c
Utilize the message-history in dbus-gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18841
diff
changeset
|
49 |
15932
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
50 bus = dbus.SessionBus() |
16143
598b1b15b199
Trac Ticket #149 from JensenDied
Richard Laager <rlaager@wiktel.com>
parents:
15932
diff
changeset
|
51 obj = bus.get_object("im.pidgin.purple.PurpleService", "/im/pidgin/purple/PurpleObject") |
598b1b15b199
Trac Ticket #149 from JensenDied
Richard Laager <rlaager@wiktel.com>
parents:
15932
diff
changeset
|
52 purple = dbus.Interface(obj, "im.pidgin.purple.PurpleInterface") |
15932
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
53 |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
54 bus.add_signal_receiver(buddysignedon, |
16143
598b1b15b199
Trac Ticket #149 from JensenDied
Richard Laager <rlaager@wiktel.com>
parents:
15932
diff
changeset
|
55 dbus_interface = "im.pidgin.purple.PurpleInterface", |
15932
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
56 signal_name = "BuddySignedOn") |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
57 |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
58 bus.add_signal_receiver(wrote_msg, |
16143
598b1b15b199
Trac Ticket #149 from JensenDied
Richard Laager <rlaager@wiktel.com>
parents:
15932
diff
changeset
|
59 dbus_interface = "im.pidgin.purple.PurpleInterface", |
15932
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
60 signal_name = "WroteImMsg") |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
61 |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
62 bus.add_signal_receiver(wrote_msg, |
16143
598b1b15b199
Trac Ticket #149 from JensenDied
Richard Laager <rlaager@wiktel.com>
parents:
15932
diff
changeset
|
63 dbus_interface = "im.pidgin.purple.PurpleInterface", |
15932
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
64 signal_name = "WroteChatMsg") |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
65 |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
66 bus.add_signal_receiver(conv_closed, |
16143
598b1b15b199
Trac Ticket #149 from JensenDied
Richard Laager <rlaager@wiktel.com>
parents:
15932
diff
changeset
|
67 dbus_interface = "im.pidgin.purple.PurpleInterface", |
15932
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
68 signal_name = "DeletingConversation") |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
69 |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
70 def get_dict_key(conv): |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
71 val = purple.PurpleConversationGetName(conv) |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
72 return val |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
73 |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
74 def send_im_cb(entry, key, conv): |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
75 if key[0] == '\r': |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
76 # XXX: do something about the / commands |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
77 type = purple.PurpleConversationGetType(conv) |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
78 if type == 1: |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
79 imdata = purple.PurpleConversationGetImData(conv) |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
80 purple.PurpleConvImSend(imdata, entry.get_text()) |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
81 else: |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
82 chatdata = purple.PurpleConversationGetChatData(conv) |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
83 purple.PurpleConvChatSend(chatdata, entry.get_text()) |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
84 entry.clear() |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
85 |
18841
03a0054954bb
"Bless me father for I have sinned."
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18839
diff
changeset
|
86 def conv_window_destroyed(win, key): |
03a0054954bb
"Bless me father for I have sinned."
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18839
diff
changeset
|
87 del convwins[key] |
03a0054954bb
"Bless me father for I have sinned."
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18839
diff
changeset
|
88 |
19419
6df41719037c
Utilize the message-history in dbus-gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18841
diff
changeset
|
89 def show_conversation(conv, history): |
15932
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
90 key = get_dict_key(conv) |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
91 if key in convwins: |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
92 return convwins[key] |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
93 win = gnt.Window() |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
94 vbox = gnt.Box(0, 1) |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
95 win.add_widget(vbox) |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
96 win.set_title(purple.PurpleConversationGetName(conv)) |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
97 win.set_pad(0) |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
98 vbox.set_pad(0) |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
99 tv = gnt.TextView() |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
100 entry = gnt.Entry("") |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
101 vbox.add_widget(tv) |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
102 entry.set_size(40, 1) |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
103 vbox.add_widget(entry) |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
104 entry.connect("key_pressed", send_im_cb, conv) |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
105 tv.clear() |
19419
6df41719037c
Utilize the message-history in dbus-gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18841
diff
changeset
|
106 tv.attach_scroll_widget(entry) |
15932
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
107 win.show() |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
108 convwins[key] = [win, tv, entry] |
18841
03a0054954bb
"Bless me father for I have sinned."
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18839
diff
changeset
|
109 win.connect("destroy", conv_window_destroyed, key) |
19419
6df41719037c
Utilize the message-history in dbus-gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18841
diff
changeset
|
110 |
6df41719037c
Utilize the message-history in dbus-gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18841
diff
changeset
|
111 if history: |
6df41719037c
Utilize the message-history in dbus-gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18841
diff
changeset
|
112 msgs = purple.PurpleConversationGetMessageHistory(conv) |
19420
c1c260d41365
The conversation history is in a reversed list.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19419
diff
changeset
|
113 msgs.reverse() |
19419
6df41719037c
Utilize the message-history in dbus-gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18841
diff
changeset
|
114 for msg in msgs: |
6df41719037c
Utilize the message-history in dbus-gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18841
diff
changeset
|
115 who = purple.PurpleConversationMessageGetSender(msg) |
6df41719037c
Utilize the message-history in dbus-gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18841
diff
changeset
|
116 what = purple.PurpleConversationMessageGetMessage(msg) |
6df41719037c
Utilize the message-history in dbus-gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18841
diff
changeset
|
117 flags = purple.PurpleConversationMessageGetFlags(msg) |
6df41719037c
Utilize the message-history in dbus-gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18841
diff
changeset
|
118 when = purple.PurpleConversationMessageGetTimestamp(msg) |
6df41719037c
Utilize the message-history in dbus-gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18841
diff
changeset
|
119 add_message(conv, who, what, flags, when) |
6df41719037c
Utilize the message-history in dbus-gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18841
diff
changeset
|
120 |
15932
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
121 return convwins[key] |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
122 |
18556
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16143
diff
changeset
|
123 def show_buddylist(): |
18841
03a0054954bb
"Bless me father for I have sinned."
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18839
diff
changeset
|
124 win = gnt.Window() |
03a0054954bb
"Bless me father for I have sinned."
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18839
diff
changeset
|
125 tree = gnt.Tree() |
03a0054954bb
"Bless me father for I have sinned."
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18839
diff
changeset
|
126 tree.set_property("columns", 1) |
03a0054954bb
"Bless me father for I have sinned."
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18839
diff
changeset
|
127 win.add_widget(tree) |
03a0054954bb
"Bless me father for I have sinned."
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18839
diff
changeset
|
128 node = purple.PurpleBlistGetRoot() |
03a0054954bb
"Bless me father for I have sinned."
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18839
diff
changeset
|
129 while node: |
03a0054954bb
"Bless me father for I have sinned."
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18839
diff
changeset
|
130 if purple.PurpleBlistNodeIsGroup(node): |
03a0054954bb
"Bless me father for I have sinned."
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18839
diff
changeset
|
131 sys.stderr.write(str(node) + "\n") |
03a0054954bb
"Bless me father for I have sinned."
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18839
diff
changeset
|
132 tree.add_row_after(str(node), ["asd", ""], None, None) |
03a0054954bb
"Bless me father for I have sinned."
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18839
diff
changeset
|
133 #tree.add_row_after(node, [str(purple.PurpleGroupGetName(node)), ""], None, None) |
03a0054954bb
"Bless me father for I have sinned."
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18839
diff
changeset
|
134 #tree.add_row_after(node, ["aasd", ""], None, None) |
03a0054954bb
"Bless me father for I have sinned."
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18839
diff
changeset
|
135 elif purple.PurpleBlistNodeIsContact(node): |
03a0054954bb
"Bless me father for I have sinned."
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18839
diff
changeset
|
136 buddy = purple.PurpleContactGetPriorityBuddy(node) |
03a0054954bb
"Bless me father for I have sinned."
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18839
diff
changeset
|
137 group = purple.PurpleBuddyGetGroup(buddy) |
03a0054954bb
"Bless me father for I have sinned."
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18839
diff
changeset
|
138 #tree.add_row_after(node, [str(purple.PurpleBuddyGetName(buddy)), ""], group, None) |
18556
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16143
diff
changeset
|
139 |
18841
03a0054954bb
"Bless me father for I have sinned."
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18839
diff
changeset
|
140 node = purple.PurpleBlistNodeNext(node, False) |
03a0054954bb
"Bless me father for I have sinned."
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18839
diff
changeset
|
141 win.show() |
18556
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16143
diff
changeset
|
142 |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16143
diff
changeset
|
143 gnt.gnt_init() |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16143
diff
changeset
|
144 |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16143
diff
changeset
|
145 # show_buddylist() |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16143
diff
changeset
|
146 |
15932
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
147 convs = purple.PurpleGetConversations() |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
148 for conv in convs: |
19419
6df41719037c
Utilize the message-history in dbus-gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18841
diff
changeset
|
149 show_conversation(conv, True) |
15932
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
150 |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
151 gnt.gnt_main() |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
152 |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
153 gnt.gnt_quit() |
8fd5ab3f9716
python bindings for libgnt. dbus-gnt is a gnt-ui (sort of) for gaim over dbus. It allows continuing with the currently opened conversations. pygnt/README.txt explains what to do. Use at your own risk.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
154 |