Skip to content
This repository
Browse code

Change 'domain' attribute on the res object to 'hostname'. Because of…

… domains

introduces in 0.8, 'domain' attribute on EventEmitter objects is now special.
  • Loading branch information...
commit b7a132bdf47c727159b8cd6dd9ff18df3a05e475 1 parent b04b81a
Tomaz Muraus authored
10  README.markdown
Source Rendered
@@ -156,7 +156,7 @@ MUST call either `ack.accept()` or `ack.reject()`.
156 156
 Emitted when `HELO`, `EHLO`, or `LHLO` commands are received.
157 157
 
158 158
 Read the name of the command with `cmd.greeting`.
159  
-Read the optional domain parameter with `cmd.domain`.
  159
+Read the optional hostname parameter with `cmd.hostname`.
160 160
 
161 161
 ### 'from', from, ack
162 162
 
@@ -214,9 +214,9 @@ Extended recipient data if sent as a string.
214 214
 
215 215
 The greeting command. One of `'helo'`, `'ehlo'`, or `'lhlo'`.
216 216
 
217  
-### req.domain
  217
+### req.hostname
218 218
 
219  
-The domain specified in the greeting.
  219
+The hostname specified in the greeting.
220 220
 
221 221
 server acknowledgements
222 222
 =======================
@@ -269,10 +269,10 @@ stream.on('secure', function (ack) {
269 269
 })
270 270
 ```
271 271
 
272  
-client.helo(domain, cb)
  272
+client.helo(hostname, cb)
273 273
 -----------------------
274 274
 
275  
-Greet the server with the `domain` string.
  275
+Greet the server with the `hostname` string.
276 276
 
277 277
 `cb(err, code, lines)` fires with the server response.
278 278
 
2  lib/client/parser.js
@@ -56,7 +56,7 @@ function parse (cmd, data) {
56 56
         case 'lhlo' :
57 57
             res.name = 'greeting';
58 58
             res.greeting = cmd;
59  
-            res.domain = data;
  59
+            res.hostname = data;
60 60
             break;
61 61
         
62 62
         case 'mail' :
10  lib/client/proto.js
@@ -5,15 +5,15 @@ var os = require('os');
5 5
 var EventEmitter = require('events').EventEmitter;
6 6
 var undot = require('../dot').undot;
7 7
 
8  
-module.exports = function (domain, stream) {
  8
+module.exports = function (hostname, stream) {
9 9
     if (stream === undefined) {
10  
-        stream = domain;
11  
-        domain = undefined;
  10
+        stream = hostname;
  11
+        hostname = undefined;
12 12
     }
13 13
     
14 14
     var p = parser(stream);
15 15
     var write = writer(stream);
16  
-    write(220, domain || os.hostname());
  16
+    write(220, hostname || os.hostname());
17 17
     
18 18
     function createAck (cb, okCode, raw) {
19 19
         return {
@@ -61,7 +61,7 @@ module.exports = function (domain, stream) {
61 61
                 if (cmd.name === 'greeting') {
62 62
                     emit('greeting', cmd, function () {
63 63
                         req.greeting = cmd.greeting;
64  
-                        req.domain = cmd.domain;
  64
+                        req.hostname = cmd.hostname;
65 65
                     });
66 66
                 }
67 67
                 else {
10  lib/server/proto.js
@@ -28,14 +28,14 @@ function Client (stream) {
28 28
 
29 29
 Client.prototype = new EventEmitter;
30 30
 
31  
-Client.prototype.helo = function (domain, cb) {
32  
-    if (typeof domain === 'function') {
33  
-        cb = domain;
34  
-        domain = undefined;
  31
+Client.prototype.helo = function (hostname, cb) {
  32
+    if (typeof hostname === 'function') {
  33
+        cb = hostname;
  34
+        hostname = undefined;
35 35
     }
36 36
     this.stream.write(
37 37
         'HELO'
38  
-        + (domain !== undefined ? ' ' + domain : '')
  38
+        + (hostname !== undefined ? ' ' + hostname : '')
39 39
         + '\r\n'
40 40
     );
41 41
     this.queue.push(cb);
2  test/client_parse.js
@@ -25,7 +25,7 @@ test('multi-line code parsing', function (t) {
25 25
                 else if (cmd.name === 'quit') {
26 26
                     t.equal(output[0].name, 'greeting');
27 27
                     t.equal(output[0].greeting, 'ehlo');
28  
-                    t.equal(output[0].domain, 'localhost');
  28
+                    t.equal(output[0].hostname , 'localhost');
29 29
                     
30 30
                     t.equal(output[1].name, 'mail');
31 31
                     t.equal(output[1].from, 'beep@example.com');

0 notes on commit b7a132b

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