public Message CreateAckMessage(string MessageID, Node MessageTo) { Message p = new Message(network, MessageType.Ack); p.To = MessageTo.NodeID; p.Content = MessageID; return p; }
public Message CreateAddMemoMessage(Memo memo) { MemoInfo memoInfo = new MemoInfo (memo); Message message = new Message (network, MessageType.AddMemo); message.Content = memoInfo; return message; }
public Message CreateAuthMessage(INodeConnection connection, TrustedNodeInfo messageTo) { Message p = new Message(network, MessageType.Auth); p.To = messageTo.NodeID; AuthInfo c = new AuthInfo(); c.ProtocolVersion = Core.ProtocolVersion; c.NetworkName = network.NetworkName; c.NickName = network.LocalNode.NickName; p.Content = c; return p; }
public Message CreateRequestDirectoryMessage(Node messageTo, string requestedDirPath) { Message p = new Message(network, MessageType.RequestDirListing); p.To = messageTo.NodeID; p.Content = requestedDirPath; return p; }
public Message CreateRequestFileMessage(Node node, IFileTransfer transfer) { var remoteFile = (RemoteFile)transfer.File; Message p = new Message(network, MessageType.RequestFile); p.To = node.NodeID; p.Content = new RequestFileInfo(remoteFile.RemoteFullPath, transfer.Id); return p; }
public Message CreateDelMemoMessage(Memo theMemo) { Message theMessage = new Message(network, MessageType.DeleteMemo); theMessage.Content = theMemo.ID; return theMessage; }
public Message CreateChatMessageMessage(ChatRoom room, string messageText) { Message p = new Message(network, MessageType.ChatroomMessage); ChatMessage c = new ChatMessage(); c.RoomId = room.Id; c.RoomName = room.Name; c.Message = messageText; // p.To = ""; p.Content = c; return p; }
public Message CreateSearchRequestMessage(int searchRequestId, string searchString, int page) { Message p = new Message(network, MessageType.SearchRequest); SearchRequestInfo c = new SearchRequestInfo(searchRequestId, searchString, page); p.Content = c; return p; }
public Message CreateTransportDataMessage(Node to, string connectionId, byte[] data) { Message msg = new Message (network, MessageType.TransportConnect); msg.To = to.NodeID; msg.Content = new TransportDataInfo(connectionId, data); return msg; }
public Message CreateMyKeyMessage(Node messageTo) { Message m = new Message(network, MessageType.MyKey); if (messageTo != null) { m.To = messageTo.NodeID; } KeyInfo info = new KeyInfo (); info.Key = Core.CryptoProvider.ToXmlString (false); info.Info = Core.Settings.NickName; m.Content = info; return m; }
public Message CreateRespondDirListingMessage(Node messageTo, LocalDirectory directory) { SharedDirectoryInfo info = new SharedDirectoryInfo(directory); info.Files = directory.Files.Select(f => new SharedFileListing((LocalFile)f, false)).ToArray(); info.Directories = directory.Directories.Select(d => d.Name).ToArray(); Message message = new Message (network, MessageType.RespondDirListing); message.To = messageTo.NodeID; message.Content = info; return message; }
public Message CreateMessageMessage(Node MessageTo, string MessageText) { Message p = new Message(network, MessageType.PrivateMessage); p.To = MessageTo.NodeID; p.Content = MessageText; return p; }
public Message CreateMyInfoMessage(Node MessageTo) { Message p = new Message(network, MessageType.MyInfo); p.To = MessageTo.NodeID; TrustedNodeInfo t = network.TrustedNodes[MessageTo.NodeID]; NodeInfo nodeInfo = new NodeInfo(); nodeInfo.NodeID = network.LocalNode.NodeID; nodeInfo.NickName = network.LocalNode.NickName; nodeInfo.AvatarSize = network.LocalNode.AvatarSize; if (MessageTo.IsConnectedLocally == true || t.AllowNetworkInfo == true) { nodeInfo.DestinationInfos = Core.DestinationManager.DestinationInfos; } if (t.AllowProfile == true) { nodeInfo.RealName = network.LocalNode.RealName; nodeInfo.Email = network.LocalNode.Email; } nodeInfo.ClientName = network.LocalNode.ClientName; nodeInfo.ClientVersion = network.LocalNode.ClientVersion; if (t.AllowSharedFiles == true) { nodeInfo.Bytes = network.LocalNode.Bytes; nodeInfo.Files = network.LocalNode.Files; } List<ConnectionInfo> connections = new List<ConnectionInfo>(); List<ChatRoomInfo> rooms = new List<ChatRoomInfo>(); List<MemoInfo> memos = new List<MemoInfo>(); foreach (INodeConnection con in network.Connections) { if (con.NodeLocal != MessageTo & con.NodeRemote != MessageTo) { if (con.ConnectionState == ConnectionState.Ready | con.ConnectionState == ConnectionState.Remote) { ConnectionInfo n = new ConnectionInfo(); Node ConnectionSourceNode = con.NodeLocal; Node ConnectionDestNode = con.NodeRemote; n.SourceNodeID = ConnectionSourceNode.NodeID; n.SourceNodeNickname = ConnectionSourceNode.NickName; n.DestNodeID = ConnectionDestNode.NodeID; n.DestNodeNickname = ConnectionDestNode.NickName; connections.Add (n); } } } foreach (ChatRoom currentRoom in network.ChatRooms) { ChatRoomInfo roomInfo = new ChatRoomInfo(); roomInfo.Id = currentRoom.Id; roomInfo.Name = currentRoom.Name; roomInfo.Users = new string[currentRoom.Users.Count]; int x = 0; foreach (Node node in currentRoom.Users.Values) { roomInfo.Users[x] = node.NodeID; x ++; } rooms.Add(roomInfo); } foreach (Memo currentMemo in network.Memos) { if (Core.IsLocalNode(currentMemo.Node)) { MemoInfo info = new MemoInfo(currentMemo); memos.Add(info); } } nodeInfo.KnownConnections = connections.ToArray(); nodeInfo.KnownChatRooms = rooms.ToArray(); nodeInfo.KnownMemos = memos.ToArray(); p.Content = nodeInfo; return p; }
public Message CreateLeaveChatMessage(ChatRoom room) { Message p = new Message(network, MessageType.LeaveChat); ChatAction c = new ChatAction(); c.RoomId = room.Id; c.RoomName = room.Name; p.Content = c; return p; }
public Message CreateHelloMessage() { Message message = new Message (network, MessageType.Hello); HelloInfo hello = new HelloInfo (); List<ConnectionInfo> connections = new List<ConnectionInfo>(); List<ChatRoomInfo> rooms = new List<ChatRoomInfo>(); List<MemoInfo> memos = new List<MemoInfo>(); foreach (INodeConnection con in network.Connections) { if (con.ConnectionState == ConnectionState.Ready | con.ConnectionState == ConnectionState.Remote) { ConnectionInfo n = new ConnectionInfo(); Node ConnectionSourceNode = con.NodeLocal; Node ConnectionDestNode = con.NodeRemote; n.SourceNodeID = ConnectionSourceNode.NodeID; n.SourceNodeNickname = ConnectionSourceNode.NickName; n.DestNodeID = ConnectionDestNode.NodeID; n.DestNodeNickname = ConnectionDestNode.NickName; connections.Add(n); } } foreach (ChatRoom currentRoom in network.ChatRooms) { ChatRoomInfo tmpRoom = new ChatRoomInfo(); tmpRoom.Id = currentRoom.Id; tmpRoom.Name = currentRoom.Name; tmpRoom.Users = new string[currentRoom.Users.Count]; int x = 0; foreach (Node node in currentRoom.Users.Values) { tmpRoom.Users[x] = node.NodeID; x ++; } rooms.Add(tmpRoom); } foreach (Memo currentMemo in network.Memos) { MemoInfo info = new MemoInfo(currentMemo); memos.Add(info); } hello.KnownConnections = connections.ToArray(); hello.KnownChatRooms = rooms.ToArray(); hello.KnownMemos = memos.ToArray(); hello.MyNickName = network.LocalNode.NickName; message.Content = hello; return message; }
public Message CreateFileDetailsMessage(Node sendTo, LocalFile file) { Message message = new Message(network, MessageType.FileDetails); message.To = sendTo.NodeID; message.Content = new SharedFileListing(file, true); return message; }
public Message CreateRequestInfoMessage(Node MessageTo) { Message m = new Message(network, MessageType.RequestInfo); m.To = MessageTo.NodeID; m.Content = "GIMME GIMME GIMME!"; return m; }
public Message CreateNewSessionKeyMessage(Node sessionWith, byte[] keyExchangeBytes) { Message p = new Message(network, MessageType.NewSessionKey); p.To = sessionWith.NodeID; p.Content = keyExchangeBytes; return p; }
public Message CreateRequestKeyMessage(Node messageto) { Message m = new Message(network, MessageType.RequestKey); m.To = messageto.NodeID; m.Content = "MUST...GET...KEY!!!"; return m; }
public Message CreateNonCriticalErrorMessage(string To, MeshworkError error) { Message p = new Message(network, MessageType.NonCriticalError); p.To = To; p.Content = error; return p; }
public Message CreateSearchReplyMessage(Node To, SearchResultInfo result) { Message p = new Message(network, MessageType.SearchResult); p.To = To.NodeID; p.Content = result; return p; }
public Message CreateConnectionDownMessage(string ConnectionSourceNodeID, string ConnectionDestNodeID) { Message p = new Message(network, MessageType.ConnectionDown); ConnectionInfo c = new ConnectionInfo(); c.SourceNodeID = ConnectionSourceNodeID; c.DestNodeID = ConnectionDestNodeID; p.Content = c; return p; }
public Message CreateTransportConnectMessage(Node to, string connectionId) { Message msg = new Message (network, MessageType.TransportConnect); msg.To = to.NodeID; msg.Content = connectionId; return msg; }
public Message CreateAvatarMessage(Node messageTo, byte[] avatarData) { Message message = new Message(network, MessageType.Avatar); message.To = messageTo.NodeID; message.Content = avatarData; return message; }
public Message CreatePongMessage(Node messageTo, ulong timestamp) { Message p = new Message(network, MessageType.Pong); p.To = messageTo.NodeID; p.Content = timestamp; return p; }
public Message CreateCriticalErrorMessage(Node MessageTo, MeshworkError error) { Message m = new Message(network, MessageType.CriticalError); m.To = MessageTo.NodeID; m.Content = error; return m; }
public Message CreateReadyMessage(Node MessageTo) { Message p = new Message(network, MessageType.Ready); p.To = MessageTo.NodeID; // TODO: Put anything here? p.Content = "READY!"; return p; }
public Message CreateRequestAvatarMessage(Node messageTo) { Message message = new Message(network, MessageType.RequestAvatar); message.To = messageTo.NodeID; message.Content = "plzkthx"; return message; }
public Message CreateChatInviteMessage(Node messageTo, ChatRoom room, string message, string password) { Message p = new Message(network, MessageType.ChatInvite); p.To = messageTo.NodeID; ChatInviteInfo c = new ChatInviteInfo(); c.RoomId = room.Id; c.RoomName = room.Name; c.Message = message; c.Password = password; p.Content = c; return p; }
private void messageSenderSendButton_Clicked(object sender, EventArgs args) { TreeIter iter; if (messageSenderToComboBox.GetActiveIter(out iter)) { Network network = (Network)messageSenderToComboBox.Model.GetValue(iter, 1); Node node = (Node)messageSenderToComboBox.Model.GetValue(iter, 2); for (int x = 0; x < 10; x++) { Thread thread = new Thread(delegate () { try { for (int y = 0; y < 10; y++) { double kilobytes = messageSenderSizeSpinButton.Value; string data = new String('X', (int)kilobytes * 1024); Message message = new Message(network, MessageType.Test); message.To = node.NodeID; message.Content = data; AckMethod m = new AckMethod(); m.Method += MessageSent; network.AckMethods.Add(message.MessageID, m); network.SendRoutedMessage(message); Gtk.Application.Invoke(delegate { messageSenderLogTextView.Buffer.Text += "\nSending..."; }); } } catch (Exception ex) { Gtk.Application.Invoke(delegate { messageSenderLogTextView.Buffer.Text += "\n" + ex; }); } }); thread.Start(); } } }