~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to ivle/chat.py

  • Committer: Matt Giuca
  • Date: 2009-04-23 07:51:29 UTC
  • Revision ID: matt.giuca@gmail.com-20090423075129-94mf4vlwllpew0xn
ivle.svn: Added revision_is_dir (like os.path.isdir for revision history).
ivle.fileservice_lib.listing: Refactored such that the SVN revision is found
    in the top-level handler, and passed down into the individual handlers.
    This is done so that the revision information can be used to make the
    decisions (which will be required to fix the revision history browsing).
    This doesn't yet change the behaviour.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
import cjson
23
23
import cStringIO
24
 
import hashlib
 
24
import md5
25
25
import sys
26
26
import os
27
27
import socket
97
97
            env = cjson.decode(inp)
98
98
            
99
99
            # Check that the message is 
100
 
            digest = hashlib.md5(env['content'] + magic).hexdigest()
 
100
            digest = md5.new(env['content'] + magic).digest().encode('hex')
101
101
            if env['digest'] != digest:
102
102
                conn.close()
103
103
                continue
134
134
    sok = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
135
135
    sok.connect((host, port))
136
136
    content = cjson.encode(msg)
137
 
    digest = hashlib.md5(content + magic).hexdigest()
 
137
    digest = md5.new(content + magic).digest().encode("hex")
138
138
    env = {'digest':digest,'content':content}
139
139
    sok.send(cjson.encode(env))
140
140