User class becomes Contact class

This commit is contained in:
Nikos Kouremenos 2005-06-24 14:28:00 +00:00
parent 5a2a8892ac
commit 0342329e0f
5 changed files with 26 additions and 26 deletions

View File

@ -33,7 +33,7 @@ try:
except:
pass
from gajim import User
from gajim import Contact
from common import gajim
from common import connection
from common import i18n
@ -1620,7 +1620,7 @@ class ServiceRegistrationWindow:
if self.infos.has_key('registered'):
del self.infos['registered']
else:
user1 = User(self.service, self.service, ['Transports'], 'offline',
user1 = Contact(self.service, self.service, ['Transports'], 'offline',
'offline', 'from', '', '', 0, '')
self.plugin.roster.contacts[self.account][self.service] = [user1]
self.plugin.roster.add_user_to_roster(self.service, self.account)

View File

@ -25,7 +25,7 @@ import os
from vcard import VcardWindow
from gajim_themes_window import GajimThemesWindow
from advanced import AdvancedConfigurationWindow
from gajim import User
from gajim import Contact
from common import gajim
from common import helpers
from common import i18n
@ -186,7 +186,7 @@ class ChooseGPGKeyDialog:
self.keys_treeview.insert_column_with_attributes(-1, _('KeyID'),
renderer, text = 0)
renderer = gtk.CellRendererText()
self.keys_treeview.insert_column_with_attributes(-1, _('User name'),
self.keys_treeview.insert_column_with_attributes(-1, _('Contact name'),
renderer, text = 1)
self.fill_tree(secret_keys, selected)
@ -324,7 +324,7 @@ _('Please fill in the data of the contact you want to add in account %s') %accou
return
if jid.find('@') < 0:
ErrorDialog(_("Invalid user name"),
_('User names must be of the form "user@servername".')).get_response()
_('Contact names must be of the form "user@servername".')).get_response()
return
message_buffer = self.xml.get_widget('message_textview').get_buffer()
start_iter = message_buffer.get_start_iter()
@ -648,7 +648,7 @@ class NewMessageDialog:
title = _('New Message as ') + our_jid
else:
title = _('New Message')
prompt_text = _('Enter the user ID of the contact you would like\nto send a chat message to:')
prompt_text = _('Enter the contact ID of the contact you would like\nto send a chat message to:')
instance = InputDialog(title, prompt_text)
response = instance.get_response()
@ -656,11 +656,11 @@ class NewMessageDialog:
jid = instance.input_entry.get_text()
if jid.find('@') == -1: # if no @ was given
ErrorDialog(_('Invalid user ID'),
_('User ID must be of the form "username@servername".')).get_response()
ErrorDialog(_('Invalid contact ID'),
_('Contact ID must be of the form "username@servername".')).get_response()
return
# use User class, new_chat expects it that way
# use Contact class, new_chat expects it that way
# is it in the roster?
if self.plugin.roster.contacts[self.account].has_key(jid):
user = self.plugin.roster.contacts[self.account][jid][0]
@ -670,7 +670,7 @@ class NewMessageDialog:
'attached_gpg_keys').split()
if jid in attached_keys:
keyID = attached_keys[attached_keys.index(jid) + 1]
user = User(jid, jid, ['not in the roster'], 'not in the roster',
user = Contact(jid, jid, ['not in the roster'], 'not in the roster',
'not in the roster', 'none', None, '', 0, keyID)
self.plugin.roster.contacts[self.account][jid] = [user]
self.plugin.roster.add_user_to_roster(user.jid, self.account)
@ -788,7 +788,7 @@ class PopupNotificationWindow:
gtk.gdk.screen_height() - self.plugin.roster.popups_notification_height)
def on_popup_notification_window_button_press_event(self, widget, event):
# use User class, new_chat expects it that way
# use Contact class, new_chat expects it that way
# is it in the roster?
if self.plugin.roster.contacts[self.account].has_key(self.jid):
user = self.plugin.roster.contacts[self.account][self.jid][0]
@ -798,7 +798,7 @@ class PopupNotificationWindow:
'attached_gpg_keys').split()
if jid in attached_keys:
keyID = attached_keys[attached_keys.index(jid) + 1]
user = User(self.jid, self.jid, ['not in the roster'],
user = Contact(self.jid, self.jid, ['not in the roster'],
'not in the roster', 'not in the roster', 'none', None, '', 0,
keyID)
self.plugin.roster.contacts[self.account][self.jid] = [user]

View File

@ -89,7 +89,7 @@ try:
except ImportError:
pass
class User:
class Contact:
'''Information concerning each contact'''
def __init__(self, *args):
if len(args) == 0:
@ -241,7 +241,7 @@ class Interface:
if (resources != [''] and (len(luser) != 1 or
luser[0].show != 'offline')) and not jid.find('@') <= 0:
old_show = 0
user1 = User(user1.jid, user1.name, user1.groups, user1.show, \
user1 = Contact(user1.jid, user1.name, user1.groups, user1.show, \
user1.status, user1.sub, user1.ask, user1.resource, \
user1.priority, user1.keyID)
luser.append(user1)
@ -337,7 +337,7 @@ class Interface:
model = tv.get_model()
iter = gc.get_user_iter(jid, nick)
show = model.get_value(iter, 3)
u = User(fjid, nick, ['none'], show, '', 'none', None, '', 0,
u = Contact(fjid, nick, ['none'], show, '', 'none', None, '', 0,
'')
self.roster.new_chat(u, account)
chat_win = self.windows[account]['chats'][fjid]
@ -390,7 +390,7 @@ class Interface:
show = model.get_value(iter, 3)
else:
show = 'offline'
u = User(fjid, nick, ['none'], show, '', 'none', None, '', 0,
u = Contact(fjid, nick, ['none'], show, '', 'none', None, '', 0,
'')
self.roster.new_chat(u, account)
self.windows[account]['chats'][fjid].print_conversation(
@ -435,7 +435,7 @@ class Interface:
'attached_gpg_keys').split()
if jid in attached_keys:
keyID = attached_keys[attached_keys.index(jid) + 1]
user1 = User(jid, jid, ['General'], 'online', \
user1 = Contact(jid, jid, ['General'], 'online', \
'online', 'to', '', array[1], 0, keyID)
self.roster.contacts[account][jid] = [user1]
self.roster.add_user_to_roster(jid, account)

View File

@ -25,7 +25,7 @@ import time
import dialogs
import chat
import cell_renderer_image
from gajim import User
from gajim import Contact
from common import gajim
from common import helpers
from common import i18n
@ -668,7 +668,7 @@ class GroupchatWindow(chat.Chat):
if not self.plugin.windows[self.account]['chats'].has_key(fjid):
#show = model.get_value(iter, 3) #FIXME: be able to get show from nick
show = 'chat'
u = User(fjid, nick, ['none'], show, '', 'none', None, '', 0, '')
u = Contact(fjid, nick, ['none'], show, '', 'none', None, '', 0, '')
self.plugin.roster.new_chat(u, self.account)
if msg:
self.plugin.windows[self.account]['chats'][fjid].send_message(msg)
@ -985,7 +985,7 @@ class GroupchatWindow(chat.Chat):
fjid = room_jid + '/' + nick
if not self.plugin.windows[self.account]['chats'].has_key(fjid):
show = model.get_value(iter, 3)
u = User(fjid, nick, ['none'], show, '', 'none', None, '', 0,'')
u = Contact(fjid, nick, ['none'], show, '', 'none', None, '', 0,'')
self.plugin.roster.new_chat(u, self.account)
self.plugin.windows[self.account]['chats'][fjid].set_active_tab(fjid)
self.plugin.windows[self.account]['chats'][fjid].window.present()
@ -1030,7 +1030,7 @@ class GroupchatWindow(chat.Chat):
fjid = room_jid + '/' + nick
if not self.plugin.windows[self.account]['chats'].has_key(fjid):
show = model.get_value(iter, 3)
u = User(fjid, nick, ['none'], show, '', 'none', None, '', 0,
u = Contact(fjid, nick, ['none'], show, '', 'none', None, '', 0,
'')
self.plugin.roster.new_chat(u, self.account)
self.plugin.windows[self.account]['chats'][fjid].set_active_tab(fjid)

View File

@ -32,7 +32,7 @@ import dialogs
import config
import cell_renderer_image
from gajim import User
from gajim import Contact
from common import gajim
from common import helpers
from common import i18n
@ -432,7 +432,7 @@ class RosterWindow:
'attached_gpg_keys').split()
if jid in attached_keys:
keyID = attached_keys[attached_keys.index(jid) + 1]
user1 = User(ji, name, array[jid]['groups'], show, status,\
user1 = Contact(ji, name, array[jid]['groups'], show, status,\
array[jid]['subscription'], array[jid]['ask'], resource, 0,
keyID)
@ -949,7 +949,7 @@ class RosterWindow:
'attached_gpg_keys').split()
if jid in attached_keys:
keyID = attached_keys[attached_keys.index(jid) + 1]
user1 = User(jid, pseudo, [group], 'requested', 'requested',
user1 = Contact(jid, pseudo, [group], 'requested', 'requested',
'none', 'subscribe', '', 0, keyID)
self.contacts[account][jid] = [user1]
else:
@ -1063,7 +1063,7 @@ _('If "%s" accepts this request you will know his status.') %jid).get_response()
self.remove_user(u, account)
del self.contacts[account][u.jid]
if user.jid in self.plugin.windows[account]['chats']:
user1 = User(user.jid, user.name, ['not in the roster'],
user1 = Contact(user.jid, user.name, ['not in the roster'],
'not in the roster', 'not in the roster', 'none', None, '', 0,
user.keyID)
self.contacts[account][user.jid] = [user1]
@ -1263,7 +1263,7 @@ _('If "%s" accepts this request you will know his status.') %jid).get_response()
'attached_gpg_keys').split()
if jid in attached_keys:
keyID = attached_keys[attached_keys.index(jid) + 1]
user1 = User(jid, jid, ['not in the roster'], 'not in the roster',
user1 = Contact(jid, jid, ['not in the roster'], 'not in the roster',
'not in the roster', 'none', None, '', 0, keyID)
self.contacts[account][jid] = [user1]
self.add_user_to_roster(jid, account)