# Path: NetworkTools/models/plugin.py
# class Responder(LoopingThread):
# class Plugin(Process):
#     def __init__(self, plugin):
#     def process(self):
#     def __new__(cls, *args, **kwargs):
#     def __init__(self, *args, **kwargs):
#     def run(self):
#     def process(self, data):
#     def output(self, data, result):
#     def pushcallback(self, c):
#     def popcallback(self, data):
#     def query(self, query, startpage, callback, errorcallback):
#     def get_contacts(self, callback, errorcallback):
#     def get_me(self, callback, errorcallback):
#     def submit_wavelet(self, wavelet, callback, errorcallback):
#     def _query(self, query, startpage):
#     def _contacts(self):
#     def _me(self):
#     def _submit_wavelet(self, wavelet):
#     def error(self, data, e):
# 
# Path: NetworkTools/models/user.py
# class User(object):
#     def __init__(self, name='', nick='', address = None, avatar = None):
# 
# Path: NetworkTools/models/digest.py
# class Digest(object):
# class SearchResults(object):
# 	def __init__(self, waveid, title, participants, unread, total, date):
# 	def addresses(self):
# 	def __init__(self, query, page, digests=[], maxpage = None):
# 	def num_results(self):
# 
# Path: NetworkTools/waveapi/waveservice.py
# class WaveService(object):
#   REQUEST_TOKEN_URL = 'https://www.google.com/accounts/OAuthGetRequestToken'
#   ACCESS_TOKEN_URL = 'https://www.google.com/accounts/OAuthGetAccessToken'
#   AUTHORIZATION_URL = 'https://www.google.com/accounts/OAuthAuthorizeToken'
#   SCOPE = 'http://wave.googleusercontent.com/api/rpc'
#   SIGNATURE_METHOD = oauth.OAuthSignatureMethod_HMAC_SHA1()
#   RPC_URL = 'https://www-opensocial.googleusercontent.com/api/rpc'
#   SANDBOX_RPC_URL = (
#       'https://www-opensocial-sandbox.googleusercontent.com/api/rpc')
#   def __init__(self, use_sandbox=False, server_rpc_base=None,
#                consumer_key='anonymous', consumer_secret='anonymous',
#                http_post=None):
#   def _make_token(self, token):
#   def set_http_post(self, http_post):
#   def get_token_from_request(self, oauth_request):
#   def fetch_request_token(self, callback=None):
#   def generate_authorization_url(self, request_token=None):
#   def upgrade_to_access_token(self, request_token, verifier=None):
#   def set_access_token(self, access_token):
#   def http_post(self, url, data, headers):
#   def make_rpc(self, operations):
#   def _first_rpc_result(self, result):
#   def _wavelet_from_json(self, json, pending_ops):
#   def search(self, query, index=None, num_results=None):
#   def new_wave(self, domain, participants=None, message='', proxy_for_id=None,
#                submit=False):
#   def fetch_wavelet(self, wave_id, wavelet_id=None, proxy_for_id=None,
#                     raw_deltas_from_version=-1, return_raw_snapshot=False):
#   def blind_wavelet(self, json, proxy_for_id=None):
#   def submit(self, wavelet_to_submit):
#   def fetch_my_profile(self, address=None):
#   def fetch_profiles(self, addresses=[]):


import json
import NetworkTools
import os
import urllib
from ..models import plugin, user, digest
from ..waveapi import waveservice
#           Licensed to the Apache Software Foundation (ASF) under one
#           or more contributor license agreements.  See the NOTICE file
#           distributed with this work for additional information
#           regarding copyright ownership.  The ASF licenses this file
#           to you under the Apache License, Version 2.0 (the
#           "License"); you may not use this file except in compliance
#           with the License.  You may obtain a copy of the License at

#             http://www.apache.org/licenses/LICENSE-2.0

#           Unless required by applicable law or agreed to in writing,
#           software distributed under the License is distributed on an
#           "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
#           KIND, either express or implied.  See the License for the
#           specific language governing permissions and limitations
#           under the License. 




PYTIDE_LOGIN_URL = "http://pytidewave.appspot.com/account/remotelogin"

class modelConverter:
    @staticmethod
    def SearchResults(wsresults, page, maxpage):
        ''' Turns a Data API search results list to a 
        models.SearchResults object '''
        digests = []
        for i in wsresults.digests:
            digests.append(modelConverter.Digest(i))

