private void Xmpp_OnRosterItem(object sender, RosterItem item) { var user = item.Jid.User; var friend = new Friend(item); friends.Add(user, friend); }
void connection_OnRosterItem(object sender, agsXMPP.protocol.iq.roster.RosterItem item) { if (OnRosterItemReceived != null) { OnRosterItemReceived(item); } }
void xmppCon_OnRosterItem(object sender, agsXMPP.protocol.iq.roster.RosterItem item) { string[] jIDRaw = item.Jid.Bare.ToString().Split('/'); string jID = jIDRaw[0]; OSAEObjectCollection objects = OSAEObjectManager.GetObjectsByPropertyValue("JabberID", jID); if (objects == null) { bool dupName = OSAEObjectManager.ObjectExists(item.Name); if (dupName) { Log.Info(String.Format("Found Object {0} for {1}", item.Name, jID)); } else { Log.Info(String.Format("Creating new Object {0} for {1}", item.Name, jID)); OSAEObjectManager.ObjectAdd(item.Name, "", "Discovered Jabber contact", "PERSON", "", "Unknown", 10, false); } Log.Info(String.Format("Updating JabberID for {0}", item.Name)); OSAEObjectPropertyManager.ObjectPropertySet(item.Name, "JabberID", jID, gAppName); } else { Log.Info(String.Format("Found Object {0} for {1}", item.Name, jID)); } }
void objXmpp_FriendList(agsXMPP.protocol.iq.roster.RosterItem item)//好友列表事件【2】 { del_AddRecord AddRecord_del = new del_AddRecord(AddRecord); this.Invoke(AddRecord_del, new string[] { "unavailable", item.Jid, "" }); Thread.Sleep(50); //AddRecord("unavailable", item.Jid, ""); }
private void xmppCon_OnRosterItem(object sender, agsXMPP.protocol.iq.roster.RosterItem item) { Chat chat = new Chat(connection, item.Jid.User, item.Jid.Server, item.Jid.Resource, null); chatManagerListenerList.ForEach(cml => cml.ChatCreated(chat, false)); chatList.Add(chat); }
private void onlineadd1(object sender, agsXMPP.protocol.iq.roster.RosterItem item) { if (item.Subscription == agsXMPP.protocol.iq.roster.SubscriptionType.both) { Presence p = new Presence(ShowType.chat, "online"); agsXMPP.protocol.client.Presence p1 = new Presence(); return; } }
void xmppCon_OnRosterItem(object sender, agsXMPP.protocol.iq.roster.RosterItem item) { if (InvokeRequired) { // Windows Forms are not Thread Safe, we need to invoke this :( // We're not in the UI thread, so we need to call BeginInvoke BeginInvoke(new XmppClientConnection.RosterHandler(xmppCon_OnRosterItem), new object[] { sender, item }); return; } listEvents.Items.Add(String.Format("Received Contact {0}", item.Jid.Bare)); listEvents.SelectedIndex = listEvents.Items.Count - 1; }
private void HandlerOnRosterItem(object o, agsXMPP.protocol.iq.roster.RosterItem item) { BeginInvoke(new MethodInvoker(delegate { string itemJid = item.Jid.Bare; if (item.Subscription != agsXMPP.protocol.iq.roster.SubscriptionType.remove) { string nodeText = item.Name != null ? item.Name : itemJid; listUsers.Items.Add(createListViewItem(itemJid, nodeText, Color.Red)); } else { listUsers.Items.Remove(getListViewItem(itemJid)); } })); }
/// <summary> /// Происходит при получении одного элемента списка контактов /// </summary> /// <param name="o"></param> /// <param name="item"></param> private void HandlerOnRosterItem(object o, agsXMPP.protocol.iq.roster.RosterItem item) { BeginInvoke(new MethodInvoker(delegate { string itemJid = item.Jid.Bare; if (item.Subscription != agsXMPP.protocol.iq.roster.SubscriptionType.remove) { //если этот элемент списка не пришел с меткой на удаление, то добавляем его string nodeText = item.Name != null ? item.Name : itemJid; listUsers.Items.Add(createListViewItem(itemJid, nodeText, Color.Red)); } else { //иначе удаляем listUsers.Items.Remove(getListViewItem(itemJid)); } })); }
void xmppCon_OnRosterItem(object sender, agsXMPP.protocol.iq.roster.RosterItem item) { bool found = false; osae.AddToLog(String.Format("Received Contact {0}", item.Jid.Bare), true); List <OSAEObject> objects = osae.GetObjectsByType("PERSON"); foreach (OSAEObject oObj in objects) { OSAEObject obj = osae.GetObjectByName(oObj.Name); if (osae.GetObjectPropertyValue(obj.Name, "JabberID").Value == item.Jid.Bare) { found = true; break; } } if (!found) { osae.ObjectAdd(item.Jid.Bare, item.Jid.Bare, "PERSON", "", "", true); osae.ObjectPropertySet(item.Jid.Bare, "JabberID", item.Jid.Bare); } }
public void removeContact(Jid contactJid) { // 2.5.1. Delete Roster Item var iq = new agsXMPP.protocol.iq.roster.RosterIq(IqType.set); var item = new agsXMPP.protocol.iq.roster.RosterItem(contactJid); item.Subscription = agsXMPP.protocol.iq.roster.SubscriptionType.remove; iq.Query.AddRosterItem(item); iq.GenerateId(); conn.Send(iq); var pres1 = new Presence(); pres1.Type = PresenceType.unsubscribe; pres1.To = contactJid; pres1.GenerateId(); conn.Send(pres1); var pres2 = new Presence(); pres2.Type = PresenceType.unsubscribed; pres2.To = contactJid; conn.Send(pres2); }
void xmppCon_OnRosterItem(object sender, agsXMPP.protocol.iq.roster.RosterItem item) { bool found = false; Log.Info(String.Format("Received Contact {0}", item.Jid.Bare)); OSAEObjectCollection objects = OSAEObjectManager.GetObjectsByType("PERSON"); foreach (OSAEObject oObj in objects) { OSAEObject obj = OSAEObjectManager.GetObjectByName(oObj.Name); if (OSAEObjectPropertyManager.GetObjectPropertyValue(obj.Name, "JabberID").Value == item.Jid.Bare) { found = true; break; } } if (!found) { OSAEObjectManager.ObjectAdd(item.Jid.Bare, item.Jid.Bare, "Discovered Jabber contact", "PERSON", "", "Unknown", true); OSAEObjectPropertyManager.ObjectPropertySet(item.Jid.Bare, "JabberID", item.Jid.Bare, "Jabber"); } }
public RosterNode AddRosterItem(agsXMPP.protocol.iq.roster.RosterItem ritem) { string nodeText = ritem.Name != null ? ritem.Name : ritem.Jid.ToString(); RosterNode node; if (!m_Roster.ContainsKey(ritem.Jid.ToString())) { node = new RosterNode(); node.Text = nodeText; node.RosterItem = ritem; node.NodeType = RosterNodeType.RosterNode; node.ImageIndex = IMAGE_OFFLINE; node.SelectedImageIndex = IMAGE_OFFLINE; string groupname; if (ritem.GetGroups().Count > 0) { Group g = (Group)ritem.GetGroups().Item(0); groupname = g.Name; } else { groupname = m_DefaultGroupName; } RosterNode group = GetGroup(m_RootOffline, groupname); if (group == null) { group = AddGroup(groupname, m_RootOffline); } group.Nodes.Add(node); //group.Text = group.Name + " (" + group.Nodes.Count.ToString() + ")"; m_Roster.Add(ritem.Jid.ToString(), new RosterData(node)); return(node); } else { if (m_Roster[ritem.Jid.ToString()].Online) { // We upate a rosterItem which is online and has Presences // So store this Presences before we remove this item and add them to the // new Node again Presence[] pres = new Presence[m_Roster[ritem.Jid.ToString()].Presences.Count]; int i = 0; Dictionary <string, PresenceData> .Enumerator myEnum = m_Roster[ritem.Jid.ToString()].Presences.GetEnumerator(); while (myEnum.MoveNext()) { pres[i] = myEnum.Current.Value.Presence; i++; } RemoveRosterItem(ritem); node = AddRosterItem(ritem); foreach (Presence p in pres) { SetPresence(p); } return(node); } else { RemoveRosterItem(ritem); return(AddRosterItem(ritem)); } } }
//好友列表处理 void objXmpp_OnRosterItem(object sender, agsXMPP.protocol.iq.roster.RosterItem item) { G_Status("", String.Format("【加载好友】: {0}", item.Jid)); }
void objXmpp_OnRosterItem(object sender, agsXMPP.protocol.iq.roster.RosterItem item) { FriendList(item); }
/// <summary> /// Remove a Rosteritem from the Roster /// </summary> /// <param name="ritem">The item to remove</param> /// <returns /// >returns true if the item was removed, false if it didn't exist /// and could not be removed /// </returns> public bool RemoveRosterItem(agsXMPP.protocol.iq.roster.RosterItem ritem) { return(RemoveRosterItem(ritem.Jid)); }
static void xmppCon_OnRosterItem(object sender, agsXMPP.protocol.iq.roster.RosterItem item) { PrintInfo(String.Format("Got contact: {0}", item.Jid)); }
void xmppCon_OnRosterItem(object sender, agsXMPP.protocol.iq.roster.RosterItem item) { }
//加载好友列表 void objXmpp_OnRosterItem(object sender, agsXMPP.protocol.iq.roster.RosterItem item) { alServerList.Add(item.Jid); }