Skip to content
Browse files

More debugging and different ids for things...

  • Loading branch information...
1 parent b45832d commit b57ad0917794078c542e7796111739da27e174c1 @DanBUK DanBUK committed Feb 6, 2011
Showing with 7 additions and 6 deletions.
  1. +3 −3 irc.js
  2. +4 −3 public/index.html
View
6 irc.js
@@ -46,7 +46,7 @@ socket.on('connection', function(client) {
irc.addListener('privmsg', function (message) {
if (message.params[0] == '#nodester') {
client.send(JSON.stringify({
- type: "message",
+ messagetype: "message",
from: message.person.nick,
channel: message.params[0],
message: message.params[1]
@@ -55,8 +55,8 @@ socket.on('connection', function(client) {
irc.privmsg(message.person.nick, "I can only talk in #nodester.");
}
});
- } else if (obj.hasOwnProperty('type')) {
- switch (obj['type']) {
+ } else if (obj.hasOwnProperty('messagetype')) {
+ switch (obj.messagetype) {
case "message":
irc.privmsg("#nodester", obj.message);
break;
View
7 public/index.html
@@ -72,14 +72,15 @@
}
// rv = sock.send(JSON.stringify({ nickname: name }));
} else {
- if (obj.hasOwnProperty('type')) {
- switch (obj['type']) {
+ if (obj.hasOwnProperty('messagetype')) {
+ switch (obj.messagetype) {
case "message":
var p = document.createElement('p');
p.innerHtml = "<b>" + obj.from + "</b>: " + obj.message;
chatBody.appendChild(p);
break;
default:
+ alert(data);
break;
}
}
@@ -88,7 +89,7 @@
};
var sendMessage = function () {
sock.send(JSON.stringify({
- type: "message",
+ messagetype: "message",
message: textInput.value
}));
textInput.value = "";

0 comments on commit b57ad09

Please sign in to comment.
Something went wrong with that request. Please try again.