# Path: NetworkTools/models/plugin.py
# class Responder(LoopingThread):
# class Plugin(Process):
#     def __init__(self, plugin):
#     def process(self):
#     def __new__(cls, *args, **kwargs):
#     def __init__(self, *args, **kwargs):
#     def run(self):
#     def process(self, data):
#     def output(self, data, result):
#     def pushcallback(self, c):
#     def popcallback(self, data):
#     def query(self, query, startpage, callback, errorcallback):
#     def get_contacts(self, callback, errorcallback):
#     def get_me(self, callback, errorcallback):
#     def submit_wavelet(self, wavelet, callback, errorcallback):
#     def _query(self, query, startpage):
#     def _contacts(self):
#     def _me(self):
#     def _submit_wavelet(self, wavelet):
#     def error(self, data, e):
# 
# Path: NetworkTools/models/user.py
# class User(object):
#     def __init__(self, name='', nick='', address = None, avatar = None):
# 
# Path: NetworkTools/models/digest.py
# class Digest(object):
# class SearchResults(object):
# 	def __init__(self, waveid, title, participants, unread, total, date):
# 	def addresses(self):
# 	def __init__(self, query, page, digests=[], maxpage = None):
# 	def num_results(self):
# 
# Path: NetworkTools/waveapi/waveservice.py
# class WaveService(object):
#   REQUEST_TOKEN_URL = 'https://www.google.com/accounts/OAuthGetRequestToken'
#   ACCESS_TOKEN_URL = 'https://www.google.com/accounts/OAuthGetAccessToken'
#   AUTHORIZATION_URL = 'https://www.google.com/accounts/OAuthAuthorizeToken'
#   SCOPE = 'http://wave.googleusercontent.com/api/rpc'
#   SIGNATURE_METHOD = oauth.OAuthSignatureMethod_HMAC_SHA1()
#   RPC_URL = 'https://www-opensocial.googleusercontent.com/api/rpc'
#   SANDBOX_RPC_URL = (
#       'https://www-opensocial-sandbox.googleusercontent.com/api/rpc')
#   def __init__(self, use_sandbox=False, server_rpc_base=None,
#                consumer_key='anonymous', consumer_secret='anonymous',
#                http_post=None):
#   def _make_token(self, token):
#   def set_http_post(self, http_post):
#   def get_token_from_request(self, oauth_request):
#   def fetch_request_token(self, callback=None):
#   def generate_authorization_url(self, request_token=None):
#   def upgrade_to_access_token(self, request_token, verifier=None):
#   def set_access_token(self, access_token):
#   def http_post(self, url, data, headers):
#   def make_rpc(self, operations):
#   def _first_rpc_result(self, result):
#   def _wavelet_from_json(self, json, pending_ops):
#   def search(self, query, index=None, num_results=None):
#   def new_wave(self, domain, participants=None, message='', proxy_for_id=None,
#                submit=False):
#   def fetch_wavelet(self, wave_id, wavelet_id=None, proxy_for_id=None,
#                     raw_deltas_from_version=-1, return_raw_snapshot=False):
#   def blind_wavelet(self, json, proxy_for_id=None):
#   def submit(self, wavelet_to_submit):
#   def fetch_my_profile(self, address=None):
#   def fetch_profiles(self, addresses=[]):


# Path: NetworkTools/plugins/gwave.py
import json
import NetworkTools
import os
import urllib
from ..models import plugin, user, digest
from ..waveapi import waveservice

#           Licensed to the Apache Software Foundation (ASF) under one
#           or more contributor license agreements.  See the NOTICE file
#           distributed with this work for additional information
#           regarding copyright ownership.  The ASF licenses this file
#           to you under the Apache License, Version 2.0 (the
#           "License"); you may not use this file except in compliance
#           with the License.  You may obtain a copy of the License at

#             http://www.apache.org/licenses/LICENSE-2.0

#           Unless required by applicable law or agreed to in writing,
#           software distributed under the License is distributed on an
#           "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
#           KIND, either express or implied.  See the License for the
#           specific language governing permissions and limitations
#           under the License. 




PYTIDE_LOGIN_URL = "http://pytidewave.appspot.com/account/remotelogin"

class modelConverter:
    @staticmethod
    def SearchResults(wsresults, page, maxpage):
        ''' Turns a Data API search results list to a 
        models.SearchResults object '''
        digests = []
        for i in wsresults.digests:
            digests.append(modelConverter.Digest(i))

        return digest.SearchResults(wsresults.query,