changeset 17e362df3348 in /home/hg/repos/gajim
details:http://hg.gajim.org/gajim?cmd=changeset;node=17e362df3348
description: dont compare hashes on SI transfer
diffstat:
src/filetransfers_window.py | 4 +++-
src/gui_interface.py | 13 +++++++------
2 files changed, 10 insertions(+), 7 deletions(-)
diffs (44 lines):
diff -r 06bd222f8cc3 -r 17e362df3348 src/filetransfers_window.py
--- a/src/filetransfers_window.py Sat Apr 07 00:56:44 2012 -0400
+++ b/src/filetransfers_window.py Sat Apr 07 23:12:15 2012 -0400
@@ -639,7 +639,9 @@
status = 'stop'
self.model.set(iter_, 0, self.get_icon(status))
if transfered_size == full_size:
- if file_props['type'] == 'r':
+ # If we are receiver and this is a jingle session
+ if file_props['type'] == 'r' and 'session-sid' in file_props:
+ # Show that we are computing the hash
self.set_status(typ, sid, 'computing')
else:
self.set_status(typ, sid, 'ok')
diff -r 06bd222f8cc3 -r 17e362df3348 src/gui_interface.py
--- a/src/gui_interface.py Sat Apr 07 00:56:44 2012 -0400
+++ b/src/gui_interface.py Sat Apr 07 23:12:15 2012 -0400
@@ -34,7 +34,6 @@
## You should have received a copy of the GNU General Public License
## along with Gajim. If not, see <http://www.gnu.org/licenses/>.
##
-
import os
import sys
import re
@@ -954,11 +953,13 @@
return
if file_props['type'] == 'r': # we receive a file
- jid = unicode(file_props['sender'])
- # Compare hashes in a new thread
- self.hashThread = Thread(target=self.__compare_hashes,
- args=(account, file_props))
- self.hashThread.start()
+ # If we have a jingle session id, it is a jingle transfer
+ # we compare hashes
+ if 'session-sid' in file_props:
+ # Compare hashes in a new thread
+ self.hashThread = Thread(target=self.__compare_hashes,
+ args=(account, file_props))
+ self.hashThread.start()
gajim.socks5queue.remove_receiver(file_props['sid'], True, True)
else: # we send a file
jid = unicode(file_props['receiver'])
changeset 771cbf02190a in /home/hg/repos/gajim
details:http://hg.gajim.org/gajim?cmd=changeset;node=771cbf02190a
description: remove snarl test plugin. It is now in plugins repos
diffstat:
plugins/snarl_notifications/PySnarl.py | 772 -------------------------------
plugins/snarl_notifications/__init__.py | 1 -
plugins/snarl_notifications/manifest.ini | 11 -
plugins/snarl_notifications/plugin.py | 71 --
4 files changed, 0 insertions(+), 855 deletions(-)
diffs (truncated from 871 to 300 lines):
diff -r 8513eb020fa8 -r 771cbf02190a plugins/snarl_notifications/PySnarl.py
--- a/plugins/snarl_notifications/PySnarl.py Tue Apr 03 19:38:15 2012 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,772 +0,0 @@
-"""
-A python version of the main functions to use Snarl
-(http://www.fullphat.net/snarl)
-
-Version 1.0
-
-This module can be used in two ways. One is the normal way
-the other snarl interfaces work. This means you can call snShowMessage
-and get an ID back for manipulations.
-
-The other way is there is a class this module exposes called SnarlMessage.
-This allows you to keep track of the message as a python object. If you
-use the send without specifying False as the argument it will set the ID
-to what the return of the last SendMessage was. This is of course only
-useful for the SHOW message.
-
-Requires one of:
- pywin32 extensions from http://pywin32.sourceforge.net
- ctypes (included in Python 2.5, downloadable for earlier versions)
-
-Creator: Sam Listopad II (samlii(a)users.sourceforge.net)
-
-Copyright 2006-2008 Samuel Listopad II
-
-Licensed 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.
-"""
-
-import array, struct
-
-def LOWORD(dword):
- """Return the low WORD of the passed in integer"""
- return dword & 0x0000ffff
-#get the hi word
-def HIWORD(dword):
- """Return the high WORD of the passed in integer"""
- return dword >> 16
-
-class Win32FuncException(Exception):
- def __init__(self, value):
- self.value = value
-
- def __str__(self):
- return repr(self.value)
-
-class Win32Funcs:
- """Just a little class to hide the details of finding and using the
-correct win32 functions. The functions may throw a UnicodeEncodeError if
-there is not a unicode version and it is sent a unicode string that cannot
-be converted to ASCII."""
- WM_USER = 0x400
- WM_COPYDATA = 0x4a
- #Type of String the functions are expecting.
- #Used like function(myWin32Funcs.strType(param)).
- __strType = str
- #FindWindow function to use
- __FindWindow = None
- #FindWindow function to use
- __FindWindowEx = None
- #SendMessage function to use
- __SendMessage = None
- #SendMessageTimeout function to use
- __SendMessageTimeout = None
- #IsWindow function to use
- __IsWindow = None
- #RegisterWindowMessage to use
- __RegisterWindowMessage = None
- #GetWindowText to use
- __GetWindowText = None
-
- def FindWindow(self, lpClassName, lpWindowName):
- """Wraps the windows API call of FindWindow"""
- if lpClassName is not None:
- lpClassName = self.__strType(lpClassName)
- if lpWindowName is not None:
- lpWindowName = self.__strType(lpWindowName)
- return self.__FindWindow(lpClassName, lpWindowName)
-
- def FindWindowEx(self, hwndParent, hwndChildAfter, lpClassName, lpWindowName):
- """Wraps the windows API call of FindWindow"""
- if lpClassName is not None:
- lpClassName = self.__strType(lpClassName)
- if lpWindowName is not None:
- lpWindowName = self.__strType(lpWindowName)
- return self.__FindWindowEx(hwndParent, hwndChildAfter, lpClassName, lpWindowName)
-
- def SendMessage(self, hWnd, Msg, wParam, lParam):
- """Wraps the windows API call of SendMessage"""
- return self.__SendMessage(hWnd, Msg, wParam, lParam)
-
- def SendMessageTimeout(self, hWnd, Msg,
- wParam, lParam, fuFlags,
- uTimeout, lpdwResult = None):
- """Wraps the windows API call of SendMessageTimeout"""
- idToRet = None
- try:
- idFromMsg = array.array('I', [0])
- result = idFromMsg.buffer_info()[0]
- response = self.__SendMessageTimeout(hWnd, Msg, wParam,
- lParam, fuFlags,
- uTimeout, result)
- if response == 0:
- raise Win32FuncException, "SendMessageTimeout TimedOut"
-
- idToRet = idFromMsg[0]
- except TypeError:
- idToRet = self.__SendMessageTimeout(hWnd, Msg, wParam,
- lParam, fuFlags,
- uTimeout)
-
- if lpdwResult is not None and lpdwResult.typecode == 'I':
- lpdwResult[0] = idToRet
-
- return idToRet
-
- def IsWindow(self, hWnd):
- """Wraps the windows API call of IsWindow"""
- return self.__IsWindow(hWnd)
-
- def RegisterWindowMessage(self, lpString):
- """Wraps the windows API call of RegisterWindowMessage"""
- return self.__RegisterWindowMessage(self.__strType(lpString))
-
- def GetWindowText(self, hWnd, lpString = None, nMaxCount = None):
- """Wraps the windows API call of SendMessageTimeout"""
- text = ''
- if hWnd == 0:
- return text
-
- if nMaxCount is None:
- nMaxCount = 1025
-
- try:
- arrayType = 'c'
- if self.__strType == unicode:
- arrayType = 'u'
- path_string = array.array(arrayType, self.__strType('\x00') * nMaxCount)
- path_buffer = path_string.buffer_info()[0]
- result = self.__GetWindowText(hWnd,
- path_buffer,
- nMaxCount)
- if result > 0:
- if self.__strType == unicode:
- text = path_string[0:result].tounicode()
- else:
- text = path_string[0:result].tostring()
- except TypeError:
- text = self.__GetWindowText(hWnd)
-
- if lpString is not None and lpString.typecode == 'c':
- lpdwResult[0:len(text)] = array.array('c', str(text));
-
- if lpString is not None and lpString.typecode == 'u':
- lpdwResult[0:len(text)] = array.array('u', unicode(text));
-
- return text
-
- def __init__(self):
- """Load up my needed functions"""
- # First see if they already have win32gui imported. If so use it.
- # This has to be checked first since the auto check looks for ctypes
- # first.
- try:
- self.__FindWindow = win32gui.FindWindow
- self.__FindWindowEx = win32gui.FindWindowEx
- self.__GetWindowText = win32gui.GetWindowText
- self.__IsWindow = win32gui.IsWindow
- self.__SendMessage = win32gui.SendMessage
- self.__SendMessageTimeout = win32gui.SendMessageTimeout
- self.__RegisterWindowMessage = win32gui.RegisterWindowMessage
- self.__strType = unicode
-
- #Something threw a NameError, most likely the win32gui lines
- #so do auto check
- except NameError:
- try:
- from ctypes import windll
- self.__FindWindow = windll.user32.FindWindowW
- self.__FindWindowEx = windll.user32.FindWindowExW
- self.__GetWindowText = windll.user32.GetWindowTextW
- self.__IsWindow = windll.user32.IsWindow
- self.__SendMessage = windll.user32.SendMessageW
- self.__SendMessageTimeout = windll.user32.SendMessageTimeoutW
- self.__RegisterWindowMessage = windll.user32.RegisterWindowMessageW
- self.__strType = unicode
-
- #FindWindowW wasn't found, look for FindWindowA
- except AttributeError:
- try:
- self.__FindWindow = windll.user32.FindWindowA
- self.__FindWindowEx = windll.user32.FindWindowExA
- self.__GetWindowText = windll.user32.GetWindowTextA
- self.__IsWindow = windll.user32.IsWindow
- self.__SendMessage = windll.user32.SendMessageA
- self.__SendMessageTimeout = windll.user32.SendMessageTimeoutA
- self.__RegisterWindowMessage = windll.user32.RegisterWindowMessageA
- # Couldn't find either so Die and tell user why.
- except AttributeError:
- import sys
- sys.stderr.write("Your Windows TM setup seems to be corrupt."+
- " No FindWindow found in user32.\n")
- sys.stderr.flush()
- sys.exit(3)
-
- except ImportError:
- try:
- import win32gui
- self.__FindWindow = win32gui.FindWindow
- self.__FindWindowEx = win32gui.FindWindowEx
- self.__GetWindowText = win32gui.GetWindowText
- self.__IsWindow = win32gui.IsWindow
- self.__SendMessage = win32gui.SendMessage
- self.__SendMessageTimeout = win32gui.SendMessageTimeout
- self.__RegisterWindowMessage = win32gui.RegisterWindowMessage
- self.__strType = unicode
-
- except ImportError:
- import sys
- sys.stderr.write("You need to have either"+
- " ctypes or pywin32 installed.\n")
- sys.stderr.flush()
- #sys.exit(2)
-
-
-myWin32Funcs = Win32Funcs()
-
-
-SHOW = 1
-HIDE = 2
-UPDATE = 3
-IS_VISIBLE = 4
-GET_VERSION = 5
-REGISTER_CONFIG_WINDOW = 6
-REVOKE_CONFIG_WINDOW = 7
-REGISTER_ALERT = 8
-REVOKE_ALERT = 9
-REGISTER_CONFIG_WINDOW_2 = 10
-GET_VERSION_EX = 11
-SET_TIMEOUT = 12
-
-EX_SHOW = 32
-
-GLOBAL_MESSAGE = "SnarlGlobalMessage"
-GLOBAL_MSG = "SnarlGlobalEvent"
-
-#Messages That may be received from Snarl
-SNARL_LAUNCHED = 1
-SNARL_QUIT = 2
-SNARL_ASK_APPLET_VER = 3
-SNARL_SHOW_APP_UI = 4
-
-SNARL_NOTIFICATION_CLICKED = 32 #notification was right-clicked by user
-SNARL_NOTIFICATION_CANCELLED = SNARL_NOTIFICATION_CLICKED #Name clarified
-SNARL_NOTIFICATION_TIMED_OUT = 33
-SNARL_NOTIFICATION_ACK = 34 #notification was left-clicked by user
-
-#Snarl Test Message
-WM_SNARLTEST = myWin32Funcs.WM_USER + 237
-
-M_ABORTED = 0x80000007L
-M_ACCESS_DENIED = 0x80000009L
-M_ALREADY_EXISTS = 0x8000000CL
-M_BAD_HANDLE = 0x80000006L
-M_BAD_POINTER = 0x80000005L
-M_FAILED = 0x80000008L
-M_INVALID_ARGS = 0x80000003L
-M_NO_INTERFACE = 0x80000004L
-M_NOT_FOUND = 0x8000000BL
-M_NOT_IMPLEMENTED = 0x80000001L
-M_OK = 0x00000000L
-M_OUT_OF_MEMORY = 0x80000002L
-M_TIMED_OUT = 0x8000000AL
-
-ErrorCodeRev = {
- 0x80000007L : "M_ABORTED",
- 0x80000009L : "M_ACCESS_DENIED",
- 0x8000000CL : "M_ALREADY_EXISTS",
- 0x80000006L : "M_BAD_HANDLE",
- 0x80000005L : "M_BAD_POINTER",
- 0x80000008L : "M_FAILED",
- 0x80000003L : "M_INVALID_ARGS",
- 0x80000004L : "M_NO_INTERFACE",
- 0x8000000BL : "M_NOT_FOUND",
- 0x80000001L : "M_NOT_IMPLEMENTED",
- 0x00000000L : "M_OK",
- 0x80000002L : "M_OUT_OF_MEMORY",
- 0x8000000AL : "M_TIMED_OUT"
- }
-
-class SnarlMessage(object):
- """The main Snarl interface object.