public Message CreateAckMessage(string MessageID, Node MessageTo) { Message p = new Message(network, MessageType.Ack); p.To = MessageTo.NodeID; p.Content = MessageID; return p; }
internal void ProcessAckMessage(Node messageFrom, string hash) { if (network.AckMethods.ContainsKey(hash)) { AckMethod m = network.AckMethods[hash]; m.CallMethod(DateTime.Now); network.AckMethods.Remove(hash); } }
public Memo(Network network, MemoInfo memoInfo) { this.network = network; this.id = memoInfo.ID; this.node = network.Nodes[memoInfo.FromNodeID]; this.createdOn = memoInfo.CreatedOn; this.signature = memoInfo.Signature; this.subject = memoInfo.Subject; this.text = memoInfo.Text; }
internal void ProcessAddMemoMessage(Node messageFrom, MemoInfo memoInfo) { Memo memo = new Memo (network, memoInfo); if (!Core.IsLocalNode(memo.Node)) { if (network.TrustedNodes.ContainsKey(memo.Node.NodeID) && memo.Verify() == false) { LoggingService.LogWarning("Ignored a memo with an invalid signature!"); return; } network.AddOrUpdateMemo(memo); } }
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 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 Memo(Network network) { this.network = network; this.node = network.Nodes[Core.MyNodeID]; this.createdOn = DateTime.Now; }
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 CreateSendFileMessage(Node SendTo, IFile theFile) { return CreateSendFileMessage(SendTo, theFile.FullPath, theFile.Size); }
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 CreateNewSessionKeyMessage(Node sessionWith, byte[] keyExchangeBytes) { Message p = new Message(network, MessageType.NewSessionKey); p.To = sessionWith.NodeID; p.Content = keyExchangeBytes; return p; }
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 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 CreateMessageMessage(Node MessageTo, string MessageText) { Message p = new Message(network, MessageType.PrivateMessage); p.To = MessageTo.NodeID; p.Content = MessageText; return p; }
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 CreateCriticalErrorMessage(Node MessageTo, MeshworkError error) { Message m = new Message(network, MessageType.CriticalError); m.To = MessageTo.NodeID; m.Content = error; return m; }
public Message CreateConnectionDownMessage(Node ConnectionSourceNode, Node ConnectionDestNode) { return CreateConnectionDownMessage(ConnectionSourceNode.NodeID, ConnectionDestNode.NodeID); }
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 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 CreateNonCriticalErrorMessage(Node To, MeshworkError error) { return CreateNonCriticalErrorMessage(To.NodeID, error); }
public Message CreateSendFileMessage(Node sendTo, string filePath, long fileSize) { throw new NotImplementedException(); /* Message m = new Message(network, MessageType.SendFile); m.To = SendTo.NodeID; SharedFileInfo c = new SharedFileInfo(); c.FileName = FilePath.Substring(FilePath.LastIndexOf("/") + 1); c.FileSize = FileSize; c.FileFullPath = FilePath; m.Content = c); return m; */ }
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 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 CreateReadyMessage(Node MessageTo) { Message p = new Message(network, MessageType.Ready); p.To = MessageTo.NodeID; // TODO: Put anything here? p.Content = "READY!"; return p; }
internal void AddUser(Node node) { users.Add(node.NodeID, node); }
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; }
public Message CreateRequestAvatarMessage(Node messageTo) { Message message = new Message(network, MessageType.RequestAvatar); message.To = messageTo.NodeID; message.Content = "plzkthx"; return message; }
internal void RemoveUser(Node node) { users.Remove(node.NodeID); }
public Message CreateRequestDirectoryMessage(Node messageTo, string requestedDirPath) { Message p = new Message(network, MessageType.RequestDirListing); p.To = messageTo.NodeID; p.Content = requestedDirPath; return p; }