public void CreateSubscribersQueue(params Subscriber[] subscribers) { for (int i = 0; i < subscribers.Length; i++) { Subscribers.AddSubscriber(subscribers[i]); } }
public void OwnerModifySubscriptionState(Jid to, Jid from, string node, Jid subscriber, SubscriptionState state, IqCB cb, object cbArgs) { var pubsubIq = new owner.PubSubIq(IqType.set, to); if (from != null) { pubsubIq.From = from; } var subs = new Subscribers(node); subs.AddSubscriber(new Subscriber(subscriber, state)); pubsubIq.PubSub.Subscribers = subs; if (cb == null) { m_connection.Send(pubsubIq); } else { m_connection.IqGrabber.SendIq(pubsubIq, cb, cbArgs); } }
static void Bot_OnMessage(object sender, MessageEventArgs e) { if (e.Message.Text != null) { // Es handelt sich um eine Textnachricht Console.WriteLine($"Received a text message in chat " + $"{e.Message.Chat.Id}. The Message is {e.Message.Text}"); if (e.Message.Text.StartsWith("/")) { // Es wird ein Kommando erwartet switch (e.Message.Text) { case "/start": previousSubscriberOperation.Wait(); previousSubscriberOperation = Subscribers.AddSubscriber(e.Message.Chat.Id); break; case "/unsubscribe": previousSubscriberOperation.Wait(); previousSubscriberOperation = Subscribers.RemoveSubscriber(e.Message.Chat.Id); break; case "/whensdaymydude": botClient .SendTextMessageAsync( e.Message.Chat, WednesdayInvestigator .WhenIsWednesdayMyDude() .ToString()) .Wait(); break; } } else { botClient.SendTextMessageAsync( chatId: e.Message.Chat, text: "You said:\n" + e.Message.Text ).Wait(); } } }