public OrderFoodFormClient(User a) { InitializeComponent(); this.u = a; svcClient = new ServicesClient(); lofd = new List<OrderFoodData>(); loadProducts(); }
public OrderFoodForm(MainForm mf, User p) { InitializeComponent(); this.mf = mf; svcClient = new ServicesClient(); loadProducts(); this.u = p; }
public override bool Hook_UserPart(Network network, User user, Channel channel, string message, bool updated) { if (!updated) { return true; } Message(channel.retrieveWindow(), user.Nick + " parted"); return false; }
public override bool Hook_UserQuit(Network network, User user, string message, Graphics.Window window, bool updated) { if (!updated) { return true; } Message(window, user.Nick + " joined"); return false; }
public override bool Hook_UserJoin(Network network, User user, Channel channel, bool updated) { if (!updated) { return true; } Message(channel.retrieveWindow(), user.Nick + " joined"); return false; }
public static void Main(String[] args) { Console.WriteLine("Press enter to call service..."); Console.ReadLine(); var client = new ServiceProcessorClient(); User user = new User(); user.UserName = "******"; user.Password = "******"; client.SubmitMessage(user); Console.ReadLine(); }
/// <summary> /// Checks if any of loaded ignores is matching this text /// </summary> /// <param name="text"></param> /// <param name="user"></param> /// <returns></returns> public static bool Matches(string text, User user = null) { // we need to walk through list of all ignores to find out foreach (Ignore x in IgnoreList) { // first of all we need to know if it's enabled, otherwise there is no point in checking it if (x.Enabled) { // if it's simple match we only check the text if (x.Simple) { // if user is null we can skip it if (user != null && x.type == Ignore.Type.User) { if (user.ToString().Contains(x.Text)) { return true; } } if (x.type == Ignore.Type.Everything) { if (text.Contains(x.Text)) { return true; } } } else { if (user != null && x.type == Ignore.Type.User) { if (x.regex.IsMatch(user.ToString())) { return true; } } if (x.type == Ignore.Type.Everything) { if (x.regex.IsMatch(text)) { return true; } } } } } return false; }
//Search_btn private void button1_Click(object sender, RoutedEventArgs e) { Contactslist.Items.Clear(); if (radioButtonUsr.IsChecked == true) { User arg = klient.getUserByUserName(searchValue.Text); usr_help = arg; if (arg != null) { fill(Contactslist, klient.getContactsByUser(arg, 10).ToList()); } } else if (radioButtonName.IsChecked == true) { fill(Contactslist, klient.getContactByName(searchValue.Text, 10).ToList()); } else if (radioButtonMail.IsChecked == true) { fill(Contactslist, klient.getContactByEmail(searchValue.Text, 10).ToList()); } else if (radioButtonTel.IsChecked == true) { fill(Contactslist, klient.getContactBytel(searchValue.Text, 10).ToList()); } else if (radioButtonSkype.IsChecked == true) { fill(Contactslist, klient.getContactBySkype(searchValue.Text, 10).ToList()); } else { MainWindow top = (MainWindow)Window.GetWindow(this); fill(Contactslist, klient.getContactsByUser(top.LoggedUser, 10).ToList()); } srch_text_help = searchValue.Text; }
public virtual bool Hook_UserJoin(Network network, User user, Channel channel, bool updated) { return true; }
private bool ParseUser(string[] code, string realname) { if (code.Length > 8) { Channel channel = _Network.getChannel(code[3]); string ident = code[4]; string host = code[5]; string nick = code[7]; string server = code[6]; if (realname != null & realname.Length > 2) { realname = realname.Substring(2); } else if (realname == "0 ") { realname = ""; } char mode = '\0'; bool IsAway = false; if (code[8].Length > 0) { // if user is away we flag him if (code[8].StartsWith("G", StringComparison.Ordinal)) { IsAway = true; } mode = code[8][code[8].Length - 1]; if (!_Network.UChars.Contains(mode)) { mode = '\0'; } } if (channel != null) { if (updated_text) { if (!channel.ContainsUser(nick)) { User _user = null; if (mode != '\0') { _user = new User(mode.ToString() + nick, host, _Network, ident, server); } else { _user = new User(nick, host, _Network, ident, server); } _user.LastAwayCheck = DateTime.Now; _user.RealName = realname; if (IsAway) { _user.AwayTime = DateTime.Now; } _user.Away = IsAway; lock (channel.UserList) { channel.UserList.Add(_user); } return true; } lock (channel.UserList) { foreach (User u in channel.UserList) { if (u.Nick == nick) { u.Ident = ident; u.Host = host; u.Server = server; u.RealName = realname; u.LastAwayCheck = DateTime.Now; if (!u.Away && IsAway) { u.AwayTime = DateTime.Now; } u.Away = IsAway; break; } } } } if (Configuration.Kernel.HidingParsed && channel.IsParsingWhoData) { return true; } } } return false; }
/// <summary> /// This is called for PRIVMSG from server /// </summary> /// <param name="source"></param> /// <param name="parameters"></param> /// <param name="value"></param> /// <returns></returns> private bool ProcessPM(string source, string parameters, string value) { string _nick = "{unknown nick}"; string _ident = "{unknown ident}"; string _host = "{unknown host}"; string chan = null; if (source.Contains("!")) { _nick = source.Substring(0, source.IndexOf("!", StringComparison.Ordinal)); _ident = source.Substring(source.IndexOf("!", StringComparison.Ordinal) + 1); _ident = _ident.Substring(0, _ident.IndexOf("@", StringComparison.Ordinal)); } else { Core.DebugLog("Parser error: " + source); } if (source.Contains("@")) { _host = source.Substring(source.IndexOf("@", StringComparison.Ordinal) + 1); } chan = parameters.Replace(" ", ""); User user = null; string message = value; if (!chan.Contains(_Network.channel_prefix)) { string uc; if (message.StartsWith(_Protocol.delimiter.ToString(), StringComparison.Ordinal)) { string trimmed = message; if (trimmed.StartsWith(_Protocol.delimiter.ToString(), StringComparison.Ordinal)) { trimmed = trimmed.Substring(1); } if (trimmed.Length > 1 && trimmed[trimmed.Length - 1] == _Protocol.delimiter) { trimmed = trimmed.Substring(0, trimmed.Length - 1); } if (message.StartsWith(_Protocol.delimiter.ToString() + "ACTION", StringComparison.Ordinal)) { message = message.Substring("xACTION".Length); if (message.Length > 1 && message.EndsWith(_Protocol.delimiter.ToString(), StringComparison.Ordinal)) { message = message.Substring(0, message.Length - 1); } user = _Network.getUser(_nick); if (user != null) { lock (_Network.PrivateWins) { if (_Network.PrivateWins.ContainsKey(user)) { WindowText(_Network.PrivateWins[user], Configuration.CurrentSkin.Message2 + _nick + message, Client.ContentLine.MessageStyle.Action, updated_text, date, !updated_text); return true; } else { Core.DebugLog("Network " + _Network.ServerName + " doesn't have user (" + _nick + ") ignoring ctcp"); } } } else { Core.DebugLog("Message from unknown user: "******" ")) { uc = uc.Substring(0, uc.IndexOf(" ", StringComparison.Ordinal)); } uc = uc.ToUpper(); if (!Configuration.irc.FirewallCTCP) { if (Hooks._Network.ParseCTCP(_Network, user, message)) { return true; } switch (uc) { case "VERSION": reply = "VERSION " + Configuration.Version + " build: " + RevisionProvider.GetHash() + " http://pidgeonclient.org/wiki/"; if (Configuration.irc.DetailedVersion) { reply += " operating system " + Environment.OSVersion.ToString(); } _Network.Transfer("NOTICE " + _nick + " :" + _Protocol.delimiter.ToString() + reply, Configuration.Priority.Low); break; case "TIME": reply = "TIME " + DateTime.Now.ToString(); _Network.Transfer("NOTICE " + _nick + " :" + _Protocol.delimiter.ToString() + reply, Configuration.Priority.Low); break; case "PING": if (message.Length > 6) { string time = message.Substring(6); if (time.Contains(_Network._Protocol.delimiter)) { reply = "PING " + time; time = message.Substring(0, message.IndexOf(_Network._Protocol.delimiter)); _Network.Transfer("NOTICE " + _nick + " :" + _Protocol.delimiter.ToString() + reply, Configuration.Priority.Low); } } break; case "DCC": string message2 = message; if (message.Length < 5 || !message.Contains(" ")) { Core.DebugLog("Malformed DCC " + message); return false; } if (message2.EndsWith(_Protocol.delimiter.ToString(), StringComparison.Ordinal)) { message2 = message2.Substring(0, message2.Length - 1); } string[] list = message2.Split(' '); if (list.Length < 5) { Core.DebugLog("Malformed DCC " + message); return false; } string type = list[1]; int port = 0; if (!int.TryParse(list[4], out port)) { Core.DebugLog("Malformed DCC " + message2); return false; } if (port < 1) { Core.DebugLog("Malformed DCC " + message2); return false; } switch (type.ToLower()) { case "send": break; case "chat": Core.OpenDCC(list[3], port, _nick, false, false, _Network); return true; case "securechat": Core.OpenDCC(list[3], port, _nick, false, true, _Network); return true; } Core.DebugLog("Malformed DCC " + message2); return false; } } } if (Configuration.irc.DisplayCtcp) { WindowText(_Network.SystemWindow, "CTCP from (" + _nick + ") " + trimmed, Client.ContentLine.MessageStyle.Message, true, date, !updated_text); } if (Configuration.irc.ShowReplyForCTCP && reply != null) { WindowText(_Network.SystemWindow, "CTCP response to (" + _nick + ") " + reply, Client.ContentLine.MessageStyle.Message, true, date, !updated_text); } return true; } } user = new User(_nick, _host, _Network, _ident); Channel channel = null; if (chan.StartsWith(_Network.channel_prefix, StringComparison.Ordinal)) { channel = _Network.getChannel(chan); if (channel != null) { Graphics.Window window; window = channel.RetrieveWindow(); if (window != null) { if (Ignoring.Matches(message, user)) { if (Hooks._Scrollback.Ignore(window, user, message, updated_text, date)) { return true; } } if (message.StartsWith(_Protocol.delimiter.ToString() + "ACTION", StringComparison.Ordinal)) { message = message.Substring("xACTION".Length); if (message.Length > 1 && message.EndsWith(_Protocol.delimiter.ToString(), StringComparison.Ordinal)) { message = message.Substring(0, message.Length - 1); } if (isServices) { if (_nick == _Network.Nickname) { WindowText(window, Configuration.CurrentSkin.Message2 + _nick + message, Client.ContentLine.MessageStyle.Action, !channel.TemporarilyHidden, date, true); return true; } } WindowText(window, Configuration.CurrentSkin.Message2 + _nick + message, Client.ContentLine.MessageStyle.Action, !channel.TemporarilyHidden, date, !updated_text); return true; } if (!Configuration.irc.DisplayMode) { WindowText(window, Protocol.PRIVMSG(user.Nick, message), Client.ContentLine.MessageStyle.Message, !channel.TemporarilyHidden, date, !updated_text); } else { WindowText(window, Protocol.PRIVMSG(user.ChannelPrefix + user.Nick, message), Client.ContentLine.MessageStyle.Message, !channel.TemporarilyHidden, date, !updated_text); } } channel.UpdateInfo(); return true; } return true; } if (chan == _Network.Nickname) { chan = source.Substring(0, source.IndexOf("!", StringComparison.Ordinal)); lock (_Protocol.Windows) { if (!_Protocol.Windows.ContainsKey(_Network.SystemWindowID + chan)) { _Network.Private(chan); } Graphics.Window w = _Protocol.Windows[_Network.SystemWindowID + chan]; WindowText(w, Protocol.PRIVMSG(chan, message), Client.ContentLine.MessageStyle.Message, updated_text, date, !updated_text); if (Configuration.Kernel.Notice && Configuration.Window.NotifyPrivate && w.Highlights && updated_text) { if (Core.SystemForm.Chat != w) { Core.DisplayNote(message, chan); } } } return true; } return false; }
/// <summary> /// Create private message to user /// </summary> /// <param name="user">User name</param> public User Private(string user) { User referenced_user = new User(user, "", this, ""); PrivateChat.Add(referenced_user); Core.SystemForm.ChannelList.insertUser(referenced_user); PrivateWins.Add(referenced_user, _Protocol.CreateChat(user, Configuration.UserData.SwitchWindowOnJoin, this, true, null, false, true)); PrivateWins[referenced_user].isPM = true; if (Configuration.UserData.SwitchWindowOnJoin) { Core.SystemForm.ChannelList.ReselectWindow(PrivateWins[referenced_user]); } return referenced_user; }
/// <summary> /// When ignore happen /// </summary> /// <param name="window">Window</param> /// <param name="message">Message that was ignored</param> /// <param name="updated"></param> /// <param name="date"></param> /// <param name="user"></param> /// <returns></returns> public static bool Ignore(Graphics.Window window, User user, string message, bool updated, long date) { bool ok = true; foreach (Extension extension in Core.Extensions) { try { if (extension._Status == Extension.Status.Active) { Extension.MessageArgs data = new Extension.MessageArgs(); data.updated = updated; data.date = date; data.user = user; data.text = message; data.window = window; if (!extension.Hook_BeforeIgnore(data)) { ok = false; } } } catch (Exception mf) { Core.DebugLog("Error in hook Ignore(Graphics.Window window, string message, bool updated, long date) module " + extension.Name); Core.handleException(mf); } } return ok; }
public MainForm(ClientLogin cl, User u) { InitializeComponent(); this.cl = cl; this.u = u; }
/// <summary> /// User kick /// </summary> /// <param name="network"></param> /// <param name="user"></param> /// <param name="kicker"></param> /// <param name="channel"></param> /// <param name="message"></param> public static bool UserKick(Network network, User user, User kicker, Channel channel, string message) { return true; }
/// <summary> /// Channel info /// </summary> /// <param name="curr">XmlNode</param> /// <param name="protocol">Protocol which owns this request</param> public static void sChannelInfo(XmlNode curr, ProtocolSv protocol) { if (string.IsNullOrEmpty(curr.InnerText)) { if (curr.Attributes.Count > 1) { if (curr.Attributes[1].Name == "channels") { string[] channellist = curr.Attributes[1].Value.Split('!'); Network nw = protocol.retrieveNetwork(curr.Attributes[0].Value); if (nw != null) { foreach (string channel in channellist) { if (!string.IsNullOrEmpty(channel)) { if (nw.getChannel(channel) == null) { Channel xx = nw.Channel(channel, !Configuration.UserData.SwitchWindowOnJoin); if (Configuration.Services.UsingCache) { string ID = protocol.sBuffer.getUID(curr.Attributes[0].Value); if (ID != null && protocol.sBuffer.networkInfo.ContainsKey(ID)) { Graphics.Window window = xx.RetrieveWindow(); if (xx != null) { protocol.sBuffer.networkInfo[ID].recoverWindowText(window, window.WindowName); } Services.Buffer.ChannelInfo channel_info = protocol.sBuffer.networkInfo[ID].getChannel(channel); if (channel_info != null) { xx.Bans = channel_info.Bans; xx.Exceptions = channel_info.Exceptions; xx.ChannelWork = channel_info.ChannelWork; xx.Invites = channel_info.Invites; xx.Name = channel_info.Name; xx.IsParsingBanData = channel_info.parsing_bans; xx.IsParsingWhoisData = channel_info.parsing_wh; xx.IsParsingWhoData = channel_info.parsing_who; xx.ChannelMode = new NetworkMode(channel_info.mode); xx.IsParsingExceptionData = channel_info.parsing_xe; xx.Redraw = channel_info.Redraw; xx.TemporarilyHidden = channel_info.temporary_hide; xx.Topic = channel_info.Topic; xx.TopicDate = channel_info.TopicDate; xx.TopicUser = channel_info.TopicUser; } } } } if (!Configuration.Services.Retrieve_Sv) { protocol.SendData(nw.ServerName, "TOPIC " + channel, Configuration.Priority.Normal); protocol.SendData(nw.ServerName, "MODE " + channel, Configuration.Priority.Low); } Datagram response2 = new Datagram("CHANNELINFO", "INFO"); response2.Parameters.Add("network", curr.Attributes[0].Value); response2.Parameters.Add("channel", channel); lock (protocol.RemainingJobs) { protocol.RemainingJobs.Add(new ProtocolSv.Request(channel, ProtocolSv.Request.Type.ChannelInfo)); } protocol.Deliver(response2); } } System.Threading.Thread.Sleep(800); } } } return; } if (curr.Attributes[1].Name == "channel") { string[] userlist = curr.Attributes[2].Value.Split(':'); Network nw = protocol.retrieveNetwork(curr.Attributes[0].Value); if (nw != null) { lock (protocol.RemainingJobs) { ProtocolSv.Request item = null; foreach (ProtocolSv.Request work in protocol.RemainingJobs) { if (work.type == ProtocolSv.Request.Type.ChannelInfo && curr.Attributes[1].Value == work.Name) { item = work; } } if (item != null) { protocol.RemainingJobs.Remove(item); Core.SystemForm.Status(protocol.getInfo()); } } Channel channel = nw.getChannel(curr.Attributes[1].Value); if (channel != null) { foreach (string user in userlist) { if (user.Contains("!") && user.Contains("@")) { string us = ""; string ident; us = user.Substring(0, user.IndexOf("!", StringComparison.Ordinal)); if (channel.ContainsUser(us)) { continue; } ident = user.Substring(user.IndexOf("!", StringComparison.Ordinal) + 1); if (ident.StartsWith("@", StringComparison.Ordinal)) { ident = ""; } else { if (ident.Contains("@")) { ident = ident.Substring(0, ident.IndexOf("@", StringComparison.Ordinal)); } } string host = user.Substring(user.IndexOf("@", StringComparison.Ordinal) + 1); if (host.StartsWith("+", StringComparison.Ordinal)) { host = ""; } else { if (host.Contains("+")) { host = host.Substring(0, host.IndexOf("+", StringComparison.Ordinal)); } } lock (channel.UserList) { if (!channel.ContainsUser(us)) { User f2 = new User(us, host, nw, ident); if (user.Contains("+") && !user.StartsWith("+", StringComparison.Ordinal)) { f2.ChannelMode.ChangeMode(user.Substring(user.IndexOf("+", StringComparison.Ordinal))); f2.ResetMode(); } channel.UserList.Add(f2); } } } } Datagram response = new Datagram("USERLIST", "INFO"); response.Parameters.Add("network", curr.Attributes[0].Value); response.Parameters.Add("channel", channel.Name); protocol.Deliver(response); channel.RedrawUsers(); channel.UpdateInfo(); } } } }
/// <summary> /// This function returns a special user mode for a user that should be in user list (for example % for halfop or @ for operator) /// </summary> /// <param name="nick"></param> /// <returns></returns> private static string uchr(User nick) { return nick.ChannelPrefix; }
public virtual bool Hook_UserQuit(Network network, User user, string message, Graphics.Window window, bool updated) { return true; }
public virtual bool Hook_UserTalk(Network network, User user, Channel channel, string message, bool updated) { return true; }
/// <summary> /// If this return true it means that underlying extension or code has processed this CTCP and it can be ignored by irc parser /// </summary> /// <param name="network"></param> /// <param name="user"></param> /// <param name="CTCP"></param> /// <returns></returns> public static bool ParseCTCP(Network network, User user, string CTCP) { return false; }
private void Contactslist_SelectionChanged(object sender, SelectionChangedEventArgs e) { Contact uus = new Contact(); List<string> result = new List<string>(); if (Contactslist.SelectedIndex >= 0) { if (usr_help != null) { uus = klient.getContactsByUser(usr_help, 10).ToList().ElementAt(Contactslist.SelectedIndex); } else if (radioButtonSkype.IsChecked == true) { uus = klient.getContactBySkype(srch_text_help, 10).ToList().ElementAt(Contactslist.SelectedIndex); } else if (radioButtonName.IsChecked == true) { uus = klient.getContactByName(srch_text_help, 10).ToList().ElementAt(Contactslist.SelectedIndex); } else if (radioButtonTel.IsChecked == true) { uus = klient.getContactBytel(srch_text_help, 10).ToList().ElementAt(Contactslist.SelectedIndex); } else if (radioButtonSkype.IsChecked == true) { uus = klient.getContactByEmail(srch_text_help, 10).ToList().ElementAt(Contactslist.SelectedIndex); } else { MainWindow top = (MainWindow)Window.GetWindow(this); uus = klient.getContactsByUser(top.LoggedUser, 10).ToList().ElementAt(Contactslist.SelectedIndex); } } if (uus != null) { deatilslist.Items.Clear(); if (uus.FirstName != null) { deatilslist.Items.Add("FirstName: " + uus.FirstName.ToString()); } if (uus.LastName != null) { deatilslist.Items.Add("LastName: " + uus.LastName.ToString()); } if (uus.Tel != null) { deatilslist.Items.Add("Telefon: " + uus.Tel.ToString()); } if (uus.Email != null) { deatilslist.Items.Add("Email: " + uus.Email.ToString()); } if (uus.Skype != null) { deatilslist.Items.Add("Skype: " + uus.Skype.ToString()); } if (uus.Address != null) { deatilslist.Items.Add("Adress: " + uus.Address.ToString()); } if (uus.Muudetud != null) { deatilslist.Items.Add("Changed: " + uus.Muudetud.ToString()); } if (uus.Loodud != null) { deatilslist.Items.Add("Created: " + uus.Loodud.ToString()); } usr_help = null; } }
/// <summary> /// User talk /// </summary> /// <param name="network"></param> /// <param name="user"></param> /// <param name="channel"></param> /// <param name="message"></param> /// <param name="updated"></param> /// <param name="date"></param> /// <returns></returns> public static bool UserTalk(Network network, User user, Channel channel, string message, bool updated, long date) { bool ok = true; foreach (Extension extension in Core.Extensions) { try { if (extension._Status == Extension.Status.Active) { #pragma warning disable if (!extension.Hook_UserTalk(network, user, channel, message, updated)) { Core.DebugLog("Compatibility warning: extension with name " + extension.Name + " is using obsolete" + " function extension.Hook_UserTalk(network, user, channel, message, updated)"); ok = false; } #pragma warning restore Extension.NetworkTextArgs data = new Extension.NetworkTextArgs(); data.network = network; data.updated = updated; data.date = date; data.message = message; data.user = user; if (!extension.Hook_UserTalk(data)) { ok = false; } } } catch (Exception mf) { Core.DebugLog("Error in hook UserTalk(Network network, User user, Channel channel, string message) module " + extension.Name); Core.handleException(mf); } } return ok; }
public ProfileForm(User u) { InitializeComponent(); svcClient = new ServicesClient(); this.u = u; }
/// <summary> /// Channel topic is retrieved from server /// </summary> /// <param name="topic">Topic</param> /// <param name="user">User who set it</param> /// <param name="network">Network</param> /// <param name="channel">Channel</param> public static bool ChannelTopic(string topic, User user, Network network, Channel channel) { bool ok = true; return ok; }