本文整理汇总了C#中Smuxi.Engine.PersonModel类的典型用法代码示例。如果您正苦于以下问题:C# PersonModel类的具体用法?C# PersonModel怎么用?C# PersonModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PersonModel类属于Smuxi.Engine命名空间,在下文中一共展示了PersonModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CtcpMenu
public CtcpMenu(IrcProtocolManager protocolManager,
ChatViewManager chatViewManager,
PersonModel target)
: this(protocolManager,
chatViewManager,
new [] { target })
{
}
示例2: InviteToMenu
public InviteToMenu(IrcProtocolManager protocolManager,
ChatViewManager chatViewManager,
PersonModel invitee)
: this(protocolManager,
chatViewManager,
new [] { invitee })
{
}
示例3: PersonHookEnvironment
public PersonHookEnvironment(string prefix, PersonModel person)
{
if (person == null) {
throw new ArgumentNullException("person");
}
this[prefix + "PERSON_ID"] = person.ID;
this[prefix + "PERSON_IDENTITY_NAME"] = person.IdentityName;
this[prefix + "PERSON_NETWORK_ID"] = person.NetworkID;
this[prefix + "PERSON_NETWORK_PROTOCOL"] = person.NetworkProtocol;
}
示例4: Sync
public override void Sync()
{
Trace.Call();
PersonModel = PersonChatModel.Person;
base.Sync();
}
示例5: OnPresence
void OnPresence(object sender, Presence pres)
{
JID jid = pres.From;
var groupChat = (XmppGroupChatModel) Session.GetChat(jid.Bare, ChatType.Group, this);
MessageBuilder builder = CreateMessageBuilder();
builder.AppendEventPrefix();
PersonModel person = null;
if (groupChat != null) {
string displayName = jid.Resource ?? jid.Bare;
person = new PersonModel("", displayName, "", "", this);
} else {
person = CreatePerson(jid.Bare);
}
builder.AppendIdendityName(person);
if (jid != person.IdentityName) {
builder.AppendText(" [{0}]", jid);
}
switch (pres.Type) {
case PresenceType.available:
// groupchat is already managed
if (groupChat == null) {
if (ContactChat != null) {
// anyone who is online/away/dnd will be added to the list
lock (ContactChat) {
PersonModel p = ContactChat.GetPerson(jid.Bare);
if (p != null) {
// p already exists, don't add a new person
Session.UpdatePersonInGroupChat(ContactChat, p, person);
} else {
Session.AddPersonToGroupChat(ContactChat, person);
}
}
}
}
if (pres.Show == null) {
builder.AppendText(_(" is now available"));
} else if (pres.Show == "away") {
builder.AppendText(_(" is now away"));
} else if (pres.Show == "dnd") {
builder.AppendText(_(" wishes not to be disturbed"));
} else {
builder.AppendText(_(" set status to {0}"), pres.Show);
}
if (pres.Status == null) break;
if (pres.Status.Length == 0) break;
builder.AppendText(": {0}", pres.Status);
break;
case PresenceType.unavailable:
builder.AppendText(_(" is now offline"));
if(groupChat == null) {
if (ContactChat != null) {
lock (ContactChat) {
PersonModel p = ContactChat.GetPerson(jid.Bare);
if (p == null) {
// doesn't exist, got an offline message w/o a preceding online message?
return;
}
Session.RemovePersonFromGroupChat(ContactChat, p);
}
}
}
break;
case PresenceType.subscribe:
builder.AppendText(_(" wishes to subscribe to you"));
break;
case PresenceType.subscribed:
builder.AppendText(_(" allows you to subscribe"));
break;
}
if (groupChat != null) {
Session.AddMessageToChat(groupChat, builder.ToMessage());
} else if (ContactChat != null) {
Session.AddMessageToChat(ContactChat, builder.ToMessage());
}
var personChat = Session.GetChat(jid.Bare, ChatType.Person, this);
if (personChat != null) {
Session.AddMessageToChat(personChat, builder.ToMessage());
}
}
示例6: PersonChatModel
public PersonChatModel(PersonModel person, string id, string name, IProtocolManager networkManager)
: base(id, name, ChatType.Person, networkManager)
{
_Person = person;
}
示例7: RemovePersonFromGroupChat
public void RemovePersonFromGroupChat(GroupChatModel cpage, PersonModel user)
{
Trace.Call(cpage, user);
}
示例8: TextMessageReceived
private void TextMessageReceived(object sender, TextMessageEventArgs e)
{
Trace.Call(sender, e);
string user = e.Sender.Name;
string status = e.Sender.Status.ToString();
string message = e.Message.Text;
ChatModel chat = Session.GetChat(user, ChatType.Person, this);
if (chat == null) {
PersonModel person = new PersonModel(user, user, NetworkID, Protocol, this);
Session.AddChat(chat);
}
MessageModel msg = new MessageModel();
TextMessagePartModel msgPart;
msgPart = new TextMessagePartModel();
msgPart.Text = String.Format("{0} (Status: {1}) says:\n{2}", user, status, message);
msg.MessageParts.Add(msgPart);
Session.AddMessageToChat(chat, msg);
}
示例9: FormatUpload
void FormatUpload(MessageBuilder bld, PersonModel person, ChatModel chat, Message message)
{
// Figure out what the user uploaded, we need to issue another call for this
var upload = Client.Get<UploadWrapper>(String.Format("/room/{0}/messages/{1}/upload.json", chat.ID, message.Id)).Upload;
bld.AppendEventPrefix();
bld.AppendIdendityName(person).AppendSpace();
bld.AppendText(_("has uploaded '{0}' ({1} B) {2}"), upload.Name, upload.Byte_Size, upload.Full_Url);
}
示例10: AddPerson
public void AddPerson(PersonModel person)
{
Trace.Call(person);
if (_PersonListStore == null) {
// no liststore, nothing todo
return;
}
_PersonListStore.AppendValues(person);
Participants.Add(person);
OnParticipantsChanged(EventArgs.Empty);
}
示例11: AddPersonToGroupChat
public void AddPersonToGroupChat(GroupChatModel cpage, PersonModel user)
{
Trace.Call(cpage, user);
}
示例12: RemovePersonFromGroupChat
public void RemovePersonFromGroupChat(GroupChatModel groupChat, PersonModel person)
{
TraceRemotingCall(groupChat, person);
MethodBase mb = Trace.GetMethodBase();
_Dispatcher.Invoke(DispatcherPriority.Normal,new MethodInvoker(delegate {
TraceRemotingCall(mb, groupChat, person);
GroupChatView groupChatView = (GroupChatView) _ChatViewManager.GetChat(groupChat);
groupChatView.RemovePerson(person);
}));
}
示例13: UpdatePersonInGroupChat
public void UpdatePersonInGroupChat(GroupChatModel groupChat, PersonModel oldPerson, PersonModel newPerson)
{
TraceRemotingCall(groupChat, oldPerson, newPerson);
MethodBase mb = Trace.GetMethodBase();
_Dispatcher.Invoke(DispatcherPriority.Normal,new MethodInvoker(delegate {
TraceRemotingCall(mb, groupChat, oldPerson, newPerson);
GroupChatView groupChatView = (GroupChatView) _ChatViewManager.GetChat(groupChat);
groupChatView.UpdatePerson(oldPerson, newPerson);
}));
}
示例14: UpdatePersonInGroupChat
public void UpdatePersonInGroupChat(GroupChatModel groupChat, PersonModel oldPerson, PersonModel newPerson)
{
TraceRemotingCall(groupChat, oldPerson, newPerson);
MethodBase mb = Trace.GetMethodBase();
Gtk.Application.Invoke(delegate {
TraceRemotingCall(mb, groupChat, oldPerson, newPerson);
try {
GroupChatView groupChatView = (GroupChatView) _ChatViewManager.GetChat(groupChat);
if (groupChatView == null) {
#if LOG4NET
_Logger.Fatal(
String.Format(
"UpdatePersonInGroupChat(): " +
"_ChatViewManager.GetChat(groupChat) " +
"groupChat.Name: {0} returned null!",
groupChat.Name
)
);
#endif
return;
}
groupChatView.UpdatePerson(oldPerson, newPerson);
} catch (Exception ex) {
Frontend.ShowException(ex);
}
});
}
示例15: RemovePerson
public void RemovePerson(PersonModel person)
{
Trace.Call(person);
if (_PersonListStore == null) {
// no liststore, nothing todo
return;
}
Gtk.TreeIter iter;
bool res = _PersonListStore.GetIterFirst(out iter);
if (!res) {
#if LOG4NET
_Logger.Error("RemovePerson(): GetIterFirst() returned false!");
#endif
return;
}
do {
PersonModel currentPerson = (PersonModel) _PersonListStore.GetValue(iter, 0);
if (currentPerson.ID == person.ID) {
_PersonListStore.Remove(ref iter);
break;
}
} while (_PersonListStore.IterNext(ref iter));
UpdatePersonCount();
}