invisible support

This commit is contained in:
Yann Leboulanger 2004-05-31 18:12:57 +00:00
parent 8ef36f0abf
commit cad99f6efc
4 changed files with 155 additions and 13 deletions

View File

@ -233,15 +233,7 @@ class GajimCore:
if not roster :
roster = {}
self.hub.sendPlugin('ROSTER', account, roster)
con.sendInitPresence()
self.hub.sendPlugin('STATUS', account, 'online')
self.connected[account] = 1
iq = common.jabber.Iq(type="get")
iq._setTag('vCard', common.jabber.NS_VCARD)
id = con.getAnID()
iq.setID(id)
con.send(iq)
self.myVCardID.append(id)
return con
else:
log.debug("Couldn't authentificate to %s" % hostname)
@ -309,14 +301,31 @@ class GajimCore:
elif ev[0] == 'STATUS':
if (ev[2][0] != 'offline') and (self.connected[ev[1]] == 0):
con = self.connect(ev[1])
#send our presence
p = common.jabber.Presence()
p.setShow(ev[2][0])
p.setStatus(ev[2][1])
if ev[2][0] == 'invisible':
p.setType('invisible')
con.send(p)
self.hub.sendPlugin('STATUS', ev[1], ev[2][0])
#ask our VCard
iq = common.jabber.Iq(type="get")
iq._setTag('vCard', common.jabber.NS_VCARD)
id = con.getAnID()
iq.setID(id)
con.send(iq)
self.myVCardID.append(id)
elif (ev[2][0] == 'offline') and (self.connected[ev[1]] == 1):
self.connected[ev[1]] = 0
con.disconnect()
self.hub.sendPlugin('STATUS', ev[1], 'offline')
if ev[2][0] != 'offline' and self.connected[ev[1]] == 1:
elif ev[2][0] != 'offline' and self.connected[ev[1]] == 1:
p = common.jabber.Presence()
p.setShow(ev[2][0])
p.setStatus(ev[2][1])
if ev[2][0] == 'invisible':
p.setType('invisible')
con.send(p)
self.hub.sendPlugin('STATUS', ev[1], ev[2][0])
#('MSG', account, (jid, msg))

View File

@ -706,6 +706,9 @@ class roster_Window:
item = gtk.MenuItem(_("DND"))
menu_sub.append(item)
item.connect("activate", self.change_status, account, 'dnd')
item = gtk.MenuItem(_("Invisible"))
menu_sub.append(item)
item.connect("activate", self.change_status, account, 'invisible')
item = gtk.MenuItem()
menu_sub.append(item)
item = gtk.MenuItem(_("Offline"))
@ -1008,8 +1011,9 @@ class roster_Window:
iconstyle = 'sun'
self.path = 'plugins/gtkgui/icons/' + iconstyle + '/'
self.pixbufs = {}
for state in ('online', 'chat', 'away', 'xa', 'dnd', 'offline', 'error', \
'requested', 'message', 'opened', 'closed', 'not in list'):
for state in ('online', 'chat', 'away', 'xa', 'dnd', 'invisible', \
'offline', 'error', 'requested', 'message', 'opened', 'closed', \
'not in list'):
# try to open a pixfile with the correct method
files = []
files.append(self.path + state + '.gif')
@ -1025,12 +1029,11 @@ class roster_Window:
pix = fct(file)
self.pixbufs[state] = pix
break
for state in ('online', 'away', 'xa', 'dnd', 'offline'):
for state in ('online', 'away', 'xa', 'dnd', 'invisible', 'offline'):
image = gtk.Image()
image.set_from_pixbuf(self.pixbufs[state])
image.show()
self.xml.get_widget(state).set_image(image)
self.xml.get_widget('invisible').set_sensitive(False)
def on_show_off(self, widget):
"""when show offline option is changed :

View File

@ -0,0 +1,62 @@
/* XPM */
static char * error_xpm[] = {
"16 16 43 1",
" c None",
". c #FFEC00",
"+ c #FFE400",
"@ c #F3CD00",
"# c #E5C50F",
"$ c #E0C214",
"% c #DEC016",
"& c #FFEA00",
"* c #FFE800",
"= c #FFDA00",
"- c #FFDE00",
"; c #FFD900",
"> c #FBD505",
", c #D6BA21",
"' c #D8BB1E",
") c #FDD602",
"! c #EAC709",
"~ c #DABC1D",
"{ c #D0B628",
"] c #DDBE1A",
"^ c #D4B824",
"/ c #DEBE18",
"( c #E0C114",
"_ c #000000",
": c #FFAFAF",
"< c #848484",
"[ c #FF0000",
"} c #939393",
"| c #888888",
"1 c #8D8D8D",
"2 c #A0A0A0",
"3 c #9C9C9C",
"4 c #A1A1A1",
"5 c #A2A2A2",
"6 c #B3B3B3",
"7 c #ABABAB",
"8 c #949494",
"9 c #B2B2B2",
"0 c #B4B4B4",
"a c #8A8A8A",
"b c #A3A3A3",
"c c #A4A4A4",
"d c #AEAEAE",
"..+@#$% ",
"&*=@ ",
"-;>,' ",
")!~ {' ",
"] ^ ",
"/ , ",
"( _ ",
" _ ",
" _ ",
" : _ : < <",
":[:}:[: < <",
" :[:[: | < <",
" :[:}____< 123",
" :[:[: <4567",
":[: :[: 8990",
" : : <<abcd9"};

View File

@ -0,0 +1,68 @@
/* XPM */
static char * invisible_xpm[] = {
"16 16 49 1",
" c None",
". c #FFF29C",
"+ c #FFEF9C",
"@ c #FFF19C",
"# c #FFF49C",
"$ c #FFEE9C",
"% c #636464",
"& c #6F6F6F",
"* c #7A7A7A",
"= c #FFF39C",
"- c #FFEC9D",
"; c #434342",
"> c #4D4E4E",
", c #585959",
"' c #6E6F6F",
") c #858585",
"! c #373837",
"~ c #424242",
"{ c #4D4D4E",
"] c #595959",
"^ c #636364",
"/ c #FFEA9D",
"( c #212121",
"_ c #2C2D2C",
": c #373738",
"< c #424243",
"[ c #585958",
"} c #646464",
"| c #FFE89E",
"1 c #FFE99D",
"2 c #161616",
"3 c #212221",
"4 c #2C2C2D",
"5 c #4E4E4D",
"6 c #636463",
"7 c #FFE99E",
"8 c #0B0C0B",
"9 c #2C2C2C",
"0 c #373838",
"a c #FFF09C",
"b c #0B0B0B",
"c c #161617",
"d c #2C2D2D",
"e c #434343",
"f c #FFE79E",
"g c #000000",
"h c #383738",
"i c #212122",
"j c #FFEB9D",
" ",
" . ",
" + @.. # ",
" $+%&*.= ",
" --;>,%'*)=# ",
" -!~{]^&*. ",
" /(_:<>[}&*. ",
" |1234:;5]6&@. ",
" 782(90<>]%a ",
" |bc3d:e>$ ",
" ffgbc34he$$ ",
" f|b2ij- ",
" f |71 j ",
" | ",
" ",
" "};