/// <summary> /// Send a message to all subscribers. /// </summary> /// <param name="text">The text.</param> void Message(string text) { foreach (string user in SubscriptionCollection.Instance) { _Bot.Message(user, text); } }
static void j_OnAuthenticate(object sender) { // Sender is always the JabberClient. JabberClient j = (JabberClient)sender; j.Message(TARGET, "test"); }
private async void btnSend_Click(object sender, EventArgs e) { if (client == null) { return; } //var s = new[] { "5", "530", "510", "100", "35", "25", "15", "25", "40", "5320", //"320","22","110","155","60","mingguan","bulanan","mingguan","bulanan"}; var s = new[] { "10" }; for (var i = numericUpDown1.Value; i <= 1000000; i++) { try { client.Message("*****@*****.**", $"#test{i}.{s[_rnd.Next(0, s.Length - 1)]}.785612127"); rtf.AppendText($"Mengirim : #test{i}.{s[_rnd.Next(0,s.Length-1)]}.785612127\n"); } catch (Exception ex) { Debug.WriteLine(ex.ToString()); } await Task.Delay(2000); } }
private static void Jnet() { using (var j = new JabberClient()) { // what user/pass to log in as j.User = username; j.Server = hostname; // use gmail.com for GoogleTalk j.Password = password; j.AutoStartTLS = true; j.RequiresSASL = true; j.SSL = true; // don't do extra stuff, please. j.AutoPresence = false; j.AutoRoster = false; j.AutoReconnect = -1; // listen for errors. Always do this! j.OnError += j_OnError; // what to do when login completes j.OnAuthenticate += j_OnAuthenticate; // listen for XMPP wire protocol if (VERBOSE) { j.OnReadText += j_OnReadText; j.OnWriteText += j_OnWriteText; j.OnMessage += j_OnMessage; j.OnProtocol += J_OnProtocol; } j.Resource = "myComp"; j.UseAnonymous = false; // Set everything in motion j.Connect(); while (true) { System.Console.Write("> "); string s = System.Console.ReadLine(); if (!string.Equals("quit", s)) { /*Match m = Regex.Match(s, @"^send\s(?<jid>[^\s]+)\s(?<message>.+)$"); * if (!m.Success) * continue; * string recipient = m.Groups["jid"].Value, message = m.Groups["message"].Value; * // Send the chat-message.*/ j.Message(TARGET, s); } if (s == "quit") { return; } } } }
public void SendMessage(string to, string message) { if (_jc == null || !_connected) { return; } _jc.Message(to, message); }
public void SendNotification(IEnumerable <string> sendto, string text) { //Message msg = new Message(jabberClient.Document); foreach (string recipient in sendto) { jabberClient.Message(recipient, text); //msg.To = recipient; //msg.Subject = txtSubject.Text; //msg.Body = text; //jabberClient.Write(msg); } }
private void _Say(ChatModel chat, string text, bool send) { if (!chat.IsEnabled) { return; } if (send) { string target = chat.ID; if (chat.ChatType == ChatType.Person) { _JabberClient.Message(target, text); } else if (chat.ChatType == ChatType.Group) { var room = _ConferenceManager.GetRoom( String.Format( "{0}/{1}", target, _JabberClient.User ) ); room.PublicMessage(text); return; // don't show now. the message will be echoed back if it's sent successfully } } MessageModel msg = new MessageModel(); TextMessagePartModel msgPart; msgPart = new TextMessagePartModel(); msgPart.Text = "<"; msg.MessageParts.Add(msgPart); msgPart = new TextMessagePartModel(); msgPart.Text = _JabberClient.User; //msgPart.ForegroundColor = IrcTextColor.Blue; msgPart.ForegroundColor = new TextColor(0x0000FF); msg.MessageParts.Add(msgPart); msgPart = new TextMessagePartModel(); msgPart.Text = "> "; msg.MessageParts.Add(msgPart); msgPart = new TextMessagePartModel(); msgPart.Text = text; msg.MessageParts.Add(msgPart); this.Session.AddMessageToChat(chat, msg); }
internal static void SendMessage(string User, string Message) { ChatClient.Message(User, Message); }
public void Message(string to, string body) { log.Info(string.Format("Message to {0}: {1}", to, body)); _jc.Message(to, body); }
public void SendMessage(string text, User u) { c.Message(u.item.JID, text); }
public void SendMessage(MessageType messageType, string replyTo, string message) { _jabberClient.Message(messageType, replyTo, message); }