Mercurial > pidgin
annotate src/gaim-notifications-example.py @ 13545:cfc2f7fcb3dd
[gaim-migrate @ 15922]
Way more changes that I initially thought I was going to make. I apologize
for the commit message spam. These changes bring a lot of consistency to
our capitalization and punctuation, especially of words like "e-mail".
For reference, I've used these rules (after discussing in #gaim):
e-mail, a case of two words joined:
"e-mail" - in the middle of a sentence caps context
"E-mail" - start of text in a sentence caps context
"E-Mail" - in a header (title) caps context
re-enable, a single word, would be:
"re-enable", "Re-enable", and "Re-enable" (respectively)
The reason this changeset exploded is that, as I went through and verified
these changes, I realized we were using improper capitalization (e.g. header
instead of sentence) in a number of dialogs. I fixed a number of these
cases before, and this corrects another pile.
This looks like I've made a LOT of work for the translators, but the impact
is significantly mitigated by three factors: 1) Many of these changes use
strings that already exist, or change one string in many places. 2) I've
used sed to correct the .po files where possible. 3) The actual changes
are extremely trivial.
committer: Tailor Script <tailor@pidgin.im>
| author | Richard Laager <rlaager@wiktel.com> |
|---|---|
| date | Tue, 21 Mar 2006 04:32:45 +0000 |
| parents | d323a4e74753 |
| children |
| rev | line source |
|---|---|
| 11331 | 1 #!/usr/bin/env python |
| 2 | |
| 3 # This is a simple gaim notification server. | |
| 4 # It shows notifications when your buddy signs on or you get an IM message. | |
| 5 # | |
| 6 # This script requires Python 2.4 and PyGTK bindings | |
| 7 # | |
| 8 # Note that all function names are resolved dynamically, no | |
| 9 # gaim-specific library is needed. | |
| 10 | |
| 11 import dbus | |
| 12 import dbus.glib | |
| 13 import dbus.decorators | |
| 14 import gobject | |
| 15 import os | |
| 16 | |
| 17 def ensureimconversation(conversation, account, name): | |
| 18 if conversation != 0: | |
| 19 return conversation | |
| 20 else: | |
| 21 # 1 = GAIM_CONV_IM | |
| 22 return gaim.GaimConversationNew(1, account, name) | |
| 23 | |
| 24 def receivedimmsg(account, name, message, conversation, flags): | |
| 25 buddy = gaim.GaimFindBuddy(account, name) | |
| 26 if buddy != 0: | |
| 27 alias = gaim.GaimBuddyGetAlias(buddy) | |
| 28 else: | |
| 29 alias = name | |
| 30 | |
| 31 text = "%s says %s" % (alias, message) | |
| 32 code = os.spawnlp(os.P_WAIT, "xmessage", "xmessage", "-buttons", | |
| 33 "'So what?','Show me',Close,Abuse", text) | |
| 34 | |
| 35 if code == 101: # so what? | |
| 36 pass | |
| 37 else: | |
| 38 conversation = ensureimconversation(conversation, account, name) | |
| 39 | |
| 40 if code == 102: # show me | |
| 41 window = gaim.GaimConversationGetWindow(conversation) | |
| 42 gaim.GaimConvWindowRaise(window) | |
| 43 | |
| 44 if code == 103: # close | |
| 45 gaim.GaimConversationDestroy(conversation) | |
| 46 | |
| 47 if code == 104: # abuse | |
| 48 im = gaim.GaimConversationGetImData(conversation) | |
| 49 gaim.GaimConvImSend(im, "Go away you f...") | |
| 50 | |
| 51 | |
| 52 def buddysignedon(buddyid): | |
| 53 alias = gaim.GaimBuddyGetAlias(buddyid) | |
| 54 text = "%s is online" % alias | |
| 55 | |
| 56 code = os.spawnlp(os.P_WAIT, "xmessage", "xmessage", "-buttons", | |
| 57 "'So what?','Let's talk'", text) | |
| 58 | |
| 59 if code == 101: # so what? | |
| 60 pass | |
| 61 | |
|
13265
d323a4e74753
[gaim-migrate @ 15631]
Richard Laager <rlaager@wiktel.com>
parents:
13220
diff
changeset
|
62 if code == 102: # talk |
| 11331 | 63 name = gaim.GaimBuddyGetName(buddyid) |
| 64 account = gaim.GaimBuddyGetAccount(buddyid) | |
| 65 gaim.GaimConversationNew(1, account, name) | |
| 66 | |
| 67 | |
| 68 bus = dbus.SessionBus() | |
|
13220
ac5bc9a7b603
[gaim-migrate @ 15584]
Richard Laager <rlaager@wiktel.com>
parents:
11331
diff
changeset
|
69 obj = bus.get_object("net.sf.gaim.GaimService", "/net/sf/gaim/GaimObject") |
|
ac5bc9a7b603
[gaim-migrate @ 15584]
Richard Laager <rlaager@wiktel.com>
parents:
11331
diff
changeset
|
70 gaim = dbus.Interface(obj, "net.sf.gaim.GaimInterface") |
| 11331 | 71 |
| 72 bus.add_signal_receiver(receivedimmsg, | |
|
13220
ac5bc9a7b603
[gaim-migrate @ 15584]
Richard Laager <rlaager@wiktel.com>
parents:
11331
diff
changeset
|
73 dbus_interface = "net.sf.gaim.GaimInterface", |
| 11331 | 74 signal_name = "ReceivedImMsg") |
| 75 | |
| 76 bus.add_signal_receiver(buddysignedon, | |
|
13220
ac5bc9a7b603
[gaim-migrate @ 15584]
Richard Laager <rlaager@wiktel.com>
parents:
11331
diff
changeset
|
77 dbus_interface = "net.sf.gaim.GaimInterface", |
| 11331 | 78 signal_name = "BuddySignedOn") |
| 79 | |
|
13265
d323a4e74753
[gaim-migrate @ 15631]
Richard Laager <rlaager@wiktel.com>
parents:
13220
diff
changeset
|
80 print "This is a simple gaim notification server." |
|
d323a4e74753
[gaim-migrate @ 15631]
Richard Laager <rlaager@wiktel.com>
parents:
13220
diff
changeset
|
81 print "It shows notifications when your buddy signs on or you get an IM message." |
| 11331 | 82 |
| 83 loop = gobject.MainLoop() | |
| 84 loop.run() | |
| 85 | |
| 86 |
