Commits

Ian Lewis committed 6175fed

Updated to use a single skype connection

Comments (0)

Files changed (2)

skypehub/utils.py

-try:
-    import simplejson as json
-except ImportError:
-    try:
-        import json
-    except ImportError:
-        from django.utils import simplejson as json
+#:coding=utf-8:
 
 import Skype4Py
 from Skype4Py.errors import SkypeError
     """
     import platform
     return platform.system() == 'Windows'
+
+skype = get_skype(**get_skype_hook_options())

skypehub/views.py

+#:coding=utf-8:
+
+from django.utils import simplejson as json
 from django.http import HttpResponse
 
-from skypehub.utils import json, SkypeError
-from skypehub.decorators import skype_required
+from skypehub.utils import skype, SkypeError
 from skypehub.forms import PostMessageForm, PostUserMessageForm
 
 
     return HttpResponse(json.dumps(content, indent=2), content_type='application/javascript', status=status)
 
 
-def _list_chats(request, skype):
+def list_chats(request):
     chats = []
     for chat in skype.Chats:
         chats.append({
         })
     return make_json_response({'chats': chats})
 
-list_chats = skype_required(_list_chats)
-
-
-def _post_message(request, skype):
+def post_message(request):
     form = PostMessageForm(request.POST or None)
     try:
         if form.is_valid():
         else:
             raise e
     return  make_json_response({'result': 'validation error.'})
-
-post_message = skype_required(_post_message)