mirror of
https://github.com/schlagmichdoch/PairDrop.git
synced 2025-04-27 02:06:16 -04:00
Feature Request: Send text instead of files
This commit is contained in:
parent
ce61dc7c60
commit
0e008a5f31
9 changed files with 288 additions and 111 deletions
|
@ -43,6 +43,9 @@ Chat.FileTransferProtocol = {
|
|||
case 'buddies':
|
||||
this._onBuddies(msg);
|
||||
break;
|
||||
case 'text':
|
||||
this._onTextReceived(msg);
|
||||
break;
|
||||
}
|
||||
},
|
||||
sendFile: function(peerId, file) {
|
||||
|
@ -135,6 +138,19 @@ Chat.FileTransferProtocol = {
|
|||
},
|
||||
_onBuddies: function(msg) {
|
||||
this.set('buddies', msg.buddies);
|
||||
},
|
||||
sendText: function(toPeer, text) {
|
||||
console.log('FTP send text:', text, 'To:', toPeer);
|
||||
this.connectToPeer(toPeer, function() {
|
||||
this._sendSystemEvent(toPeer, {
|
||||
type: 'text',
|
||||
text: text
|
||||
});
|
||||
}.bind(this));
|
||||
|
||||
},
|
||||
_onTextReceived: function(msg) {
|
||||
this.fire('text-received', msg);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue