[-]
[+]
|
Changed |
sim-svn.spec
|
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/CMakeLists.txt
^
|
@@ -36,8 +36,10 @@
INCLUDE(CheckCXXCompilerFlag)
OPTION(SIM_ENABLE_FPIE "Enable PIE linking")
+OPTION(ENABLE_TARGET_UPDATE_MESSAGES "Enables target that allows to extract i18n messages from the code, and update *.po files with them")
-SIM_FIND_PLUGINS(${Sim-IM_SOURCE_DIR}/plugins)
+SET(Sim-IM_PLUGINS_SOURCE_DIR ${Sim-IM_SOURCE_DIR}/plugins)
+SIM_FIND_PLUGINS(${Sim-IM_PLUGINS_SOURCE_DIR})
IF(NOT QT_FOUND)
MESSAGE(FATAL_ERROR "Could not find Qt3 - cannot compile Sim-IM here")
@@ -85,7 +87,7 @@
INCLUDE_DIRECTORIES(${QT_INCLUDE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${Sim-IM_SOURCE_DIR}/sim
- ${Sim-IM_SOURCE_DIR}/plugins/_core)
+ ${Sim-IM_PLUGINS_SOURCE_DIR}/_core)
LINK_DIRECTORIES(${QT_LIB_DIR})
# windows, microsoft compiler
@@ -166,6 +168,20 @@
SET(XDG_APPS_DIR ${SHARE_INSTALL_PREFIX}/applications/kde)
SET(SERVICES_INSTALL_DIR ${SHARE_INSTALL_PREFIX}/services)
endif(WIN32)
+
+IF(ENABLE_TARGET_UPDATE_MESSAGES)
+ MESSAGE(STATUS "Enabling target update-messages")
+ INCLUDE(XGetText)
+
+ IF(XGETTEXT_EXECUTABLE AND MSGMERGE_EXECUTABLE)
+ MESSAGE(STATUS "Target update-messages successfuly enabled")
+ ELSE(XGETTEXT_EXECUTABLE AND MSGMERGE_EXECUTABLE)
+ MESSAGE(STATUS "Can't enable target update-messages: one or more componets are missing")
+ SET(ENABLE_TARGET_UPDATE_MESSAGES OFF)
+ ENDIF(XGETTEXT_EXECUTABLE AND MSGMERGE_EXECUTABLE)
+
+ENDIF(ENABLE_TARGET_UPDATE_MESSAGES)
+
# subdirectories
ADD_SUBDIRECTORY(sim)
@@ -191,3 +207,56 @@
# uninstall target
ADD_CUSTOM_TARGET(uninstall
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
+
+
+########################################
+# update-messages target
+#######################################
+IF ( ENABLE_TARGET_UPDATE_MESSAGES )
+
+ ADD_CUSTOM_TARGET(update-messages)
+
+ SET(new_pot "${CMAKE_CURRENT_BINARY_DIR}/new_messages")
+ EMPTY_PO_FILE(${new_pot})
+
+ ADD_CUSTOM_COMMAND(TARGET update-messages
+ COMMAND echo Processing simlib
+ )
+ LIST(SORT sim_LIB_MESSAGE_SOURCES)
+ FOREACH(file ${sim_LIB_MESSAGE_SOURCES})
+ EXTRACT_MESSAGES("${Sim-IM_SOURCE_DIR}/sim/${file}" ${new_pot})
+ ENDFOREACH(file)
+
+ LIST(SORT SIM_PLUGINS)
+ FOREACH(plugin ${SIM_PLUGINS})
+ ADD_CUSTOM_COMMAND(TARGET update-messages
+ COMMAND echo Processing plugin ${plugin}
+ )
+ LIST(SORT ${plugin}_MESSAGE_SOURCES)
+ FOREACH(file ${${plugin}_MESSAGE_SOURCES})
+ EXTRACT_MESSAGES("${Sim-IM_PLUGINS_SOURCE_DIR}/${plugin}/${file}" ${new_pot})
+ ENDFOREACH(file)
+ ENDFOREACH(plugin)
+
+ ADD_CUSTOM_COMMAND(TARGET update-messages
+ COMMAND echo Updating .po files
+ COMMAND mv ${CMAKE_SOURCE_DIR}/po/sim.pot ${CMAKE_SOURCE_DIR}/po/sim.pot.backup
+ COMMAND mv ${new_pot}.po ${CMAKE_SOURCE_DIR}/po/sim.pot
+ )
+
+ FILE(GLOB po_files ${CMAKE_SOURCE_DIR}/po/*.po)
+ FOREACH(po_file ${po_files})
+ ADD_CUSTOM_COMMAND(TARGET update-messages
+ COMMAND mv ${po_file} ${po_file}.backup
+ )
+ ENDFOREACH(po_file)
+
+ FOREACH(po_file ${po_files})
+ GET_FILENAME_COMPONENT(po_name ${po_file} NAME)
+ ADD_CUSTOM_COMMAND(TARGET update-messages
+ COMMAND echo ${po_name}
+ COMMAND ${MSGMERGE_EXECUTABLE} ${po_file}.backup ${CMAKE_SOURCE_DIR}/po/sim.pot >${po_file}
+ )
+ ENDFOREACH(po_file)
+
+ENDIF ( ENABLE_TARGET_UPDATE_MESSAGES )
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/ChangeLog
^
|
@@ -1,5 +1,5 @@
USER-VISIBLE CHANGES IN SIM INSTANT MESSENGER
-
+
[+] New
[-] Fixed error
[*] Changes
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/cmake/SimPlugins.cmake
^
|
@@ -41,8 +41,6 @@
## append
SET(SIM_PLUGINS ${SIM_PLUGINS} ${plugin})
ENDIF(${uc_plugin} MATCHES "^_.*$")
-
-
ENDIF(cmakefile)
ENDFOREACH(_cur_dir)
ENDMACRO(SIM_FIND_PLUGINS sim_plugin_dir)
@@ -54,7 +52,13 @@
MESSAGE(STATUS "Using plugin " ${plugin})
ADD_SUBDIRECTORY(plugins/${plugin})
ELSE(ENABLE_PLUGIN_${uc_plugin})
- MESSAGE(STATUS "Skipping plugin " ${plugin})
+ IF ( ENABLE_TARGET_UPDATE_MESSAGES )
+ MESSAGE(STATUS "Using plugin " ${plugin} " for message updating purposes only...")
+ ADD_SUBDIRECTORY(plugins/${plugin} EXCLUDE_FROM_ALL)
+ ELSE( ENABLE_TARGET_UPDATE_MESSAGES)
+ MESSAGE(STATUS "Skipping plugin " ${plugin})
+ ENDIF( ENABLE_TARGET_UPDATE_MESSAGES )
+
ENDIF(ENABLE_PLUGIN_${uc_plugin})
ENDFOREACH(plugin ${SIM_PLUGINS})
ENDMACRO(SIM_INCLUDE_PLUGINS)
|
[-]
[+]
|
Added |
sim-0.9.5.tar.bz2/cmake/UiToFakeCpp.cmake
^
|
@@ -0,0 +1,92 @@
+# This script tries to create fake cpp file from ui file, for feeding it to xgettext
+# The main idea is to get .po file where comments points to a real line numbers in real .ui file, not
+# in some generated .moc.cpp. To achive this we will parse whole .ui file, warp all strings for translation in i18n("")
+# and replace all other lines with empty lines. If we then parse the result with xgettext it will show exactly
+# the same line number for each string as it was in source .ui file.
+
+# This script is at beta stage, it assumes that:
+# 1. All i18n strings are warped in <string></string> tags
+# 2. There is no other tags or text in the same lines where <string></string> is located
+# 3. One <string></string> per line (but multiline strings are allowed)
+# This assumption might fail for some valid .ui files, but this script might still be used for
+# most automaticly generated ui-files
+
+# Copyright (c) 2009, Swami Dhyan Nataraj (Nikolay Shaplov), <n@shaplov.ru>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+# Arguments: IN_FILE, OUT_FILE
+
+
+cmake_policy(SET CMP0007 NEW) # do not ignore empty list item in LIST command
+
+MACRO(STRING_TAG_TO_I18N_FUN result_name str_param)
+ set(str1 "${str_param}")
+ string(REGEX REPLACE "\\\\" "\\\\\\\\" str1 "${str1}") # replace backslash with double backslash
+ string(REGEX REPLACE "\"" "\\\\\"" str1 "${str1}") # replace " with \"
+ string(REGEX REPLACE "\n" "\\\\n" str1 "${str1}") # replace new lines with \n"
+
+ string(REGEX REPLACE "&\\[SEMICOLON!!!!!!\\]" "&" str1 "${str1}")
+ string(REGEX REPLACE "<\\[SEMICOLON!!!!!!\\]" "<" str1 "${str1}")
+ string(REGEX REPLACE ">\\[SEMICOLON!!!!!!\\]" ">" str1 "${str1}")
+
+ string(REGEX REPLACE "<string>" "i18n(\"" str1 "${str1}")
+ string(REGEX REPLACE "</string>" "\");" str1 "${str1}")
+ SET(${result_name} "${str1}")
+ENDMACRO(STRING_TAG_TO_I18N_FUN)
+
+FILE(REMOVE "${OUT_FILE}")
+
+FILE(STRINGS "${IN_FILE}" ui_text)
+
+SET(ui_text "permanent_first_line;${ui_text}")
+# FOREACH skips empty elements we can't use it, LIST is claimed to respect empty line is CMP0007 set for NEW,
+# but if you do SET(text "1;;2;;;;3;4;") LIST(REMOVE_AT text 0) it will skip empty element at the beginning
+# of the list, and the first element of the result will be 2 (at least at cmake 2.6)
+# So we add dummy first element to the list and will newer remove it. In this way LIST will respect all other
+# empty elements
+
+string(REGEX REPLACE "\\\\\;" "[SEMICOLON!!!!!!]" ui_text "${ui_text}")
+# LIST do not respect backslash quoted semicolons, so before sending file content to some idiotic tag
+# to convert it back to the semicolon later
+
+
+SET(buf "")
+SET(empty_lines_buf "")
+
+WHILE(NOT ui_text STREQUAL "permanent_first_line" )
+ list(GET ui_text 1 str)
+ list(REMOVE_AT ui_text 1)
+
+ # Please make sure that ${str} is quoted in all operations (in all macros too)
+ # If you forgot quotas, you will lost all semicolons in the text
+ string(REGEX REPLACE "<string></string>" "" str "${str}") # Skip empty i18n strings
+ IF (buf) # If we already started buffering multiline string, continue doing that
+ SET(buf "${buf}\n${str}")
+ LIST(APPEND empty_lines_buf 1)
+# SET(empty_lines_buf "${empty_lines_buf}1;")
+ SET(str "")
+ ENDIF(in_buf)
+
+ IF (str MATCHES "<string>") # if new i18n string found, starting buffering it.
+ SET(buf "${str}")
+ ENDIF(str MATCHES "<string>")
+
+ IF (buf MATCHES "</string>") # if end of i18n string is found, parse it, print it and print as many new lines as needed
+ STRING_TAG_TO_I18N_FUN(buf "${buf}")
+ string(REGEX REPLACE "\\[SEMICOLON!!!!!!\\]" ";" buf "${buf}") # see coment about idiotic [SEMICOLON!!!!!!] tag above
+ FILE(APPEND "${OUT_FILE}" "${buf}\n")
+ FOREACH(emty_line ${empty_lines_buf})
+ FILE(APPEND "${OUT_FILE}" "\n")
+ ENDFOREACH(emty_line)
+ SET(buf "")
+ SET(empty_lines_buf "")
+ ELSE(buf MATCHES "</string>")
+ IF(NOT buf) # This string is outside of "string" tags, simply replace it by empty line
+ FILE(APPEND "${OUT_FILE}" "\n")
+ ENDIF(NOT buf)
+ ENDIF(buf MATCHES "</string>")
+
+ENDWHILE(NOT ui_text STREQUAL "permanent_first_line" )
+
|
[-]
[+]
|
Added |
sim-0.9.5.tar.bz2/cmake/XGetText.cmake
^
|
@@ -0,0 +1,63 @@
+SET(XGETTEXT_OPTIONS -j --foreign-user -C -ci18n -ki18n -ktr2i18n -kI18N_NOOP -kI18N_NOOP2 -kaliasLocale)
+
+FIND_PROGRAM(XGETTEXT_EXECUTABLE xgettext)
+IF (XGETTEXT_EXECUTABLE)
+ MESSAGE(STATUS "Found xgettext: ${XGETTEXT_EXECUTABLE}")
+ELSE()
+ MESSAGE(SATUS "Xgettext not found")
+ENDIF()
+
+FIND_PROGRAM(MSGMERGE_EXECUTABLE msgmerge)
+IF (MSGMERGE_EXECUTABLE)
+ MESSAGE(STATUS "Found msgmerge: ${MSGMERGE_EXECUTABLE}")
+ELSE()
+ MESSAGE(STATUS "msgmerge not found")
+ENDIF()
+
+MACRO(EXTRACT_MESSAGES src_file po_file)
+ SET(PROJECT_NAME Sim-IM) # Change this if you move this file to another project
+
+ SET(fake_ui_cpp_root "${CMAKE_CURRENT_BINARY_DIR}/fake_ui_cpp")
+
+ IF(IS_ABSOLUTE ${src_file})
+ FILE(RELATIVE_PATH relative_name ${${PROJECT_NAME}_SOURCE_DIR} ${src_file})
+ ELSE(IS_ABSOLUTE ${src_file})
+ SET(relative_name ${src_file})
+ ENDIF(IS_ABSOLUTE ${src_file})
+
+ GET_FILENAME_COMPONENT(ext ${relative_name} EXT)
+ IF(ext STREQUAL .ui)
+ # creatig fake .cpp file where messages are located in the same lines as in .ui file
+ # and put it with the whole relative path to ${fake_ui_cpp_root}
+ ADD_CUSTOM_COMMAND(TARGET update-messages
+ COMMAND echo Extracting messages from UI-file ${relative_name}
+ COMMAND ${CMAKE_COMMAND}
+ -D IN_FILE:STRING=${${PROJECT_NAME}_SOURCE_DIR}/${relative_name}
+ -D OUT_FILE:STRING=${fake_ui_cpp_root}/${relative_name}
+ -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/UiToFakeCpp.cmake
+ )
+ # parsing fake .cpp file from the ${fake_ui_cpp_root} in order to get the same path as
+ # path to the real .ui file
+ ADD_CUSTOM_COMMAND(TARGET update-messages
+ COMMAND ${XGETTEXT_EXECUTABLE} ${XGETTEXT_OPTIONS} -d${po_file} ${relative_name}
+ WORKING_DIRECTORY ${fake_ui_cpp_root}
+ )
+ ELSEIF(ext STREQUAL .cpp)
+ # just parse .cpp file
+ ADD_CUSTOM_COMMAND(TARGET update-messages
+ COMMAND echo Extracting messages from CPP-file ${relative_name}
+ COMMAND ${XGETTEXT_EXECUTABLE} ${XGETTEXT_OPTIONS} -d${po_file} ${relative_name}
+ WORKING_DIRECTORY ${${PROJECT_NAME}_SOURCE_DIR}
+ )
+ ENDIF(ext STREQUAL .ui)
+ENDMACRO(EXTRACT_MESSAGES)
+
+MACRO(EMPTY_PO_FILE po_file)
+ # creating new po file with correct charset in it
+ # if this file is created automaticly charset will not be set
+ # and there would be a lot of warnings while adding new messages in it
+ ADD_CUSTOM_COMMAND(TARGET update-messages
+ COMMAND echo \"msgid \\\"\\\"\" > ${po_file}.po
+ COMMAND echo \"msgstr \\\"Content-Type: text/plain\; charset=UTF-8\\\"\" >> ${po_file}.po
+ )
+ENDMACRO(EMPTY_PO_FILE)
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/__homedir/CMakeLists.txt
^
|
@@ -19,4 +19,11 @@
${__homedir_HDRS}
)
+SET(__homedir_MESSAGE_SOURCES ${__homedir_SRCS} ${__homedir_UICS})
+IF(NOT WIN32)
+ SET(__homedir_MESSAGE_SOURCES ${__homedir_MESSAGE_SOURCES} homedircfgbase.ui homedircfg.cpp PARENT_SCOPE)
+ELSE(NOT WIN32)
+ SET(__homedir_MESSAGE_SOURCES ${__homedir_MESSAGE_SOURCES} PARENT_SCOPE)
+ENDIF(NOT WIN32)
+
SIM_ADD_PLUGIN(__homedir)
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/__migrate/CMakeLists.txt
^
|
@@ -15,4 +15,6 @@
migratedlgbase.ui
)
+SET(__migrate_MESSAGE_SOURCES ${__migrate_SRCS} ${__migrate_UICS} PARENT_SCOPE)
+
SIM_ADD_PLUGIN(__migrate)
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/_core/CMakeLists.txt
^
|
@@ -190,4 +190,11 @@
FILE(GLOB _prebuilt emoticons_prebuilt/*.jisp)
INSTALL(FILES ${_prebuilt} DESTINATION ${SIM_ICONS_DIR})
+SET(_core_MESSAGE_SOURCES ${_core_SRCS} ${_core_UICS})
+IF(WIN32)
+ SET(_core_MESSAGE_SOURCES ${_core_MESSAGE_SOURCES} libintl.cpp PARENT_SCOPE)
+ELSE(WIN32)
+ SET(_core_MESSAGE_SOURCES ${_core_MESSAGE_SOURCES} PARENT_SCOPE)
+ENDIF(WIN32)
+
SIM_ADD_PLUGIN(_core)
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/_core/core.cpp
^
|
@@ -3100,7 +3100,6 @@
m_main = new MainWindow(data.geometry);
m_view = new UserView;
- bNew = bInit;
if (!bNew){
QString containers = getContainers();
while (!containers.isEmpty()){
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/_core/filetransfer.cpp
^
|
@@ -56,6 +56,7 @@
void transfer(bool);
void createFile(const QString &name, unsigned size, bool bCanResume);
QString m_name;
+ QString m_fn;
unsigned m_size;
FileTransferDlg *m_dlg;
};
@@ -89,12 +90,11 @@
FileTransfer *ft = m_dlg->m_msg->m_transfer;
int n = m_name.findRev('/');
- QString fn("");
if (n >= 0){
QString path;
QString p(m_name.left(n));
- fn = m_name.right(m_name.length()-n);
- fn = fn.replace(QRegExp("/"), "");
+ m_fn = m_name.right(m_name.length()-n);
+ m_fn = m_fn.replace(QRegExp("/"), "");
while (!p.isEmpty()){
if (!path.isEmpty())
@@ -127,10 +127,10 @@
QString shortName = m_name;
//m_name = ft->dir() + m_name; Quickfix, noragen
- if (fn.isEmpty())
- fn=m_name;
+ if (m_fn.isEmpty())
+ m_fn=m_name;
- m_name = ft->dir() + fn;
+ m_name = ft->dir() + m_fn;
if (ft->m_file)
delete ft->m_file;
@@ -278,7 +278,6 @@
m_state = m_msg->m_transfer->state();
m_file = m_msg->m_transfer->file();
QString status;
- QString fn;
switch (m_state){
case FileTransfer::Listen:
status = i18n("Listen");
@@ -290,19 +289,19 @@
status = i18n("Negotiation");
break;
case FileTransfer::Read:{
- status = i18n("Receive file");
- FileMessage::Iterator it(*m_msg);
- const QString *n = it[m_file];
- if (n)
- fn = *n;
+ m_fn = m_msg->getDescription();
+ //const QString *n = it[m_file];
+ //if (n)
+ // m_fn = *n;
+ status = i18n(QString("Receiving file: %1").arg(m_fn));
break;
}
case FileTransfer::Write:
- status = i18n("Send file");
- fn = m_msg->m_transfer->filename();
+ m_fn = m_msg->m_transfer->filename();
+ status = i18n("Sending file: %1").arg(m_fn);
break;
case FileTransfer::Done:
- status = i18n("Transfer done");
+ status = i18n(QString("Transfer done: %1").arg(m_fn));
edtEstimated->setText("0:00:00");
if (!m_dir.isEmpty())
btnGo->show();
@@ -314,9 +313,9 @@
default:
break;
}
- if (!fn.isEmpty()){
+ if (!m_fn.isEmpty()){
status += ' ';
- status += QDir::convertSeparators(fn);
+ status += QDir::convertSeparators(m_fn);
if (m_files > 1)
status += QString(" %1/%2")
.arg(m_file + 1)
@@ -358,7 +357,9 @@
m_timer->stop();
btnCancel->setText(i18n("&Close"));
if (m_state == FileTransfer::Done){
- EventSent(m_msg).process();
+ // EventSent shouldn't be processed here
+ // Protocol plugin should decide itself when to send it
+ //EventSent(m_msg).process();
if (chkClose->isChecked())
close();
return;
@@ -461,10 +462,10 @@
speedText += i18n("Mb/s");
break;
case 1:
- speedText += i18n("kb/s");
+ speedText += i18n("Kb/s");
break;
default:
- speedText += i18n("b/s");
+ speedText += i18n("B/s");
}
if (edtSpeed->text() != speedText)
edtSpeed->setText(speedText);
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/_core/filetransfer.h
^
|
@@ -62,6 +62,7 @@
unsigned m_totalBytes;
unsigned m_totalSize;
QString m_dir;
+ QString m_fn;
BalloonMsg *m_ask;
SIM::FileTransfer::State m_state;
friend class FileTransferDlgNotify;
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/about/CMakeLists.txt
^
|
@@ -16,4 +16,6 @@
aboutdlgbase.ui
)
+SET(about_MESSAGE_SOURCES ${about_SRCS} ${about_UICS} PARENT_SCOPE)
+
SIM_ADD_PLUGIN(about)
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/about/aboutdlg.cpp
^
|
@@ -96,10 +96,10 @@
QFile f(SIM::app_file("COPYING"));
if (f.open(IO_ReadOnly)){
for (;;){
- QString s;
- if (f.readLine(s, 512) == -1)
+ QByteArray s(512);
+ if (f.readLine(s.data(), 512) == -1)
break;
- license += s;
+ license += s.data();
}
}
txtLicence->setText(quote(license));
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/action/CMakeLists.txt
^
|
@@ -21,4 +21,7 @@
menucfgbase.ui
)
+SET(action_MESSAGE_SOURCES ${action_SRCS} ${action_UICS} PARENT_SCOPE)
+
+
SIM_ADD_PLUGIN(action)
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/action/actioncfg.cpp
^
|
@@ -61,7 +61,7 @@
CommandsMapIterator it(m_plugin->core->messageTypes);
while ((cmd = ++it) != NULL){
MessageDef *def = (MessageDef*)(cmd->param);
- if ((def == NULL) || (cmd->icon == NULL) ||
+ if ((def == NULL) || (cmd->icon.isEmpty()) ||
(def->flags & (MESSAGE_HIDDEN | MESSAGE_SENDONLY | MESSAGE_CHILD)))
continue;
if ((def->singular == NULL) || (def->plural == NULL) ||
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/autoaway/CMakeLists.txt
^
|
@@ -64,3 +64,5 @@
ELSE(COMPILE_PLUGIN)
MESSAGE(STATUS "XScreenSaver library not found, autoaway plugin disabled")
ENDIF(COMPILE_PLUGIN)
+
+SET(autoaway_MESSAGE_SOURCES autoaway.cpp autoawaycfg.cpp autoawaycfgbase.ui idleui.cpp PARENT_SCOPE)
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/background/CMakeLists.txt
^
|
@@ -15,4 +15,6 @@
bkgndcfgbase.ui
)
+SET(background_MESSAGE_SOURCES ${background_SRCS} ${background_UICS} PARENT_SCOPE)
+
SIM_ADD_PLUGIN(background)
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/dock/CMakeLists.txt
^
|
@@ -17,4 +17,6 @@
dockcfgbase.ui
)
+SET(dock_MESSAGE_SOURCES ${dock_SRCS} ${dock_UICS} PARENT_SCOPE)
+
SIM_ADD_PLUGIN(dock)
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/filter/CMakeLists.txt
^
|
@@ -18,4 +18,6 @@
ignorelistbase.ui
)
+SET(filter_MESSAGE_SOURCES ${filter_SRCS} ${filter_UICS} PARENT_SCOPE)
+
SIM_ADD_PLUGIN(filter)
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/floaty/CMakeLists.txt
^
|
@@ -11,4 +11,6 @@
floatywnd.h
)
+SET(floaty_MESSAGE_SOURCES ${floaty_SRCS} PARENT_SCOPE)
+
SIM_ADD_PLUGIN(floaty)
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/forward/CMakeLists.txt
^
|
@@ -15,4 +15,6 @@
forwardcfgbase.ui
)
+SET(forward_MESSAGE_SOURCES ${forward_SRCS} ${forward_UICS} PARENT_SCOPE)
+
SIM_ADD_PLUGIN(forward)
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/gpg/CMakeLists.txt
^
|
@@ -36,4 +36,11 @@
${gpg_UICS}
)
+SET(gpg_MESSAGE_SOURCES ${gpg_SRCS} ${gpg_UICS})
+IF(NOT WIN32)
+ SET(gpg_MESSAGE_SOURCES ${gpg_MESSAGE_SOURCES} gpgfind.cpp gpgfindbase.ui PARENT_SCOPE)
+ELSE(NOT WIN32)
+ SET(gpg_MESSAGE_SOURCES ${gpg_MESSAGE_SOURCES} PARENT_SCOPE)
+ENDIF(NOT WIN32)
+
SIM_ADD_PLUGIN(gpg)
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/icons/CMakeLists.txt
^
|
@@ -15,4 +15,6 @@
iconcfgbase.ui
)
+SET(icons_MESSAGE_SOURCES ${icons_SRCS} ${icons_UICS} PARENT_SCOPE)
+
SIM_ADD_PLUGIN(icons)
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/icq/CMakeLists.txt
^
|
@@ -55,12 +55,15 @@
icqbuffer.h
icqclient.h
icqconfig.h
+ icqicmb.h
icqinfo.h
+ icqlocation.h
icqmessage.h
icqdirect.h
icqpicture.h
icqsearch.h
icqsecure.h
+ icqservice.h
icqssbi.h
interestsinfo.h
moreinfo.h
@@ -96,6 +99,8 @@
workinfobase.ui
)
+SET(icq_MESSAGE_SOURCES ${icq_SRCS} ${icq_UICS} PARENT_SCOPE)
+
ADD_FLEX_FILES(icq_SRCS rtf.ll)
SIM_ADD_PLUGIN(icq)
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/icq/Makefile.in
^
|
@@ -1072,6 +1072,13 @@
mocs: securedlg.moc
#>+ 3
+icqicmb.moc: $(srcdir)/icqicmb.h
+ $(MOC) $(srcdir)/icqicmb.h -o icqicmb.moc
+
+#>+ 2
+mocs: icqicmb.moc
+
+#>+ 3
aimsearch.moc: $(srcdir)/aimsearch.h
$(MOC) $(srcdir)/aimsearch.h -o aimsearch.moc
@@ -1198,6 +1205,13 @@
mocs: icqssbi.moc
#>+ 3
+icqlocation.moc: $(srcdir)/icqlocation.h
+ $(MOC) $(srcdir)/icqlocation.h -o icqlocation.moc
+
+#>+ 2
+mocs: icqlocation.moc
+
+#>+ 3
warndlg.moc: $(srcdir)/warndlg.h
$(MOC) $(srcdir)/warndlg.h -o warndlg.moc
@@ -1206,10 +1220,10 @@
#>+ 3
clean-metasources:
- -rm -f homeinfo.moc aiminfo.moc icqconfig.moc securedlg.moc aimsearch.moc pastinfo.moc icqpicture.moc encodingdlg.moc interestsinfo.moc icqclient.moc aboutinfo.moc icqinfo.moc workinfo.moc polling.moc icqsecure.moc moreinfo.moc icqdirect.moc advsearch.moc icqsearch.moc aimconfig.moc verifydlg.moc icqssbi.moc warndlg.moc
+ -rm -f homeinfo.moc aiminfo.moc icqconfig.moc securedlg.moc icqicmb.moc aimsearch.moc pastinfo.moc icqpicture.moc encodingdlg.moc interestsinfo.moc icqclient.moc aboutinfo.moc icqinfo.moc workinfo.moc polling.moc icqsecure.moc moreinfo.moc icqdirect.moc advsearch.moc icqsearch.moc aimconfig.moc verifydlg.moc icqssbi.moc icqlocation.moc warndlg.moc
#>+ 2
-KDE_DIST=aimconfigbase.ui icq_events.h interestsinfobase.ui icqpicture.h icqsearch.h aimsearchbase.ui securedlgbase.ui verifydlgbase.ui polling.h aboutinfobase.ui icqinfobase.ui icqbuddy.h moreinfo.h encodingdlg.h icqconfigbase.ui xml.h warndlg.h icqsecure.h advsearch.h icqmessage.h homeinfo.h aiminfobase.ui interestsinfo.h Makefile.in icqssbi.h snac.h icqbuffer.h icq_pch.h icqinfo.h pastinfo.h icqpicturebase.ui icqservice.h icq.vcproj icq.h homeinfobase.ui workinfo.h aiminfo.h encodingdlgbase.ui securedlg.h aboutinfo.h warndlgbase.ui advsearchbase.ui moreinfobase.ui icq.rc aimconfig.h icqconfig.h icqclient.h workinfobase.ui verifydlg.h configure.in.in CMakeLists.txt icqdirect.h aimsearch.h icqsecurebase.ui pastinfobase.ui icqsearchbase.ui Makefile.am
+KDE_DIST=aimconfigbase.ui icq_events.h interestsinfobase.ui icqpicture.h icqsearch.h aimsearchbase.ui securedlgbase.ui verifydlgbase.ui polling.h aboutinfobase.ui icqinfobase.ui icqbuddy.h moreinfo.h encodingdlg.h icqconfigbase.ui xml.h warndlg.h icqsecure.h advsearch.h icqmessage.h homeinfo.h aiminfobase.ui interestsinfo.h Makefile.in icqssbi.h snac.h icqbuffer.h icq_pch.h icqinfo.h pastinfo.h icqlocation.h icqpicturebase.ui icqservice.h icq.vcproj icq.h homeinfobase.ui workinfo.h aiminfo.h encodingdlgbase.ui securedlg.h aboutinfo.h warndlgbase.ui advsearchbase.ui moreinfobase.ui icq.rc aimconfig.h icqconfig.h icqclient.h workinfobase.ui verifydlg.h configure.in.in CMakeLists.txt icqdirect.h icqicmb.h aimsearch.h icqsecurebase.ui pastinfobase.ui icqsearchbase.ui Makefile.am
#>+ 22
clean-ui:
@@ -1280,7 +1294,7 @@
#>+ 11
-icq_la.all_cc.cc: $(srcdir)/Makefile.in icqconfigbase.cc icqinfobase.cc homeinfobase.cc moreinfobase.cc workinfobase.cc aboutinfobase.cc interestsinfobase.cc pastinfobase.cc icqsecurebase.cc icqsearchbase.cc advsearchbase.cc icqpicturebase.cc securedlgbase.cc aimconfigbase.cc aiminfobase.cc aimsearchbase.cc warndlgbase.cc encodingdlgbase.cc verifydlgbase.cc homeinfo.moc icqconfig.moc aiminfo.moc securedlg.moc pastinfo.moc encodingdlg.moc interestsinfo.moc aboutinfo.moc icqinfo.moc polling.moc icqdirect.moc verifydlg.moc aimsearch.moc icqpicture.moc icqclient.moc workinfo.moc moreinfo.moc icqsecure.moc advsearch.moc icqsearch.moc aimconfig.moc icqssbi.moc warndlg.moc
+icq_la.all_cc.cc: $(srcdir)/Makefile.in icqconfigbase.cc icqinfobase.cc homeinfobase.cc moreinfobase.cc workinfobase.cc aboutinfobase.cc interestsinfobase.cc pastinfobase.cc icqsecurebase.cc icqsearchbase.cc advsearchbase.cc icqpicturebase.cc securedlgbase.cc aimconfigbase.cc aiminfobase.cc aimsearchbase.cc warndlgbase.cc encodingdlgbase.cc verifydlgbase.cc homeinfo.moc icqconfig.moc aiminfo.moc securedlg.moc pastinfo.moc encodingdlg.moc interestsinfo.moc aboutinfo.moc icqinfo.moc polling.moc icqdirect.moc verifydlg.moc icqlocation.moc icqicmb.moc aimsearch.moc icqpicture.moc icqclient.moc workinfo.moc moreinfo.moc icqsecure.moc advsearch.moc icqsearch.moc aimconfig.moc icqssbi.moc warndlg.moc
@echo 'creating icq_la.all_cc.cc ...'; \
rm -f icq_la.all_cc.files icq_la.all_cc.final; \
echo "#define KDE_USE_FINAL 1" >> icq_la.all_cc.final; \
@@ -1292,7 +1306,7 @@
rm -f icq_la.all_cc.final icq_la.all_cc.files
#>+ 11
-icq_la.all_cpp.cpp: $(srcdir)/Makefile.in $(srcdir)/icq.cpp $(srcdir)/icqconfig.cpp $(srcdir)/icqclient.cpp $(srcdir)/icqdirect.cpp $(srcdir)/icqlogin.cpp $(srcdir)/icqbos.cpp $(srcdir)/icqbuddy.cpp $(srcdir)/icqbuffer.cpp $(srcdir)/icqicmb.cpp $(srcdir)/icqlists.cpp $(srcdir)/icqlocation.cpp $(srcdir)/icqping.cpp $(srcdir)/icqservice.cpp $(srcdir)/icqvarious.cpp $(srcdir)/polling.cpp $(srcdir)/icqinfo.cpp $(srcdir)/homeinfo.cpp $(srcdir)/moreinfo.cpp $(srcdir)/workinfo.cpp $(srcdir)/aboutinfo.cpp $(srcdir)/interestsinfo.cpp $(srcdir)/pastinfo.cpp $(srcdir)/icqsecure.cpp $(srcdir)/icqsearch.cpp $(srcdir)/advsearch.cpp $(srcdir)/icqpicture.cpp $(srcdir)/icqmessage.cpp $(srcdir)/securedlg.cpp $(srcdir)/aimconfig.cpp $(srcdir)/aiminfo.cpp $(srcdir)/aimsearch.cpp $(srcdir)/aimservices.cpp $(srcdir)/warndlg.cpp $(srcdir)/encodingdlg.cpp $(srcdir)/rtfgen.cpp $(srcdir)/verifydlg.cpp $(srcdir)/xml.cpp $(srcdir)/icqssbi.cpp $(srcdir)/snac.cpp homeinfo.moc icqconfig.moc aiminfo.moc securedlg.moc pastinfo.moc encodingdlg.moc interestsinfo.moc aboutinfo.moc icqinfo.moc polling.moc icqdirect.moc verifydlg.moc aimsearch.moc icqpicture.moc icqclient.moc workinfo.moc moreinfo.moc icqsecure.moc advsearch.moc icqsearch.moc aimconfig.moc icqssbi.moc warndlg.moc
+icq_la.all_cpp.cpp: $(srcdir)/Makefile.in $(srcdir)/icq.cpp $(srcdir)/icqconfig.cpp $(srcdir)/icqclient.cpp $(srcdir)/icqdirect.cpp $(srcdir)/icqlogin.cpp $(srcdir)/icqbos.cpp $(srcdir)/icqbuddy.cpp $(srcdir)/icqbuffer.cpp $(srcdir)/icqicmb.cpp $(srcdir)/icqlists.cpp $(srcdir)/icqlocation.cpp $(srcdir)/icqping.cpp $(srcdir)/icqservice.cpp $(srcdir)/icqvarious.cpp $(srcdir)/polling.cpp $(srcdir)/icqinfo.cpp $(srcdir)/homeinfo.cpp $(srcdir)/moreinfo.cpp $(srcdir)/workinfo.cpp $(srcdir)/aboutinfo.cpp $(srcdir)/interestsinfo.cpp $(srcdir)/pastinfo.cpp $(srcdir)/icqsecure.cpp $(srcdir)/icqsearch.cpp $(srcdir)/advsearch.cpp $(srcdir)/icqpicture.cpp $(srcdir)/icqmessage.cpp $(srcdir)/securedlg.cpp $(srcdir)/aimconfig.cpp $(srcdir)/aiminfo.cpp $(srcdir)/aimsearch.cpp $(srcdir)/aimservices.cpp $(srcdir)/warndlg.cpp $(srcdir)/encodingdlg.cpp $(srcdir)/rtfgen.cpp $(srcdir)/verifydlg.cpp $(srcdir)/xml.cpp $(srcdir)/icqssbi.cpp $(srcdir)/snac.cpp homeinfo.moc icqconfig.moc aiminfo.moc securedlg.moc pastinfo.moc encodingdlg.moc interestsinfo.moc aboutinfo.moc icqinfo.moc polling.moc icqdirect.moc verifydlg.moc icqlocation.moc icqicmb.moc aimsearch.moc icqpicture.moc icqclient.moc workinfo.moc moreinfo.moc icqsecure.moc advsearch.moc icqsearch.moc aimconfig.moc icqssbi.moc warndlg.moc
@echo 'creating icq_la.all_cpp.cpp ...'; \
rm -f icq_la.all_cpp.files icq_la.all_cpp.final; \
echo "#define KDE_USE_FINAL 1" >> icq_la.all_cpp.final; \
@@ -1327,7 +1341,7 @@
kde-rpo-clean:
-rm -f *.rpo
-#>+ 89
+#>+ 93
aiminfo.lo: aiminfo.moc
icqdirect.lo: icqdirect.moc
icqpicture.lo: icqpicture.moc
@@ -1341,6 +1355,7 @@
icqclient.lo: icqclient.moc
$(srcdir)/icqpicture.cpp: icqconfigbase.h icqinfobase.h homeinfobase.h moreinfobase.h workinfobase.h aboutinfobase.h interestsinfobase.h pastinfobase.h icqsecurebase.h icqsearchbase.h advsearchbase.h icqpicturebase.h securedlgbase.h aimconfigbase.h aiminfobase.h aimsearchbase.h warndlgbase.h encodingdlgbase.h verifydlgbase.h
aiminfo.o: aiminfo.moc
+icqicmb.lo: icqicmb.moc
$(srcdir)/icqlogin.cpp: icqconfigbase.h icqinfobase.h homeinfobase.h moreinfobase.h workinfobase.h aboutinfobase.h interestsinfobase.h pastinfobase.h icqsecurebase.h icqsearchbase.h advsearchbase.h icqpicturebase.h securedlgbase.h aimconfigbase.h aiminfobase.h aimsearchbase.h warndlgbase.h encodingdlgbase.h verifydlgbase.h
interestsinfo.o: interestsinfo.moc
$(srcdir)/icqclient.cpp: icqconfigbase.h icqinfobase.h homeinfobase.h moreinfobase.h workinfobase.h aboutinfobase.h interestsinfobase.h pastinfobase.h icqsecurebase.h icqsearchbase.h advsearchbase.h icqpicturebase.h securedlgbase.h aimconfigbase.h aiminfobase.h aimsearchbase.h warndlgbase.h encodingdlgbase.h verifydlgbase.h
@@ -1358,6 +1373,7 @@
$(srcdir)/advsearch.cpp: icqconfigbase.h icqinfobase.h homeinfobase.h moreinfobase.h workinfobase.h aboutinfobase.h interestsinfobase.h pastinfobase.h icqsecurebase.h icqsearchbase.h advsearchbase.h icqpicturebase.h securedlgbase.h aimconfigbase.h aiminfobase.h aimsearchbase.h warndlgbase.h encodingdlgbase.h verifydlgbase.h
moreinfo.o: moreinfo.moc
$(srcdir)/icqicmb.cpp: icqconfigbase.h icqinfobase.h homeinfobase.h moreinfobase.h workinfobase.h aboutinfobase.h interestsinfobase.h pastinfobase.h icqsecurebase.h icqsearchbase.h advsearchbase.h icqpicturebase.h securedlgbase.h aimconfigbase.h aiminfobase.h aimsearchbase.h warndlgbase.h encodingdlgbase.h verifydlgbase.h
+icqicmb.o: icqicmb.moc
$(srcdir)/rtf.ll: icqconfigbase.h icqinfobase.h homeinfobase.h moreinfobase.h workinfobase.h aboutinfobase.h interestsinfobase.h pastinfobase.h icqsecurebase.h icqsearchbase.h advsearchbase.h icqpicturebase.h securedlgbase.h aimconfigbase.h aiminfobase.h aimsearchbase.h warndlgbase.h encodingdlgbase.h verifydlgbase.h
icqssbi.lo: icqssbi.moc
polling.lo: polling.moc
@@ -1384,13 +1400,14 @@
$(srcdir)/icqinfo.cpp: icqconfigbase.h icqinfobase.h homeinfobase.h moreinfobase.h workinfobase.h aboutinfobase.h interestsinfobase.h pastinfobase.h icqsecurebase.h icqsearchbase.h advsearchbase.h icqpicturebase.h securedlgbase.h aimconfigbase.h aiminfobase.h aimsearchbase.h warndlgbase.h encodingdlgbase.h verifydlgbase.h
$(srcdir)/interestsinfo.cpp: icqconfigbase.h icqinfobase.h homeinfobase.h moreinfobase.h workinfobase.h aboutinfobase.h interestsinfobase.h pastinfobase.h icqsecurebase.h icqsearchbase.h advsearchbase.h icqpicturebase.h securedlgbase.h aimconfigbase.h aiminfobase.h aimsearchbase.h warndlgbase.h encodingdlgbase.h verifydlgbase.h
icqssbi.o: icqssbi.moc
-$(srcdir)/icq.cpp: icqconfigbase.h icqinfobase.h homeinfobase.h moreinfobase.h workinfobase.h aboutinfobase.h interestsinfobase.h pastinfobase.h icqsecurebase.h icqsearchbase.h advsearchbase.h icqpicturebase.h securedlgbase.h aimconfigbase.h aiminfobase.h aimsearchbase.h warndlgbase.h encodingdlgbase.h verifydlgbase.h
$(srcdir)/icqlocation.cpp: icqconfigbase.h icqinfobase.h homeinfobase.h moreinfobase.h workinfobase.h aboutinfobase.h interestsinfobase.h pastinfobase.h icqsecurebase.h icqsearchbase.h advsearchbase.h icqpicturebase.h securedlgbase.h aimconfigbase.h aiminfobase.h aimsearchbase.h warndlgbase.h encodingdlgbase.h verifydlgbase.h
+$(srcdir)/icq.cpp: icqconfigbase.h icqinfobase.h homeinfobase.h moreinfobase.h workinfobase.h aboutinfobase.h interestsinfobase.h pastinfobase.h icqsecurebase.h icqsearchbase.h advsearchbase.h icqpicturebase.h securedlgbase.h aimconfigbase.h aiminfobase.h aimsearchbase.h warndlgbase.h encodingdlgbase.h verifydlgbase.h
aboutinfo.o: aboutinfo.moc
icqsecure.lo: icqsecure.moc
$(srcdir)/icqservice.cpp: icqconfigbase.h icqinfobase.h homeinfobase.h moreinfobase.h workinfobase.h aboutinfobase.h interestsinfobase.h pastinfobase.h icqsecurebase.h icqsearchbase.h advsearchbase.h icqpicturebase.h securedlgbase.h aimconfigbase.h aiminfobase.h aimsearchbase.h warndlgbase.h encodingdlgbase.h verifydlgbase.h
securedlg.lo: securedlg.moc
interestsinfo.lo: interestsinfo.moc
+icqlocation.o: icqlocation.moc
icqpicture.o: icqpicture.moc
icqdirect.o: icqdirect.moc
$(srcdir)/workinfo.cpp: icqconfigbase.h icqinfobase.h homeinfobase.h moreinfobase.h workinfobase.h aboutinfobase.h interestsinfobase.h pastinfobase.h icqsecurebase.h icqsearchbase.h advsearchbase.h icqpicturebase.h securedlgbase.h aimconfigbase.h aiminfobase.h aimsearchbase.h warndlgbase.h encodingdlgbase.h verifydlgbase.h
@@ -1410,6 +1427,7 @@
nmcheck:
$(srcdir)/encodingdlg.cpp: icqconfigbase.h icqinfobase.h homeinfobase.h moreinfobase.h workinfobase.h aboutinfobase.h interestsinfobase.h pastinfobase.h icqsecurebase.h icqsearchbase.h advsearchbase.h icqpicturebase.h securedlgbase.h aimconfigbase.h aiminfobase.h aimsearchbase.h warndlgbase.h encodingdlgbase.h verifydlgbase.h
icqinfo.o: icqinfo.moc
+icqlocation.lo: icqlocation.moc
pastinfo.o: pastinfo.moc
polling.o: polling.moc
aimconfig.lo: aimconfig.moc
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/icq/icq.h
^
|
@@ -34,6 +34,7 @@
const unsigned long CmdIcqSendMessage = IcqCmdBase + 5;
const unsigned long CmdShowWarning = IcqCmdBase + 6;
const unsigned long CmdPasswordFail = IcqCmdBase + 7;
+const unsigned long CmdPasswordSuccess = IcqCmdBase + 8;
const unsigned long MenuSearchResult = IcqCmdBase;
const unsigned long MenuIcqGroups = IcqCmdBase + 2;
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/icq/icq.vcproj
^
|
@@ -1722,6 +1722,10 @@
>
</File>
<File
+ RelativePath=".\moc_icqicmb.cpp"
+ >
+ </File>
+ <File
RelativePath="moc_icqinfo.cpp"
>
<FileConfiguration
@@ -1766,6 +1770,10 @@
</FileConfiguration>
</File>
<File
+ RelativePath=".\moc_icqlocation.cpp"
+ >
+ </File>
+ <File
RelativePath="moc_icqpicture.cpp"
>
<FileConfiguration
@@ -2646,6 +2654,30 @@
</FileConfiguration>
</File>
<File
+ RelativePath=".\icqicmb.h"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Moc'ing $(InputName).h ..."
+ CommandLine="%qtdir%\bin\moc.exe $(InputDir)$(InputName).h -o $(InputDir)moc_$(InputName).cpp"
+ Outputs="$(InputDir)moc_$(InputName).cpp"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Moc'ing $(InputName).h ..."
+ CommandLine="%qtdir%\bin\moc.exe $(InputDir)$(InputName).h -o $(InputDir)moc_$(InputName).cpp"
+ Outputs="$(InputDir)moc_$(InputName).cpp"
+ />
+ </FileConfiguration>
+ </File>
+ <File
RelativePath="icqinfo.h"
>
<FileConfiguration
@@ -2668,6 +2700,30 @@
Outputs="$(InputDir)moc_$(InputName).cpp"
/>
</FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\icqlocation.h"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Moc'ing $(InputName).h ..."
+ CommandLine="%qtdir%\bin\moc.exe $(InputDir)$(InputName).h -o $(InputDir)moc_$(InputName).cpp"
+ Outputs="$(InputDir)moc_$(InputName).cpp"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Moc'ing $(InputName).h ..."
+ CommandLine="%qtdir%\bin\moc.exe $(InputDir)$(InputName).h -o $(InputDir)moc_$(InputName).cpp"
+ Outputs="$(InputDir)moc_$(InputName).cpp"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath="icqmessage.h"
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/icq/icqbuddy.cpp
^
|
@@ -73,7 +73,7 @@
{
}
-bool SnacIcqBuddy::process(unsigned short subtype, ICQBuffer* buf)
+bool SnacIcqBuddy::process(unsigned short subtype, ICQBuffer* buf, unsigned short seq)
{
switch (subtype)
{
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/icq/icqbuddy.h
^
|
@@ -12,7 +12,7 @@
SnacIcqBuddy(ICQClient* client);
virtual ~SnacIcqBuddy();
- virtual bool process(unsigned short subtype, ICQBuffer* buf);
+ virtual bool process(unsigned short subtype, ICQBuffer* buf, unsigned short seq);
void addBuddy(SIM::Contact *contact);
void removeBuddy(SIM::Contact *contact);
};
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/icq/icqclient.cpp
^
|
@@ -210,6 +210,7 @@
{ "UseHTTP", DATA_BOOL, 1, DATA(0) },
{ "AutoHTTP", DATA_BOOL, 1, DATA(0) },
{ "KeepAlive", DATA_BOOL, 1, DATA(1) },
+ { "MediaSense", DATA_BOOL, 1, DATA(1) },
{ "", DATA_STRUCT, sizeof(ICQUserData) / sizeof(Data), DATA(_icqUserData) },
{ NULL, DATA_UNKNOWN, 0, 0 }
};
@@ -234,10 +235,6 @@
m_listRequest = NULL;
data.owner.DCcookie.asULong() = rand();
m_bBirthday = false;
- m_sendTimer = new QTimer(this);
- connect(m_sendTimer, SIGNAL(timeout()), this, SLOT(sendTimeout()));
- m_processTimer = new QTimer(this);
- connect(m_processTimer, SIGNAL(timeout()), this, SLOT(processSendQueue()));
QString requests = getListRequests();
while (requests.length()){
QString req = getToken(requests, ';');
@@ -249,10 +246,15 @@
}
m_snacBuddy = new SnacIcqBuddy(this);
+ m_snacICBM = new SnacIcqICBM(this);
m_snacService = new SnacIcqService(this);
addSnacHandler(m_snacBuddy);
+ addSnacHandler(m_snacICBM);
addSnacHandler(m_snacService);
+ m_processTimer = new QTimer(this);
+ connect(m_processTimer, SIGNAL(timeout()), m_snacICBM, SLOT(processSendQueue()));
+
disconnected();
m_bFirstTry = false;
ContactList::ContactIterator it;
@@ -264,7 +266,9 @@
data->Alias.str() = contact->getName();
}
m_connectionLost = false;
-
+ m_ifChecker = new SIM::InterfaceChecker();
+ connect(m_ifChecker, SIGNAL(interfaceDown(QString)), this, SLOT(interfaceDown(QString)));
+ connect(m_ifChecker, SIGNAL(interfaceUp(QString)), this, SLOT(interfaceUp(QString)));
}
ICQClient::~ICQClient()
@@ -509,16 +513,16 @@
void ICQClient::setNewLevel(RateInfo &r)
{
- QDateTime now = QDateTime::currentDateTime();
- unsigned delta = 0;
- if (now.date() == r.m_lastSend.date())
- delta = r.m_lastSend.time().msecsTo(now.time());
- unsigned res = (((r.m_winSize - 1) * r.m_curLevel) + delta) / r.m_winSize;
- if (res > r.m_maxLevel)
- res = r.m_maxLevel;
- r.m_curLevel = res;
- r.m_lastSend = now;
- log(L_DEBUG, "Level: %04X [%04X %04X]", res, r.m_minLevel, r.m_winSize);
+ QDateTime now = QDateTime::currentDateTime();
+ unsigned delta = 0;
+ if (now.date() == r.m_lastSend.date())
+ delta = r.m_lastSend.time().msecsTo(now.time());
+ unsigned res = (((r.m_winSize - 1) * r.m_curLevel) + delta) / 4 * r.m_winSize;
+ if (res > r.m_maxLevel)
+ res = r.m_maxLevel;
+ r.m_curLevel = res;
+ r.m_lastSend = now;
+ log(L_DEBUG, "Level: %04X [%04X %04X]", res, r.m_minLevel, r.m_winSize);
}
RateInfo *ICQClient::rateInfo(unsigned snac)
@@ -533,7 +537,9 @@
{
RateInfo *r = rateInfo(snac);
if (r == NULL)
+ {
return 0;
+ }
return delayTime(*r);
}
@@ -619,12 +625,12 @@
{
m_rates.clear();
m_rate_grp.clear();
- m_sendTimer->stop();
+ snacICBM()->getSendTimer()->stop();
m_processTimer->stop();
clearServerRequests();
clearListServerRequest();
clearSMSQueue();
- clearMsgQueue();
+ snacICBM()->clearMsgQueue();
buddies.clear();
Contact *contact;
ContactList::ContactIterator it;
@@ -664,7 +670,6 @@
delete m_listener;
m_listener = NULL;
}
- m_nFlapSequence = 8984;
}
const char *icq_error_codes[] = {I18N_NOOP("Unknown error"),
@@ -763,18 +768,9 @@
socket()->readBuffer().decReadPos(sizeof(unsigned short));
}
switch (food){
- //case ICQ_SNACxFOOD_SERVICE:
- // snac_service(type, seq);
- // break;
case ICQ_SNACxFOOD_LOCATION:
snac_location(type, seq);
break;
- //case ICQ_SNACxFOOD_BUDDY:
- // snac_buddy(type, seq);
- // break;
- case ICQ_SNACxFOOD_MESSAGE:
- snac_icmb(type, seq);
- break;
case ICQ_SNACxFOOD_BOS:
snac_bos(type, seq);
break;
@@ -804,7 +800,7 @@
b.setReadPos(0);
b.setWritePos(size - unknown_length);
socket()->readBuffer().unpack(b.data(), size - unknown_length);
- it->second->process(type, &b);
+ it->second->process(type, &b, seq);
}
}
}
@@ -960,6 +956,24 @@
return status;
}
+void ICQClient::interfaceDown(QString ifname)
+{
+ log(L_DEBUG, "icq: interface down: %s", ifname.utf8().data());
+}
+
+void ICQClient::interfaceUp(QString ifname)
+{
+ if(getMediaSense())
+ {
+ log(L_DEBUG, "icq: interface up: %s", ifname.utf8().data());
+ if(m_connectionLost)
+ {
+ // Try to connect
+ setStatus(STATUS_ONLINE, false);
+ }
+ }
+}
+
ICQUserData *ICQClient::findContact(unsigned long l, const QString *alias, bool bCreate, Contact *&contact, Group *grp, bool bJoin)
{
return findContact(QString::number(l), alias, bCreate, contact, grp, bJoin);
@@ -1027,7 +1041,7 @@
data->Screen.str() = s;
bool bChanged = false;
if (alias){
- if (*alias){
+ if (!alias->isEmpty()){
bChanged = contact->setName(*alias);
}
data->Alias.str() = *alias;
@@ -1131,7 +1145,7 @@
for (list<Message*>::iterator it = m_acceptMsg.begin(); it != m_acceptMsg.end(); ){
Message *msg = *it; //will sometimes not work, content: it is broken then: 0xcdcdcdcd, reason seems to be Filetransfer.. however..
- if (msg->client() && (name == msg->client())){
+ if (!msg->client().isEmpty() && (name == msg->client())){
EventMessageDeleted(msg).process();
delete msg;
m_acceptMsg.erase(it);
@@ -1222,7 +1236,7 @@
}
}
}
- if (dicon == NULL)
+ if (dicon.isEmpty())
return;
if (status == STATUS_OCCUPIED)
status = STATUS_DND;
@@ -1326,7 +1340,7 @@
sendPacket(false);
}
}
- processSendQueue();
+ snacICBM()->processSendQueue();
checkListRequest();
checkInfoRequest();
QTimer::singleShot(PING_TIMEOUT * 1000, this, SLOT(ping()));
@@ -1370,7 +1384,7 @@
phones += ",Private Cellular,";
phones += QString::number(CELLULAR);
}
- if (!data->PhoneBook.str()){
+ if (data->PhoneBook.str().isEmpty()){
if (phones.length())
phones += ';';
phones += data->PhoneBook.str();
@@ -2401,7 +2415,7 @@
if ((*it)->id() == ema->msg()->id()){
Message *msg = *it;
m_acceptMsg.erase(it);
- accept(msg, ema->dir(), ema->mode());
+ snacICBM()->accept(msg, ema->dir(), ema->mode());
return msg;
}
}
@@ -2413,7 +2427,7 @@
if ((*it)->id() == emd->msg()->id()){
Message *msg = *it;
m_acceptMsg.erase(it);
- decline(msg, emd->reason());
+ snacICBM()->decline(msg, emd->reason());
return msg;
}
}
@@ -2459,10 +2473,10 @@
setAwayMessage(t->tmpl);
}else{
sendCapability(t->tmpl);
- sendICMB(1, 11);
- sendICMB(2, 3);
- sendICMB(4, 3);
- processSendQueue();
+ m_snacICBM->sendICMB(1, 11);
+ m_snacICBM->sendICMB(2, 3);
+ m_snacICBM->sendICMB(4, 3);
+ snacICBM()->processSendQueue();
fetchProfiles();
}
}
@@ -2484,7 +2498,7 @@
}
}else{
ICQBuffer copy;
- sendAutoReply(ar.screen, ar.id, plugins[PLUGIN_NULL],
+ snacICBM()->sendAutoReply(ar.screen, ar.id, plugins[PLUGIN_NULL],
ar.id1, ar.id2, ar.type, (char)(ar.ack), 0, t->tmpl, 0, copy);
}
arRequests.erase(it);
@@ -2518,7 +2532,7 @@
lr.invisible_id = (unsigned short)(data->ContactInvisibleId.toULong());
lr.ignore_id = (unsigned short)(data->IgnoreId.toULong());
listRequests.push_back(lr);
- processSendQueue();
+ snacICBM()->processSendQueue();
}
//m_snacBuddy->removeBuddy(contact);
break;
@@ -2534,11 +2548,13 @@
data.owner.PluginInfoTime.asULong() = now;
snacService()->sendPluginInfoUpdate(PLUGIN_PHONEBOOK);
}
+ /*
if (getPicture() != data.owner.Picture.str()){
data.owner.Picture.str() = getPicture();
data.owner.PluginInfoTime.asULong() = now;
snacService()->sendPluginInfoUpdate(PLUGIN_PICTURE);
}
+ */
if (getContacts()->owner()->getPhoneStatus() != data.owner.FollowMe.toULong()){
data.owner.FollowMe.asULong() = getContacts()->owner()->getPhoneStatus();
data.owner.PluginStatusTime.asULong() = now;
@@ -2578,7 +2594,7 @@
lr.type = LIST_GROUP_DELETED;
lr.icq_id = (unsigned short)(data->IcqID.toULong());
listRequests.push_back(lr);
- processSendQueue();
+ snacICBM()->processSendQueue();
}
break;
}
@@ -2590,68 +2606,7 @@
case eEventMessageCancel: {
EventMessage *em = static_cast<EventMessage*>(e);
Message *msg = em->msg();
- list<Message*>::iterator it;
- for (it = m_processMsg.begin(); it != m_processMsg.end(); ++it)
- if (*it == msg)
- break;
- if (it != m_processMsg.end())
- {
- m_processMsg.erase(it);
- delete msg;
- return true;
- }
- if (msg->type() == MessageSMS){
- for (list<SendMsg>::iterator it = smsQueue.begin(); it != smsQueue.end(); ++it){
- if ((*it).msg == msg){
- if (it == smsQueue.begin()){
- (*it).text = QString::null;
- }else{
- smsQueue.erase(it);
- }
- return msg;
- }
- }
- }else{
- Contact *contact = getContacts()->contact(msg->contact());
- if (contact){
- ICQUserData *data;
- ClientDataIterator it(contact->clientData, this);
- while ((data = toICQUserData(++it)) != NULL){
- DirectClient *dc = dynamic_cast<DirectClient*>(data->Direct.object());
- if (dc && dc->cancelMessage(msg))
- return msg;
- }
- }
- if (m_send.msg == msg){
- m_send.msg = NULL;
- m_send.screen = QString::null;
- m_sendTimer->stop();
- processSendQueue();
- return msg;
- }
- list<SendMsg>::iterator it;
- for (it = sendFgQueue.begin(); it != sendFgQueue.end(); ++it){
- if ((*it).msg == msg){
- sendFgQueue.erase(it);
- delete msg;
- return msg;
- }
- }
- for (it = sendBgQueue.begin(); it != sendBgQueue.end(); ++it){
- if ((*it).msg == msg){
- sendBgQueue.erase(it);
- delete msg;
- return msg;
- }
- }
- for (it = replyQueue.begin(); it != replyQueue.end(); ++it){
- if ((*it).msg == msg){
- replyQueue.erase(it);
- delete msg;
- return msg;
- }
- }
- }
+ return snacICBM()->cancelMessage(msg);
break;
}
case eEventCheckCommandState: {
@@ -2839,18 +2794,21 @@
}
case eEventInterfaceDown:
{
- setState(Error, "Interface down");
- setStatus(STATUS_OFFLINE, false);
- m_connectionLost = true;
- break;
- }
- case eEventInterfaceUp:
- {
- if(m_connectionLost)
+ if(getMediaSense())
{
- setState(Connecting);
- setStatus(STATUS_ONLINE, false);
- m_connectionLost = false;
+ EventInterfaceDown* ev = static_cast<EventInterfaceDown*>(e);
+ if(socket() != NULL)
+ {
+ if(socket()->socket() != NULL)
+ {
+ if(ev->getFd() == socket()->socket()->getFd())
+ {
+ setState(Error, "Interface down");
+ setStatus(STATUS_OFFLINE, false);
+ m_connectionLost = true;
+ }
+ }
+ }
}
break;
}
@@ -2869,7 +2827,7 @@
return false;
ICQUserData *data = NULL;
ClientDataIterator it(contact->clientData, this);
- if (client){
+ if (!client.isEmpty()){
while ((data = toICQUserData(++it)) != NULL){
if (dataName(data) == client)
break;
@@ -2941,8 +2899,7 @@
s.msg = static_cast<SMSMessage*>(msg);
s.text = s.msg->getPlainText();
s.flags = SEND_1STPART;
- smsQueue.push_back(s);
- processSMSQueue();
+ snacICBM()->sendSMS(s);
return true;
case MessageAuthRequest:
if (data && data->WaitAuth.toBool())
@@ -2962,7 +2919,7 @@
log(L_DEBUG, "send: MessageFile");
if (!hasCap(data, CAP_AIM_SENDFILE))
return false;
- sendThruServer(msg, data);
+ snacICBM()->sendThruServer(msg, data);
return true;
}
return false;
@@ -2981,7 +2938,7 @@
}
if (!hasCap(data, CAP_TYPING) && !hasCap(data, CAP_AIM_BUDDYCON))
return false;
- sendMTN(screen(data), msg->type() == MessageTypingStart ? ICQ_MTN_START : ICQ_MTN_FINISH);
+ snacICBM()->sendMTN(screen(data), msg->type() == MessageTypingStart ? ICQ_MTN_START : ICQ_MTN_FINISH);
delete msg;
return true;
#ifdef ENABLE_OPENSSL
@@ -3008,7 +2965,7 @@
}
#endif
case MessageWarning:
- return sendThruServer(msg, data);
+ return snacICBM()->sendThruServer(msg, data);
case MessageContacts:
if ((data == NULL) || ((data->Uin.toULong() == 0) && !hasCap(data, CAP_AIM_BUDDYLIST)))
return false;
@@ -3040,7 +2997,7 @@
if (dc)
return dc->sendMessage(msg);
}
- return sendThruServer(msg, data);
+ return snacICBM()->sendThruServer(msg, data);
}
bool ICQClient::canSend(unsigned type, void *_data)
@@ -3203,6 +3160,7 @@
void ICQClient::addPluginInfoRequest(unsigned long uin, unsigned plugin_index)
{
+ log(L_DEBUG, "ICQClient::addPluginInfoRequest");
Contact *contact;
ICQUserData *data = findContact(uin, NULL, false, contact);
if (data && !data->bNoDirect.toBool() &&
@@ -3260,19 +3218,7 @@
}
}
}
- list<SendMsg>::iterator it;
- for (it = sendBgQueue.begin(); it != sendBgQueue.end(); ++it){
- SendMsg &s = *it;
- if ((s.screen.toULong() == uin) && (s.flags == plugin_index) && (s.msg == NULL))
- break;
- }
- if (it != sendBgQueue.end())
- return;
- SendMsg s;
- s.screen = QString::number(uin);
- s.flags = plugin_index;
- sendBgQueue.push_back(s);
- processSendQueue();
+ snacICBM()->pluginInfoRequest(uin, plugin_index);
}
void ICQClient::randomChatInfo(unsigned long uin)
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/icq/icqclient.h
^
|
@@ -27,6 +27,7 @@
#include "snac.h"
#include "icqbuddy.h"
#include "icqservice.h"
+#include "icqicmb.h"
#include "socket.h"
#include "icq.h"
@@ -294,6 +295,7 @@
SIM::Data UseHTTP;
SIM::Data AutoHTTP;
SIM::Data KeepAlive;
+ SIM::Data MediaSense;
ICQUserData owner;
};
@@ -420,27 +422,6 @@
class ListServerRequest;
class QTextCodec;
-struct MessageId
-{
- unsigned long id_l;
- unsigned long id_h;
- MessageId() : id_l(0), id_h(0) {}
-};
-
-bool operator == (const MessageId &m1, const MessageId &m2);
-
-struct SendMsg
-{
- QString screen;
- MessageId id;
- SIM::Message *msg;
- QString text;
- QString part;
- unsigned flags;
- DirectSocket *socket;
- SendMsg() : msg(NULL), socket(NULL) {}
-};
-
const unsigned SEND_PLAIN = 0x0001;
const unsigned SEND_UTF = 0x0002;
const unsigned SEND_RTF = 0x0003;
@@ -476,8 +457,8 @@
virtual ~OscarSocket();
void snac(unsigned short food, unsigned short type, bool msgId=false, bool bType=true);
+ void sendPacket(bool bSend = true);
protected:
- void sendPacket(bool bSend=true);
virtual ICQClientSocket *socket() = 0;
virtual void packet(unsigned long size) = 0;
void flap(char channel);
@@ -560,6 +541,7 @@
PROP_BOOL(UseHTTP);
PROP_BOOL(AutoHTTP);
PROP_BOOL(KeepAlive);
+ PROP_BOOL(MediaSense);
ICQClientData data;
// reimplement socket() to get correct Buffer
virtual ICQClientSocket *socket() { return static_cast<ICQClientSocket*>(TCPClient::socket()); }
@@ -596,10 +578,9 @@
const QString &maiden, const QString &country, const QString &street,
const QString &city, const QString &nick, const QString &zip,
const QString &state);
- void requestReverseConnection(const QString &screen, DirectSocket *socket);
- void accept(SIM::Message *msg, ICQUserData *data);
SIM::Message *parseMessage(unsigned short type, const QString &screen,
const QCString &p, ICQBuffer &packet, MessageId &id, unsigned cookie);
+ void sendPacket(bool bSend);
bool messageReceived(SIM::Message*, const QString &screen);
static bool parseRTF(const QCString &str, SIM::Contact *contact, QString &result);
static QString pictureFile(const ICQUserData *data);
@@ -623,32 +604,32 @@
void clearSnacHandlers();
// ICBM:
- void sendThroughServer(const QString &screen, unsigned short type, ICQBuffer &b, const MessageId &id, bool bOffline, bool bReqAck);
void deleteFileMessage(MessageId const& cookie);
- void icmbSendFile(TlvList& tlv, unsigned long primary_ip, unsigned long secondary_ip, unsigned short port,const QString &screen, MessageId const& id);
// SSI:
void ssiStartTransaction();
void ssiEndTransaction();
+ bool isSSITransaction(){return false;}
unsigned short ssiAddBuddy(QString& screen, unsigned short group_id, unsigned short buddy_id, unsigned short buddy_type, TlvList* tlvs);
+ unsigned short ssiModifyBuddy(const QString& name, unsigned short grp_id, unsigned short usr_id, unsigned short subCmd, TlvList* tlv);
unsigned short ssiDeleteBuddy(QString& screen, unsigned short group_id, unsigned short buddy_id, unsigned short buddy_type, TlvList* tlvs);
void getGroupIDs(unsigned short group_id, ICQBuffer* buf); // hack
unsigned short ssiAddToGroup(QString& groupname, unsigned short buddy_id, unsigned short group_id);
unsigned short ssiRemoveFromGroup(QString& groupname, unsigned short buddy_id, unsigned short group_id);
TlvList *createListTlv(ICQUserData *data, SIM::Contact *contact);
-
+
// Snac handlers accessors
SnacIcqService* snacService() { return m_snacService; }
SnacIcqBuddy* snacBuddy() { return m_snacBuddy; }
+ SnacIcqICBM* snacICBM() { return m_snacICBM; }
protected slots:
void ping();
- void processSendQueue();
- void sendTimeout();
void retry(int n, void*);
+ void interfaceDown(QString);
+ void interfaceUp(QString);
protected:
void generateCookie(MessageId& id);
- void sendPacket(bool bSend);
virtual void setInvisible(bool bState);
virtual void setStatus(unsigned status, bool bCommon);
virtual void setStatus(unsigned status);
@@ -674,7 +655,6 @@
QByteArray m_cookie;
virtual void packet(unsigned long size);
void snac_location(unsigned short, unsigned short);
- void snac_icmb(unsigned short, unsigned short);
void snac_bos(unsigned short, unsigned short);
void snac_ping(unsigned short, unsigned short);
void snac_lists(unsigned short, unsigned short);
@@ -687,11 +667,9 @@
void listsRequest();
void locationRequest();
void buddyRequest();
- void icmbRequest();
void bosRequest();
void addCapability(ICQBuffer &cap, cap_id_t id); // helper for sendCapability()
void sendCapability(const QString &msg=QString::null);
- void sendICMB(unsigned short channel, unsigned long flags);
void sendMessageRequest();
void serverRequest(unsigned short cmd, unsigned short seq=0);
void sendServerRequest();
@@ -708,7 +686,6 @@
bool m_bVerifying;
ICQListener *m_listener;
QTimer *m_processTimer;
- QTimer *m_sendTimer;
unsigned short m_sendSmsId;
unsigned short m_offlineMessagesRequestId;
ListServerRequest *m_listRequest;
@@ -719,10 +696,6 @@
std::list<InfoRequest> infoRequests;
QStringList buddies;
std::list<ListRequest> listRequests;
- std::list<SendMsg> smsQueue;
- std::list<SendMsg> sendFgQueue;
- std::list<SendMsg> sendBgQueue;
- std::list<SendMsg> replyQueue;
std::list<ar_request> arRequests;
void addGroupRequest(SIM::Group *group);
void addContactRequest(SIM::Contact *contact);
@@ -732,7 +705,6 @@
void clearServerRequests();
void clearListServerRequest();
void clearSMSQueue();
- void clearMsgQueue();
unsigned processListRequest();
unsigned processSMSQueue();
unsigned processInfoRequest();
@@ -746,7 +718,6 @@
unsigned short subCmd=0, TlvList *tlv = NULL);
void sendRosterGrp(const QString &name, unsigned short grpId, unsigned short usrId);
bool isContactRenamed(ICQUserData *data, SIM::Contact *contact);
- bool sendThruServer(SIM::Message *msg, void *data);
QString getUserCellular(SIM::Contact *contact);
void setMainInfo(ICQUserData *d);
void setAIMInfo(ICQUserData *data);
@@ -756,29 +727,17 @@
QString packContacts(SIM::ContactsMessage *msg, ICQUserData *data, CONTACTS_MAP &c);
QCString createRTF(QString &text, QString &part, unsigned long foreColor, SIM::Contact *contact, unsigned max_size);
QString removeImages(const QString &text, bool icqSmiles);
- void ackMessage(SendMsg &s);
- void accept(SIM::Message *msg, const QString &dir, SIM::OverwriteMode overwrite);
- void decline(SIM::Message *msg, const QString &reason);
bool sendAuthRequest(SIM::Message *msg, void *data);
bool sendAuthGranted(SIM::Message *msg, void *data);
bool sendAuthRefused(SIM::Message *msg, void *data);
- void sendAdvMessage(const QString &screen, ICQBuffer &msgText, unsigned plugin_index, const MessageId &id, bool bOffline, bool bDirect, unsigned short cookie1=0, unsigned short cookie2=0, unsigned short type=1);
- void sendType2(const QString &screen, ICQBuffer &msgBuf, const MessageId &id, unsigned cap, bool bOffline, unsigned short port, TlvList *tlvs=NULL, unsigned short type=1);
- void sendType1(const QString &text, bool bWide, ICQUserData *data);
void parseAdvancedMessage(const QString &screen, ICQBuffer &msg, bool needAck, MessageId id);
- void sendAutoReply(const QString &screen, MessageId id,
- const plugin p, unsigned short cookie1, unsigned short cookie2,
- unsigned short msgType, char msgFlags, unsigned short msgState,
- const QString &response, unsigned short response_type, ICQBuffer ©);
void addPluginInfoRequest(unsigned long uin, unsigned plugin_index);
- void sendMTN(const QString &screen, unsigned short type);
void setChatGroup();
SIM::Message *parseExtendedMessage(const QString &screen, ICQBuffer &packet, MessageId &id, unsigned cookie);
void parsePluginPacket(ICQBuffer &b, unsigned plugin_index, ICQUserData *data, unsigned uin, bool bDirect);
void pluginAnswer(unsigned plugin_type, unsigned long uin, ICQBuffer &b);
void packMessage(ICQBuffer &b, SIM::Message *msg, ICQUserData *data, unsigned short &type, bool bDirect, unsigned short flags=ICQ_TCPxMSG_NORMAL);
void packExtendedMessage(SIM::Message *msg, ICQBuffer &buf, ICQBuffer &msgBuf, ICQUserData *data);
- bool ackMessage(SIM::Message *msg, unsigned short ackFlags, const QCString &str);
void fetchProfile(ICQUserData *data);
void fetchAwayMessage(ICQUserData *data);
void fetchProfiles();
@@ -799,7 +758,6 @@
bool m_bFirstTry;
bool m_bHTTP;
bool m_bReady;
- SendMsg m_send;
std::vector<RateInfo> m_rates;
RATE_MAP m_rate_grp;
void setNewLevel(RateInfo &r);
@@ -812,6 +770,7 @@
std::list<AIMFileTransfer*> m_filetransfers;
SnacIcqBuddy* m_snacBuddy;
SnacIcqService* m_snacService;
+ SnacIcqICBM* m_snacICBM;
mapSnacHandlers m_snacHandlers;
bool m_connectionLost;
@@ -826,9 +785,14 @@
friend class ICQFileTransfer;
friend class SetBuddyRequest;
friend class SSBISocket;
-
+
+ // This should be removed when refactoring is over
friend class SnacIcqBuddy;
friend class SnacIcqService;
+ friend class SnacIcqICBM;
+
+private:
+ SIM::InterfaceChecker* m_ifChecker;
};
class ServiceSocket : public SIM::ClientSocketNotify, public OscarSocket
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/icq/icqconfig.cpp
^
|
@@ -52,7 +52,7 @@
}else{
chkNew->setChecked(true);
}
- edtUin->setValidator(new QIntValidator(1000, 0x1FFFFFFF, edtUin));
+ edtUin->setValidator(new QIntValidator(1000, 0x7FFFFFFF, edtUin)); //FIXME: we will have to do something when UIN is grater than signed int
connect(edtUin, SIGNAL(textChanged(const QString&)), this, SLOT(changed(const QString&)));
connect(edtPasswd, SIGNAL(textChanged(const QString&)), this, SLOT(changed(const QString&)));
}else{
@@ -83,6 +83,7 @@
connect(chkInvisible, SIGNAL(toggled(bool)), this, SLOT(invisibleToggled(bool)));
chkAuto->setChecked(client->getAutoHTTP());
chkKeepAlive->setChecked(client->getKeepAlive());
+ chkMediaSense->setChecked(client->getMediaSense());
cmbAck->setCurrentItem(client->getAckMode());
}
@@ -123,6 +124,7 @@
m_client->setAutoHTTP(chkAuto->isChecked());
m_client->setKeepAlive(chkKeepAlive->isChecked());
m_client->setAckMode(cmbAck->currentItem());
+ m_client->setMediaSense(chkMediaSense->isChecked());
}
void ICQConfig::changed(const QString&)
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/icq/icqconfigbase.ui
^
|
@@ -197,7 +197,7 @@
<string>Use &HTTP polling</string>
</property>
</widget>
- <widget row="6" column="0" rowspan="1" colspan="3" >
+ <widget row="7" column="0" rowspan="1" colspan="3" >
<class>Line</class>
<property stdset="1">
<name>name</name>
@@ -305,7 +305,7 @@
</size>
</property>
</spacer>
- <widget row="7" column="0" rowspan="1" colspan="3" >
+ <widget row="8" column="0" rowspan="1" colspan="3" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
@@ -431,6 +431,17 @@
<string>&Keep-alive connection</string>
</property>
</widget>
+ <widget row="6" column="0" rowspan="1" colspan="3" >
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>chkMediaSense</cstring>
+ </property>
+ <property>
+ <name>text</name>
+ <string>Activate Network &Media Sense</string>
+ </property>
+ </widget>
</grid>
</widget>
<widget>
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/icq/icqdirect.cpp
^
|
@@ -884,7 +884,7 @@
unsigned flags = msg->getFlags() | MESSAGE_DIRECT;
if (isSecure())
flags |= MESSAGE_SECURE;
- if (m_client->ackMessage(msg, ackFlags, msg_str)){
+ if (m_client->snacICBM()->ackMessage(msg, ackFlags, msg_str)){
if ((msg->getFlags() & MESSAGE_NOHISTORY) == 0){
if (msg->type() == MessageGeneric){
Message m; //Fixme: Local declaration of 'm' hides declaration of the same name in outer scope, see previous declaration at line '842'
@@ -919,7 +919,7 @@
QString name = m_client->dataName(m_data);
Message *msg = *it;
if ((msg->getFlags() & MESSAGE_DIRECT) &&
- msg->client() && (name == msg->client())){
+ !msg->client().isEmpty() && (name == msg->client())){
bool bFound = false;
switch (msg->type()){
case MessageICQFile:
@@ -1061,7 +1061,7 @@
for (QValueList<SendDirectMsg>::iterator it = m_queue.begin(); it != m_queue.end(); ++it){
SendDirectMsg &sm = *it;
if (sm.msg){
- if (!m_client->sendThruServer(sm.msg, m_data)){
+ if (!m_client->snacICBM()->sendThruServer(sm.msg, m_data)){
sm.msg->setError(err);
EventMessageSent(sm.msg).process();
delete sm.msg;
@@ -1752,12 +1752,12 @@
{
m_localPort = port;
if (m_state == WaitReverse){
- m_client->requestReverseConnection(m_client->screen(m_data), this);
+ m_client->snacICBM()->requestReverseConnection(m_client->screen(m_data), this);
return;
}
m_state = Listen;
static_cast<ICQFileMessage*>(m_msg)->setPort(port);
- m_client->accept(m_msg, m_data);
+ m_client->snacICBM()->accept(m_msg, m_data);
}
void ICQFileTransfer::login_timeout()
@@ -2116,7 +2116,7 @@
{
b.tlv(0x2712, charset.ascii(), charset.length());
}
- m_client->sendThroughServer(m_client->screen(m_data), 2, b, m_cookie, false, true);
+ m_client->snacICBM()->sendThroughServer(m_client->screen(m_data), 2, b, m_cookie, false, true);
}
void AIMFileTransfer::accept()
@@ -2434,6 +2434,11 @@
connect_timeout();
return false;
}
+ else if(m_stage == 2)
+ {
+ // It can occur, so skip this stage, and wait for proxy FT request from the other peer
+ return false;
+ }
return true;
}
@@ -2470,11 +2475,6 @@
m_stage++;
requestFT();
m_state = ProxyConnection;
- /*
- m_proxy = true;
- setProxyActive(true);
- connectThroughProxy(AOL_PROXY_HOST, AOL_PROXY_PORT, 0);
- */
// TODO Here we should really open the socket and wait for incoming connection,
// but we'll cheat for now - skip this step and wait for request for proxy transfer
}
@@ -2496,7 +2496,7 @@
ICQBuffer buf;
buf << 0x0002 << m_cookie.id_l << m_cookie.id_h;
buf.pack(m_client->capabilities[CAP_AIM_SENDFILE], 0x10);
- m_client->sendThroughServer(m_client->screen(m_data), 0x0002, buf, m_cookie, false, true);
+ m_client->snacICBM()->sendThroughServer(m_client->screen(m_data), 0x0002, buf, m_cookie, false, true);
FileTransfer::m_state = FileTransfer::Negotiation;
if(m_notify)
@@ -2551,7 +2551,7 @@
buf << (unsigned short) 0x0002 << m_cookie.id_l << m_cookie.id_h;
buf.pack(m_client->capabilities[CAP_AIM_SENDFILE], 0x10);
- m_client->sendThroughServer(m_client->screen(m_data), 0x0002, buf, m_cookie, false, true);
+ m_client->snacICBM()->sendThroughServer(m_client->screen(m_data), 0x0002, buf, m_cookie, false, true);
FileTransfer::m_state = FileTransfer::Negotiation;
if(m_notify)
m_notify->process();
@@ -2605,7 +2605,7 @@
if(m_file)
m_file->flush();
- m_client->sendThroughServer(m_client->screen(m_data), 0x0002, buf, m_cookie, false, true);
+ m_client->snacICBM()->sendThroughServer(m_client->screen(m_data), 0x0002, buf, m_cookie, false, true);
m_state = Done;
}
else
@@ -2851,7 +2851,7 @@
buf << (unsigned short) 0x0002 << m_cookie.id_l << m_cookie.id_h;
buf.pack(m_client->capabilities[CAP_AIM_SENDFILE], 0x10);
- m_client->sendThroughServer(m_client->screen(m_data), 0x0002, buf, m_cookie, false, true);
+ m_client->snacICBM()->sendThroughServer(m_client->screen(m_data), 0x0002, buf, m_cookie, false, true);
}
m_socket->readBuffer().incReadPos(packet_length - 4);
FileTransfer::m_state = FileTransfer::Negotiation;
@@ -2930,6 +2930,7 @@
FileTransfer::m_state = FileTransfer::Done;
m_socket->close();
m_socket->error_state(QString::null);
+ EventSent(m_msg).process();
if(m_notify)
{
m_notify->transfer(false);
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/icq/icqdirect.h
^
|
@@ -65,6 +65,7 @@
void forceProxyConnection() { m_proxy = true;}
void requestFT();
+ virtual void connectThroughProxy(const QString& host, uint16_t port, uint16_t cookie2);
virtual tTransferDirection getDirection() = 0;
static const unsigned long OFT_magic = 0x3254464f;
@@ -85,7 +86,6 @@
virtual void startReceive(unsigned pos);
virtual void bind_ready(unsigned short port);
virtual bool error(const QString &err);
- virtual void connectThroughProxy(const QString& host, uint16_t port, uint16_t cookie2);
void negotiateWithProxy();
bool readOFT(OftData* oft);
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/icq/icqicmb.cpp
^
|
@@ -35,10 +35,12 @@
#include <qimage.h>
#include <qregexp.h>
+#include "contacts.h"
#include "html.h"
#include "unquot.h"
#include "log.h"
#include "core_events.h"
+#include "misc.h"
#include "icqclient.h"
#include "icqmessage.h"
@@ -70,546 +72,84 @@
const unsigned short ICQ_SNACxMSG_ACK = 0x000C;
const unsigned short ICQ_SNACxMSG_MTN = 0x0014;
-void ICQClient::snac_icmb(unsigned short type, unsigned short seq)
+static void copyTlv(ICQBuffer &b, TlvList *tlvs, unsigned nTlv)
{
- switch (type){
- case ICQ_SNACxMSG_RIGHTSxGRANTED:
- log(L_DEBUG, "Message rights granted");
- break;
- case ICQ_SNACxMSG_MTN:{
- socket()->readBuffer().incReadPos(10);
- QString screen = socket()->readBuffer().unpackScreen();
- unsigned short type; //Fixme!!! Local declaration of 'type' hides declaration of the same name in outer scope: Function parameter "type"
- socket()->readBuffer() >> type;
- bool bType = (type > 1);
- Contact *contact;
- ICQUserData *data = findContact(screen, NULL, false, contact);
- if (data == NULL)
- break;
- if (data->bTyping.toBool() == bType)
- break;
- data->bTyping.asBool() = bType;
- EventContact e(contact, EventContact::eStatus);;
- e.process();
- break;
- }
- case ICQ_SNACxMSG_ERROR:{
- if (seq == 0)
- break;
- unsigned short error;
- socket()->readBuffer() >> error;
- QString err_str = I18N_NOOP("Unknown error");
- if ((error == 0x0009) && ((m_send.msg == NULL) || (m_send.msg->type() != MessageContacts))){
- err_str = I18N_NOOP("Not supported by client");
- Contact *contact;
- ICQUserData *data = findContact(m_send.screen, NULL, false, contact);
- if (data){
- list<SendMsg>::iterator it;
- for (it = sendFgQueue.begin(); it != sendFgQueue.end();){
- if ((*it).screen != m_send.screen){
- ++it;
- continue;
- }
- if ((*it).msg){
- (*it).flags = 0;
- ++it;
- continue;
- }
- sendFgQueue.erase(it);
- it = sendFgQueue.begin();
- }
- for (it = sendBgQueue.begin(); it != sendBgQueue.end();){
- if ((*it).screen != m_send.screen){
- ++it;
- continue;
- }
- if ((*it).msg){
- (*it).flags = 0;
- ++it;
- continue;
- }
- sendBgQueue.erase(it);
- it = sendBgQueue.begin();
- }
- data->bBadClient.asBool() = true;
- if (m_send.msg)
- sendThruServer(m_send.msg, data);
- m_send.msg = NULL;
- m_send.screen = QString::null;
- m_sendTimer->stop();
- processSendQueue();
- break;
- }
- }else{
- err_str = error_message(error);
- }
- if(error == 2)
- m_snacService->requestRateInfo();
- if (m_send.msg){
- m_send.msg->setError(err_str);
- EventMessageSent(m_send.msg).process();
- delete m_send.msg;
- }
- m_send.msg = NULL;
- m_send.screen = QString::null;
- m_sendTimer->stop();
- processSendQueue();
- break;
- }
- case ICQ_SNACxMSG_SRV_MISSED_MSG: {
- unsigned short mFormat; // missed channel
- QString screen; // screen
- unsigned short wrnLevel;// warning level
- unsigned short nTlv; // number of tlvs
- TlvList lTlv; // all tlvs in message
- unsigned short missed; // number of missed messages
- unsigned short error; // error reason
- socket()->readBuffer() >> mFormat;
- screen = socket()->readBuffer().unpackScreen();
- socket()->readBuffer() >> wrnLevel;
- socket()->readBuffer() >> nTlv;
- for(unsigned i = 0; i < nTlv; i++) {
- unsigned short num;
- unsigned short size;
- const char* data;
- socket()->readBuffer() >> num >> size;
- data = socket()->readBuffer().data(socket()->readBuffer().readPos());
- Tlv* tlv = new Tlv(num,size,data);
- lTlv += tlv;
- }
- socket()->readBuffer() >> missed >> error;
- const char *err_str = NULL;
- switch (error) {
- case 0x00:
- err_str = I18N_NOOP("Invalid message");
- break;
- case 0x01:
- err_str = I18N_NOOP("Message was too large");
- break;
- case 0x02:
- err_str = I18N_NOOP("Message rate exceeded");
- break;
- case 0x03:
- err_str = I18N_NOOP("Sender too evil");
- break;
- case 0x04:
- err_str = I18N_NOOP("We are to evil :(");
- break;
- default:
- err_str = I18N_NOOP("Unknown error");
- }
- log(L_DEBUG, "ICMB error %u (%s) - screen(%s)", error, err_str, screen.latin1());
- break;
- }
- case ICQ_SNACxMSG_BLAMExSRVxACK:
- if ((m_send.id.id_l == seq) && m_send.msg){
- unsigned short oldLevel, newLevel;
- socket()->readBuffer() >> oldLevel >> newLevel;
- WarningMessage *msg = static_cast<WarningMessage*>(m_send.msg);
- msg->setOldLevel((unsigned short)(newLevel - oldLevel));
- msg->setNewLevel(newLevel);
- ackMessage(m_send);
- }
- break;
- case ICQ_SNACxMSG_ACK:
- {
- log(L_DEBUG, "Ack message");
- MessageId id;
- socket()->readBuffer() >> id.id_l >> id.id_h;
- socket()->readBuffer().incReadPos(2);
- QString screen = socket()->readBuffer().unpackScreen();
- bool bAck = false;
- if (m_send.id == id){
- if(screen.lower() == m_send.screen.lower())
- bAck = true;
- }
- if (bAck){
- log(L_DEBUG, "Ack: %lu %lu (%s)", m_send.id.id_h, m_send.id.id_l, m_send.screen.latin1());
- if (m_send.msg){
- Contact *contact;
- ICQUserData *data = findContact(screen, NULL, false, contact);
- if (((data == NULL) || (data->Status.toULong() == ICQ_STATUS_OFFLINE) || (getAckMode() == 1)) &&
- (m_send.msg->type() != MessageFile)){
- m_sendTimer->stop();
- ackMessage(m_send);
- return;
- }else{
- replyQueue.push_back(m_send);
- }
- }else{
- replyQueue.push_back(m_send);
- }
- }
- m_send.msg = NULL;
- m_send.screen = QString::null;
- m_sendTimer->stop();
- processSendQueue();
- break;
- }
- case ICQ_SNACxMSG_AUTOREPLY:{
- MessageId id;
- unsigned short len, channel, reason, version;
- socket()->readBuffer() >> id.id_l >> id.id_h;
- socket()->readBuffer().unpack(channel);
- if (channel == 1) {
- log(L_DEBUG,"Please send paket to developer!");
- return;
- }
- QString screen = socket()->readBuffer().unpackScreen();
- socket()->readBuffer().unpack(reason);
- socket()->readBuffer().unpack(len);
- socket()->readBuffer().unpack(version);
- plugin p;
- socket()->readBuffer().unpack((char*)p, sizeof(p));
- socket()->readBuffer().incReadPos(len - sizeof(plugin) + 2);
- socket()->readBuffer().unpack(len);
- socket()->readBuffer().incReadPos(len + 12);
- unsigned short ackFlags, msgFlags;
- socket()->readBuffer().unpack(ackFlags);
- socket()->readBuffer().unpack(msgFlags);
+ if (tlvs == NULL)
+ return;
+ Tlv *tlv = (*tlvs)(nTlv);
+ if (tlv == NULL)
+ return;
+ b.tlv(nTlv, *tlv, tlv->Size());
+}
- list<SendMsg>::iterator it;
- for (it = replyQueue.begin(); it != replyQueue.end(); ++it){
- SendMsg &s = *it;
- if ((s.id == id) && (s.screen == screen))
- break;
- }
- if (it == replyQueue.end())
- break;
+static char c2h(char c)
+{
+ c = (char)(c & 0xF);
+ if (c < 10)
+ return (char)('0' + c);
+ return (char)('A' + c - 10);
+}
- unsigned plugin_type = (*it).flags;
- if (plugin_type == PLUGIN_AIM_FT_ACK){
- m_processMsg.push_back((*it).msg);
- replyQueue.erase(it);
- break;
- }
- if ((*it).msg){
- QCString answer;
- socket()->readBuffer() >> answer;
- if (ackMessage((*it).msg, ackFlags, answer)){
- ackMessage(*it);
- }else{
- EventMessageSent((*it).msg).process();
- delete (*it).msg;
- }
- replyQueue.erase(it);
- break;
- }
+static void b2h(char *&p, char c)
+{
+ *(p++) = c2h((char)(c >> 4));
+ *(p++) = c2h(c);
+}
- replyQueue.erase(it);
- Contact *contact;
- ICQUserData *data = findContact(screen, NULL, false, contact);
+void packCap(ICQBuffer &b, const capability &c)
+{
+ char pack_cap[0x27];
+ char *p = pack_cap;
+ *(p++) = '{';
+ b2h(p, c[0]); b2h(p, c[1]); b2h(p, c[2]); b2h(p, c[3]);
+ *(p++) = '-';
+ b2h(p, c[4]); b2h(p, c[5]);
+ *(p++) = '-';
+ b2h(p, c[6]); b2h(p, c[7]);
+ *(p++) = '-';
+ b2h(p, c[8]); b2h(p, c[9]);
+ *(p++) = '-';
+ b2h(p, c[10]); b2h(p, c[11]);
+ b2h(p, c[12]); b2h(p, c[13]); b2h(p, c[14]); b2h(p, c[15]);
+ *(p++) = '}';
+ *p = 0;
+ b << pack_cap;
+}
- if (memcmp(p, plugins[PLUGIN_NULL], sizeof(plugin))){
- unsigned plugin_index;
- for (plugin_index = 0; plugin_index < PLUGIN_NULL; plugin_index++){
- if (memcmp(p, plugins[plugin_index], sizeof(plugin)) == 0)
- break;
- }
- if (plugin_index == PLUGIN_NULL){
- QString plugin_str;
- unsigned i;
- for (i = 0; i < sizeof(plugin); i++){
- char b[4];
- sprintf(b, "%02X ", p[i]);
- plugin_str += b;
- }
- log(L_WARN, "Unknown plugin sign in reply %s", plugin_str.latin1());
- break;
- }
- if ((data == NULL) && (plugin_index != PLUGIN_RANDOMxCHAT))
- break;
- parsePluginPacket(socket()->readBuffer(), plugin_type, data, screen.toULong(), false);
- break;
- }
+SnacIcqICBM::SnacIcqICBM(ICQClient* client) : QObject(NULL), SnacHandler(client, 0x0004)
+{
+ m_sendTimer = new QTimer(this);
+ connect(m_sendTimer, SIGNAL(timeout()), this, SLOT(sendTimeout()));
+}
- if (plugin_type == PLUGIN_AR){
- QCString answer;
- socket()->readBuffer() >> answer;
- log(L_DEBUG, "Autoreply from %s %s", screen.latin1(), answer.data());
- Contact *contact; //Fixme: Local declaration of 'contact' hides declaration of the same name in outer scope, see previous declaration at line '300'
- ICQUserData *data = findContact(screen, NULL, false, contact);
- if (data && data->AutoReply.setStr(getContacts()->toUnicode(contact, answer))){
- EventContact e(contact, EventContact::eChanged);
- e.process();
- }
- }
- break;
- }
- case ICQ_SNACxMSG_SERVERxMESSAGE:{
- MessageId id;
- socket()->readBuffer() >> id.id_l >> id.id_h;
- unsigned short mFormat;
- socket()->readBuffer() >> mFormat;
- QString screen = socket()->readBuffer().unpackScreen();
- log(L_DEBUG, "Message from %s [%04X]", screen.latin1(), mFormat);
- unsigned short level, nTLV;
- socket()->readBuffer() >> level >> nTLV;
- TlvList tlvFixed(socket()->readBuffer(), nTLV);
- TlvList tlvChannel(socket()->readBuffer());
- switch (mFormat){
- case 0x0001:{
- if (!tlvChannel(2)){
- log(L_WARN, "TLV 0x0002 not found");
- break;
- }
- ICQBuffer m(*tlvChannel(2));
- TlvList tlv_msg(m);
- Tlv *m_tlv = tlv_msg(0x101);
- if (m_tlv == NULL){
- log(L_WARN, "TLV 0x0101 not found");
- break;
- }
- if (m_tlv->Size() <= 4){
- log(L_WARN, "Bad TLV 0x0101 size (%d)",m_tlv->Size());
- break;
- }
- char *m_data = (*m_tlv);
- unsigned short encoding = (unsigned short)((m_data[0] << 8) + m_data[1]);
- m_data += 4;
- if(encoding == 2)
- {
- QString text;
- for (int i = 0; i < m_tlv->Size() - 5; i += 2){
- unsigned char r1 = *(m_data++);
- unsigned char r2 = *(m_data++);
- unsigned short c = (unsigned short)((r1 << 8) + r2);
- text += QChar(c);
- }
- Message *msg = new Message(MessageGeneric);
- if (screen.toULong()){
- msg->setText(text);
- }else{
- unsigned bgColor = clearTags(text);
- msg->setText(text);
- msg->setBackground(bgColor);
- msg->setFlags(MESSAGE_RICHTEXT);
- }
- log(L_DEBUG, "Message %s", (const char*)text.local8Bit().data());
- messageReceived(msg, screen);
- break;
- }
- log(L_DEBUG, "ServerText: %s", m_data);
- Message *msg = new Message;
- if (!m_bAIM && screen.toULong()){
- msg->setServerText(m_data);
- }else{
- QString text = m_data;
- unsigned bgColor = clearTags(text);
- msg->setServerText(m_data);
- msg->setBackground(bgColor);
- msg->setFlags(MESSAGE_RICHTEXT);
- }
- messageReceived(msg, screen);
- break;
- }
- case 0x0002:{
- Tlv *tlv5 = tlvChannel(5);
- if(!tlv5)
- {
- log(L_WARN, "TLV 0x0005 not found");
- break;
- }
- ICQBuffer msg(*tlv5);
- unsigned short type; //Fixme: Local declaration of 'type' hides declaration of the same name in outer scope, see previous declaration at line '73'
- msg >> type;
- switch (type){
- case 0:
- parseAdvancedMessage(screen, msg, tlvChannel(3) != NULL, id);
- break;
- case 1:
- {
- Contact *contact;
- ICQUserData *data = findContact(screen, NULL, false, contact);
- if (data){
- QString name = dataName(data);
- for (list<Message*>::iterator it = m_acceptMsg.begin(); it != m_acceptMsg.end(); ++it){
- Message *msg = *it; //Fixme: Local declaration of 'msg' hides declaration of the same name in outer scope, see previous declaration at line '413'
- if (msg->client() && (name == msg->client())){
- MessageId msg_id;
- switch (msg->type()){
- case MessageICQFile:
- msg_id.id_l = static_cast<ICQFileMessage*>(msg)->getID_L();
- msg_id.id_h = static_cast<ICQFileMessage*>(msg)->getID_H();
- break;
- case MessageFile:
- msg_id.id_l = static_cast<AIMFileMessage*>(msg)->getID_L();
- msg_id.id_h = static_cast<AIMFileMessage*>(msg)->getID_H();
- break;
- }
- if (msg_id == id)
- {
- m_acceptMsg.erase(it);
- EventMessageDeleted(msg).process();
- delete msg;
- break;
- }
- }
- }
- }
- break;
- }
- case 2:
- log(L_DEBUG, "File ack");
- break;
- default:
- log(L_WARN, "Unknown type: 0x%04X", type);
- }
- break;
- }
- case 0x0004:{
- Tlv *tlv5 = tlvChannel(5);
- if (!tlv5){
- log(L_WARN, "TLV 0x0005 not found");
- break;
- }
- ICQBuffer msg(*tlv5);
- unsigned long msg_uin;
- msg >> msg_uin;
- if (msg_uin == 0){
- parseAdvancedMessage(screen, msg, tlvChannel(6) != NULL, id);
- return;
- }
- unsigned char type, flags; //Fixme: Local declaration of 'type' hides declaration of the same name in outer scope, see previous declaration at line '73'
- QCString msg_str;
- msg >> type;
- msg >> flags;
- msg >> msg_str;
- Message *m = parseMessage(type, screen, msg_str, msg, id, 0);
- if (m)
- messageReceived(m, screen);
- break;
- }
- default:
- log(L_WARN, "Unknown message format %04X", mFormat);
- }
- break;
- }
- default:
- log(L_WARN, "Unknown message foodgroup type %04X", type);
- }
-}
-
-void ICQClient::icmbRequest()
+SnacIcqICBM::~SnacIcqICBM()
{
- snac(ICQ_SNACxFOOD_MESSAGE, ICQ_SNACxMSG_REQUESTxRIGHTS);
- sendPacket(true);
}
-void ICQClient::sendICMB(unsigned short channel, unsigned long flags)
+void SnacIcqICBM::rightsRequest()
{
- snac(ICQ_SNACxFOOD_MESSAGE, ICQ_SNACxMSG_SETxICQxMODE);
- socket()->writeBuffer()
- << channel << flags
- << (unsigned short)8000 // max message size
- << (unsigned short)880 // max sender warning level
- << (unsigned short)880 // max receiver warning level
- << (unsigned short)0 // min message interval
- << (unsigned short)0; // unknown
- sendPacket(true);
+ client()->snac(ICQ_SNACxFOOD_MESSAGE, ICQ_SNACxMSG_REQUESTxRIGHTS);
+ client()->sendPacket(true);
}
-bool ICQClient::sendThruServer(Message *msg, void *_data)
+void SnacIcqICBM::sendICMB(unsigned short channel, unsigned long flags)
{
- ICQUserData *data = toICQUserData((SIM::clientData*)_data); // FIXME unsafe type conversion
- Contact *contact = getContacts()->contact(msg->contact());
- if ((contact == NULL) || (data == NULL))
- return false;
- SendMsg s;
- switch (msg->type()){
- case MessageGeneric:
- if ((data->Status.toULong() != ICQ_STATUS_OFFLINE) && (getSendFormat() == 0) &&
- hasCap(data, CAP_RTF) && (msg->getFlags() & MESSAGE_RICHTEXT) &&
- !data->bBadClient.toBool()){
- s.flags = SEND_RTF;
- s.msg = msg;
- s.text = msg->getRichText();
- s.screen = screen(data);
- sendFgQueue.push_back(s);
- processSendQueue();
- return true;
- }
- if ((data->Status.toULong() != ICQ_STATUS_OFFLINE) &&
- (getSendFormat() <= 1) &&
- hasCap(data, CAP_UTF) &&
- ((msg->getFlags() & MESSAGE_SECURE) == 0) &&
- (data->Version.toULong() >= 8) && !data->bBadClient.toBool()){
- s.flags = SEND_UTF;
- s.msg = msg;
- s.text = addCRLF(msg->getPlainText());
- s.screen = screen(data);
- sendFgQueue.push_back(s);
- processSendQueue();
- return true;
- }
- if ((data->Status.toULong() != ICQ_STATUS_OFFLINE) &&
- (data->Version.toULong() >= 8) &&
- !data->bBadClient.toBool() &&
- (msg->getPlainText().length() >= MAX_PLAIN_MESSAGE_SIZE)){
- s.flags = SEND_TYPE2;
- s.msg = msg;
- s.text = msg->getPlainText();
- s.screen = screen(data);
- sendFgQueue.push_back(s);
- processSendQueue();
- return true;
- }
- if ((data->Uin.toULong() == 0) || m_bAIM){
- s.msg = msg;
- if (msg->getFlags() & MESSAGE_RICHTEXT){
- s.flags = SEND_HTML;
- s.text = removeImages(msg->getRichText(), false);
- }else{
- s.flags = SEND_HTML_PLAIN;
- s.text = msg->getPlainText();
- }
- s.screen = screen(data);
- sendFgQueue.push_back(s);
- processSendQueue();
- return true;
- }
- s.flags = SEND_PLAIN;
- s.msg = msg;
- s.text = addCRLF(msg->getPlainText());
- s.screen = screen(data);
- sendFgQueue.push_back(s);
- processSendQueue();
- return true;
- case MessageUrl:
- if ((data->Uin.toULong() == 0) || m_bAIM){
- UrlMessage *m = static_cast<UrlMessage*>(msg);
- QString text = "<a href=\"";
- text += m->getUrl();
- text += "\">";
- text += m->getUrl();
- text += "</a><br>";
- text += removeImages(msg->getRichText(), false);
- s.flags = SEND_HTML;
- s.msg = msg;
- s.text = text;
- s.screen = screen(data);
- sendFgQueue.push_back(s);
- processSendQueue();
- return true;
- }
- case MessageContacts:
- case MessageFile:
- case MessageWarning:
- s.flags = SEND_RAW;
- s.msg = msg;
- s.screen = screen(data);
- sendFgQueue.push_back(s);
- processSendQueue();
- return true;
- }
- return false;
+ client()->snac(ICQ_SNACxFOOD_MESSAGE, ICQ_SNACxMSG_SETxICQxMODE);
+ client()->socket()->writeBuffer()
+ << channel << flags
+ << (unsigned short)0x1f40
+ << (unsigned short)0x30e7
+ << (unsigned short)0x30e7
+ << (unsigned short)0x0000
+ << (unsigned short)0x0000;
+ client()->sendPacket(true);
}
-void ICQClient::sendThroughServer(const QString &screen, unsigned short channel, ICQBuffer &b, const MessageId &id, bool bOffline, bool bReqAck)
+void SnacIcqICBM::sendThroughServer(const QString &screen, unsigned short channel, ICQBuffer &b, const MessageId &id, bool bOffline, bool bReqAck)
{
// we need informations about channel 2 tlvs !
unsigned short tlv_type = 5;
- snac(ICQ_SNACxFOOD_MESSAGE, ICQ_SNACxMSG_SENDxSERVER, true, true);
+ client()->snac(ICQ_SNACxFOOD_MESSAGE, ICQ_SNACxMSG_SENDxSERVER, true, true);
socket()->writeBuffer() << id.id_l << id.id_h;
socket()->writeBuffer() << channel;
socket()->writeBuffer().packScreen(screen);
@@ -621,44 +161,134 @@
socket()->writeBuffer().tlv(3); // req. ack from server
if (bOffline)
socket()->writeBuffer().tlv(6); // store if user is offline
- sendPacket(true);
+ client()->sendPacket(true);
}
-static char c2h(char c)
+bool SnacIcqICBM::ackMessage(Message *msg, unsigned short ackFlags, const QCString &msg_str)
{
- c = (char)(c & 0xF);
- if (c < 10)
- return (char)('0' + c);
- return (char)('A' + c - 10);
+ switch (ackFlags){
+ case ICQ_TCPxACK_OCCUPIED:
+ case ICQ_TCPxACK_DND:
+ case ICQ_TCPxACK_REFUSE:
+ if (msg_str.isEmpty())
+ msg->setError(I18N_NOOP("Message declined"));
+ else
+ msg->setError(msg_str);
+ switch (ackFlags){
+ case ICQ_TCPxACK_OCCUPIED:
+ msg->setRetryCode(static_cast<ICQPlugin*>(client()->protocol()->plugin())->RetrySendOccupied);
+ break;
+ case ICQ_TCPxACK_DND:
+ msg->setRetryCode(static_cast<ICQPlugin*>(client()->protocol()->plugin())->RetrySendDND);
+ break;
+ }
+ return false;
+ }
+ return true;
}
-static void b2h(char *&p, char c)
+void SnacIcqICBM::sendType1(const QString &text, bool bWide, ICQUserData *data)
{
- *(p++) = c2h((char)(c >> 4));
- *(p++) = c2h(c);
+ ICQBuffer msgBuf;
+ if (bWide)
+ {
+ QByteArray ba(text.length() * 2);
+ for(int i = 0; i < (int)text.length(); i++)
+ {
+ unsigned short c = text[i].unicode();
+ char c1 = (char)((c >> 8) & 0xFF);
+ char c2 = (char)(c & 0xFF);
+ ba[i * 2 + 0] = c1;
+ ba[i * 2 + 1] = c2;
+ }
+ msgBuf << 0x00020000L;
+ msgBuf.pack(ba.data(), ba.size());
+ }
+ else
+ {
+ log(L_DEBUG, "%s", client()->getContact(data)->getEncoding().utf8().data());
+ QCString msg_text = getContacts()->fromUnicode(client()->getContact(data), text);
+ EventSend e(m_send.msg, msg_text);
+ e.process();
+ msg_text = e.localeText();
+ msgBuf << 0x0000FFFFL;
+ msgBuf << msg_text.data();
+ }
+ ICQBuffer b;
+ b.tlv(0x0501, "\x01", 1);
+ b.tlv(0x0101, msgBuf);
+ sendThroughServer(m_send.screen, 1, b, m_send.id, true, true);
+ if ((data->Status.toULong() != ICQ_STATUS_OFFLINE) || (client()->getAckMode() == 0))
+ ackMessage(m_send);
}
-void packCap(ICQBuffer &b, const capability &c)
+void SnacIcqICBM::sendType2(const QString &screen, ICQBuffer &msgBuf, const MessageId &id, unsigned cap, bool bOffline, unsigned short port, TlvList *tlvs, unsigned short type)
{
- char pack_cap[0x27];
- char *p = pack_cap;
- *(p++) = '{';
- b2h(p, c[0]); b2h(p, c[1]); b2h(p, c[2]); b2h(p, c[3]);
- *(p++) = '-';
- b2h(p, c[4]); b2h(p, c[5]);
- *(p++) = '-';
- b2h(p, c[6]); b2h(p, c[7]);
- *(p++) = '-';
- b2h(p, c[8]); b2h(p, c[9]);
- *(p++) = '-';
- b2h(p, c[10]); b2h(p, c[11]);
- b2h(p, c[12]); b2h(p, c[13]); b2h(p, c[14]); b2h(p, c[15]);
- *(p++) = '}';
- *p = 0;
- b << pack_cap;
+ ICQBuffer b;
+ b << (unsigned short)0;
+ b << id.id_l << id.id_h;
+ b.pack((char*)client()->capabilities[cap], sizeof(capability));
+ b.tlv(0x0A, (unsigned short)type);
+ if(type != 4)
+ b.tlv(0x0F);
+ copyTlv(b, tlvs, 0x14);
+ if(port)
+ {
+ if(type != 4)
+ {
+ b.tlv(0x03, (unsigned long)htonl(get_ip(client()->data.owner.RealIP)));
+ if(type != 3)
+ {
+ b.tlv(0x04, (unsigned long)htonl(get_ip(client()->data.owner.IP)));
+ }
+ }
+ b.tlv(0x05, port);
+ log(L_DEBUG, "RealIP = %08x, IP = %08x, port = %04x", (get_ip(client()->data.owner.RealIP)), (get_ip(client()->data.owner.IP)), port);
+ }
+ copyTlv(b, tlvs, 0x17);
+ copyTlv(b, tlvs, 0x0E);
+ copyTlv(b, tlvs, 0x0D);
+ copyTlv(b, tlvs, 0x0C);
+ copyTlv(b, tlvs, 0x10);
+ copyTlv(b, tlvs, 0x02);
+ copyTlv(b, tlvs, 0x16);
+ if(type != 4)
+ b.tlv(0x2711, msgBuf);
+ copyTlv(b, tlvs, 0x2712);
+ copyTlv(b, tlvs, 0x03);
+ sendThroughServer(screen, 2, b, id, bOffline, true);
+}
+
+ICQClientSocket* SnacIcqICBM::socket()
+{
+ return client()->socket();
}
-void ICQClient::ackMessage(SendMsg &s)
+void SnacIcqICBM::sendAdvMessage(const QString &screen, ICQBuffer &msgText, unsigned plugin_index, const MessageId &id, bool bOffline, bool bDirect, unsigned short cookie1, unsigned short cookie2, unsigned short type)
+{
+ if (cookie1 == 0)
+ {
+ client()->m_advCounter--;
+ cookie1 = client()->m_advCounter;
+ cookie2 = (plugin_index == PLUGIN_NULL) ? 0x0E : 0x12;
+ }
+ ICQBuffer msgBuf;
+ msgBuf.pack((unsigned short)0x1B);
+ msgBuf.pack((unsigned short)0x08);
+ msgBuf.pack((char*)client()->plugins[plugin_index], sizeof(plugin));
+ msgBuf.pack(0x00000003L);
+ msgBuf.pack((char)(type ? 4 : 0));
+ msgBuf.pack(cookie1);
+ msgBuf.pack(cookie2);
+ msgBuf.pack(cookie1);
+ msgBuf.pack(0x00000000L);
+ msgBuf.pack(0x00000000L);
+ msgBuf.pack(0x00000000L);
+ msgBuf.pack(msgText.data(0), msgText.size());
+ sendType2(screen, msgBuf, id, CAP_SRV_RELAY, bOffline, bDirect ? client()->data.owner.Port.toULong() : 0, NULL, type);
+}
+
+void SnacIcqICBM::ackMessage(SendMsg &s)
{
if (s.flags == PLUGIN_AIM_FT){
s.msg->setError(I18N_NOOP("File transfer declined"));
@@ -672,7 +302,7 @@
}
if ((s.msg->getFlags() & MESSAGE_NOHISTORY) == 0){
if ((s.flags & SEND_MASK) == SEND_RAW){
- s.msg->setClient(dataName(m_send.screen));
+ s.msg->setClient(client()->dataName(m_send.screen));
EventSent(s.msg).process();
}else if (!s.part.isEmpty()){
Message m(MessageGeneric);
@@ -682,15 +312,15 @@
unsigned flags = s.msg->getFlags() & (~MESSAGE_RICHTEXT);
if ((s.flags & SEND_MASK) == SEND_RTF){
flags |= MESSAGE_RICHTEXT;
- m.setText(removeImages(s.part, true));
+ m.setText(client()->removeImages(s.part, true));
}else if ((s.flags & SEND_MASK) == SEND_HTML){
flags |= MESSAGE_RICHTEXT;
- m.setText(removeImages(s.part, false));
+ m.setText(client()->removeImages(s.part, false));
}else{
m.setText(s.part);
}
m.setFlags(flags);
- m.setClient(dataName(s.screen));
+ m.setClient(client()->dataName(s.screen));
EventSent(&m).process();
}
}
@@ -699,149 +329,157 @@
delete s.msg;
s.msg = NULL;
s.screen = QString::null;
- }else{
+ }
+ else
+ {
sendFgQueue.push_front(s);
}
m_sendTimer->stop();
processSendQueue();
}
-bool ICQClient::ackMessage(Message *msg, unsigned short ackFlags, const QCString &msg_str)
+bool SnacIcqICBM::sendThruServer(Message *msg, void *_data)
{
- switch (ackFlags){
- case ICQ_TCPxACK_OCCUPIED:
- case ICQ_TCPxACK_DND:
- case ICQ_TCPxACK_REFUSE:
- if (msg_str.isEmpty())
- msg->setError(I18N_NOOP("Message declined"));
- else
- msg->setError(msg_str);
- switch (ackFlags){
- case ICQ_TCPxACK_OCCUPIED:
- msg->setRetryCode(static_cast<ICQPlugin*>(protocol()->plugin())->RetrySendOccupied);
- break;
- case ICQ_TCPxACK_DND:
- msg->setRetryCode(static_cast<ICQPlugin*>(protocol()->plugin())->RetrySendDND);
- break;
- }
+ ICQUserData *data = client()->toICQUserData((SIM::clientData*)_data); // FIXME unsafe type conversion
+ Contact *contact = getContacts()->contact(msg->contact());
+ if ((contact == NULL) || (data == NULL))
return false;
+ SendMsg s;
+ switch (msg->type()){
+ case MessageGeneric:
+ if ((data->Status.toULong() != ICQ_STATUS_OFFLINE) && (client()->getSendFormat() == 0) &&
+ client()->hasCap(data, CAP_RTF) && (msg->getFlags() & MESSAGE_RICHTEXT) &&
+ !data->bBadClient.toBool()){
+ s.flags = SEND_RTF;
+ s.msg = msg;
+ s.text = msg->getRichText();
+ s.screen = client()->screen(data);
+ sendFgQueue.push_back(s);
+ processSendQueue();
+ return true;
+ }
+ if ((data->Status.toULong() != ICQ_STATUS_OFFLINE) &&
+ (client()->getSendFormat() <= 1) &&
+ client()->hasCap(data, CAP_UTF) &&
+ ((msg->getFlags() & MESSAGE_SECURE) == 0) &&
+ (data->Version.toULong() >= 8) && !data->bBadClient.toBool()){
+ s.flags = SEND_UTF;
+ s.msg = msg;
+ s.text = client()->addCRLF(msg->getPlainText());
+ s.screen = client()->screen(data);
+ sendFgQueue.push_back(s);
+ processSendQueue();
+ return true;
+ }
+ if ((data->Status.toULong() != ICQ_STATUS_OFFLINE) &&
+ (data->Version.toULong() >= 8) &&
+ !data->bBadClient.toBool() &&
+ (msg->getPlainText().length() >= MAX_PLAIN_MESSAGE_SIZE)){
+ s.flags = SEND_TYPE2;
+ s.msg = msg;
+ s.text = msg->getPlainText();
+ s.screen = client()->screen(data);
+ sendFgQueue.push_back(s);
+ processSendQueue();
+ return true;
+ }
+ if ((data->Uin.toULong() == 0) || client()->m_bAIM){
+ s.msg = msg;
+ if (msg->getFlags() & MESSAGE_RICHTEXT){
+ s.flags = SEND_HTML;
+ s.text = client()->removeImages(msg->getRichText(), false);
+ }else{
+ s.flags = SEND_HTML_PLAIN;
+ s.text = msg->getPlainText();
+ }
+ s.screen = client()->screen(data);
+ sendFgQueue.push_back(s);
+ processSendQueue();
+ return true;
+ }
+ s.flags = SEND_PLAIN;
+ s.msg = msg;
+ s.text = client()->addCRLF(msg->getPlainText());
+ s.screen = client()->screen(data);
+ sendFgQueue.push_back(s);
+ processSendQueue();
+ return true;
+ case MessageUrl:
+ if ((data->Uin.toULong() == 0) || client()->m_bAIM){
+ UrlMessage *m = static_cast<UrlMessage*>(msg);
+ QString text = "<a href=\"";
+ text += m->getUrl();
+ text += "\">";
+ text += m->getUrl();
+ text += "</a><br>";
+ text += client()->removeImages(msg->getRichText(), false);
+ s.flags = SEND_HTML;
+ s.msg = msg;
+ s.text = text;
+ s.screen = client()->screen(data);
+ sendFgQueue.push_back(s);
+ processSendQueue();
+ return true;
+ }
+ case MessageContacts:
+ case MessageFile:
+ case MessageWarning:
+ s.flags = SEND_RAW;
+ s.msg = msg;
+ s.screen = client()->screen(data);
+ sendFgQueue.push_back(s);
+ processSendQueue();
+ return true;
}
- return true;
-}
-
-void ICQClient::sendAdvMessage(const QString &screen, ICQBuffer &msgText, unsigned plugin_index, const MessageId &id, bool bOffline, bool bDirect, unsigned short cookie1, unsigned short cookie2, unsigned short type)
-{
- if (cookie1 == 0){
- m_advCounter--;
- cookie1 = m_advCounter;
- cookie2 = (plugin_index == PLUGIN_NULL) ? 0x0E : 0x12;
- }
- ICQBuffer msgBuf;
- msgBuf.pack((unsigned short)0x1B);
- msgBuf.pack((unsigned short)0x08);
- msgBuf.pack((char*)plugins[plugin_index], sizeof(plugin));
- msgBuf.pack(0x00000003L);
- msgBuf.pack((char)(type ? 4 : 0));
- msgBuf.pack(cookie1);
- msgBuf.pack(cookie2);
- msgBuf.pack(cookie1);
- msgBuf.pack(0x00000000L);
- msgBuf.pack(0x00000000L);
- msgBuf.pack(0x00000000L);
- msgBuf.pack(msgText.data(0), msgText.size());
- sendType2(screen, msgBuf, id, CAP_SRV_RELAY, bOffline, bDirect ? data.owner.Port.toULong() : 0, NULL, type);
-}
-
-static void copyTlv(ICQBuffer &b, TlvList *tlvs, unsigned nTlv)
-{
- if (tlvs == NULL)
- return;
- Tlv *tlv = (*tlvs)(nTlv);
- if (tlv == NULL)
- return;
- b.tlv(nTlv, *tlv, tlv->Size());
+ return false;
}
-void ICQClient::sendType2(const QString &screen, ICQBuffer &msgBuf, const MessageId &id, unsigned cap, bool bOffline, unsigned short port, TlvList *tlvs, unsigned short type)
+void SnacIcqICBM::clearMsgQueue()
{
- ICQBuffer b;
- b << (unsigned short)0;
- b << id.id_l << id.id_h;
- b.pack((char*)capabilities[cap], sizeof(capability));
- b.tlv(0x0A, (unsigned short)type);
- if(type != 4)
- b.tlv(0x0F);
- copyTlv(b, tlvs, 0x14);
- if(port)
- {
- if(type != 4)
+ list<SendMsg>::iterator it;
+ for (it = sendFgQueue.begin(); it != sendFgQueue.end(); ++it){
+ if ((*it).socket){
+ // dunno know if this is ok - vladimir please take a look
+ (*it).socket->acceptReverse(NULL);
+ continue;
+ }
+ if ((*it).msg)
{
- b.tlv(0x03, (unsigned long)htonl(get_ip(data.owner.RealIP)));
- if(type != 3)
- {
- b.tlv(0x04, (unsigned long)htonl(get_ip(data.owner.IP)));
- }
+ (*it).msg->setError(I18N_NOOP("Client go offline"));
+ EventMessageSent((*it).msg).process();
+ if ((*it).msg == m_send.msg)
+ m_send.msg = NULL;
+ delete (*it).msg;
}
- b.tlv(0x05, port);
- log(L_DEBUG, "RealIP = %08x, IP = %08x, port = %04x", (get_ip(data.owner.RealIP)), (get_ip(data.owner.IP)), port);
- }
- copyTlv(b, tlvs, 0x17);
- copyTlv(b, tlvs, 0x0E);
- copyTlv(b, tlvs, 0x0D);
- copyTlv(b, tlvs, 0x0C);
- copyTlv(b, tlvs, 0x10);
- copyTlv(b, tlvs, 0x02);
- copyTlv(b, tlvs, 0x16);
- if(type != 4)
- b.tlv(0x2711, msgBuf);
- copyTlv(b, tlvs, 0x2712);
- copyTlv(b, tlvs, 0x03);
- sendThroughServer(screen, 2, b, id, bOffline, true);
-}
-
-void ICQClient::clearMsgQueue()
-{
- list<SendMsg>::iterator it;
- for (it = sendFgQueue.begin(); it != sendFgQueue.end(); ++it){
- if ((*it).socket){
- // dunno know if this is ok - vladimir please take a look
- (*it).socket->acceptReverse(NULL);
- continue;
- }
- if ((*it).msg) {
- (*it).msg->setError(I18N_NOOP("Client go offline"));
- EventMessageSent((*it).msg).process();
- if ((*it).msg == m_send.msg)
- m_send.msg = NULL;
- delete (*it).msg;
- }
- }
- sendFgQueue.clear();
- for (it = sendBgQueue.begin(); it != sendBgQueue.end(); ++it){
- if ((*it).socket){
- // dunno know if this is ok - vladimir please take a look
- (*it).socket->acceptReverse(NULL);
- continue;
- }
- if ((*it).msg) {
- (*it).msg->setError(I18N_NOOP("Client go offline"));
- EventMessageSent((*it).msg).process();
- if ((*it).msg == m_send.msg)
- m_send.msg = NULL;
- delete (*it).msg;
- }
- }
- sendBgQueue.clear();
- if (m_send.msg){
- m_send.msg->setError(I18N_NOOP("Client go offline"));
- EventMessageSent(m_send.msg).process();
- delete m_send.msg;
- }
- m_send.msg = NULL;
- m_send.screen = QString::null;
+ }
+ sendFgQueue.clear();
+ for (it = sendBgQueue.begin(); it != sendBgQueue.end(); ++it){
+ if ((*it).socket){
+ // dunno know if this is ok - vladimir please take a look
+ (*it).socket->acceptReverse(NULL);
+ continue;
+ }
+ if((*it).msg)
+ {
+ (*it).msg->setError(I18N_NOOP("Client go offline"));
+ EventMessageSent((*it).msg).process();
+ if ((*it).msg == m_send.msg)
+ m_send.msg = NULL;
+ delete (*it).msg;
+ }
+ }
+ sendBgQueue.clear();
+ if (m_send.msg)
+ {
+ m_send.msg->setError(I18N_NOOP("Client go offline"));
+ EventMessageSent(m_send.msg).process();
+ delete m_send.msg;
+ }
+ m_send.msg = NULL;
+ m_send.screen = QString::null;
}
-void ICQClient::icmbSendFile(TlvList& tlv, unsigned long primary_ip, unsigned long secondary_ip, unsigned short port,const QString &screen, MessageId const& id)
+void SnacIcqICBM::sendFile(TlvList& tlv, unsigned long primary_ip, unsigned long secondary_ip, unsigned short port,const QString &screen, MessageId const& id)
{
log(L_DEBUG, "ICQClient::icbmSendFile()");
Tlv *desc = tlv(0x0A);
@@ -855,7 +493,7 @@
// First, let's find our filetransfer
AIMFileTransfer* ft = NULL;
- for(list<AIMFileTransfer*>::iterator it = m_filetransfers.begin(); it != m_filetransfers.end(); ++it)
+ for(list<AIMFileTransfer*>::iterator it = client()->m_filetransfers.begin(); it != client()->m_filetransfers.end(); ++it)
{
if((*it)->getICBMCookie() == id)
{
@@ -875,10 +513,10 @@
}
ICQBuffer b(*info);
b >> type >> nFiles >> size;
- QString name = convert(b.data(8), b.size() - 8, tlv, 0x2712);
+ QString name = client()->convert(b.data(8), b.size() - 8, tlv, 0x2712);
AIMFileMessage *msg = new AIMFileMessage;
msg->setPort(port);
- msg->setBackground(clearTags(d));
+ msg->setBackground(client()->clearTags(d));
//msg->setText(d);
msg->setSize(size);
msg->setID_L(id.id_l);
@@ -913,12 +551,12 @@
}
msg->setDescription(d);
msg->setFlags(MESSAGE_RECEIVED | MESSAGE_RICHTEXT | MESSAGE_TEMP);
- m_processMsg.push_back(msg);
- messageReceived(msg, screen);
+ client()->m_processMsg.push_back(msg);
+ client()->messageReceived(msg, screen);
return;
}
AIMFileMessage* afm = NULL;
- for(list<Message*>::iterator it = m_processMsg.begin(); it != m_processMsg.end(); ++it)
+ for(list<Message*>::iterator it = client()->m_processMsg.begin(); it != client()->m_processMsg.end(); ++it)
{
if ((*it)->type() == MessageFile)
{
@@ -939,12 +577,12 @@
if(is_proxy) // Connection through proxy
{
log(L_DEBUG, "Proxy request");
- for(list<AIMFileTransfer*>::iterator it = m_filetransfers.begin(); it != m_filetransfers.end(); ++it)
+ for(list<AIMFileTransfer*>::iterator it = client()->m_filetransfers.begin(); it != client()->m_filetransfers.end(); ++it)
{
if((*it)->getICBMCookie() == id)
{
Contact *contact;
- ICQUserData *data = findContact(screen, NULL, false, contact);
+ ICQUserData *data = client()->findContact(screen, NULL, false, contact);
if(data)
{
if(primary_ip)
@@ -982,7 +620,7 @@
}
if(ft_type == 2)
{
- for(list<AIMFileTransfer*>::iterator it = m_filetransfers.begin(); it != m_filetransfers.end(); ++it)
+ for(list<AIMFileTransfer*>::iterator it = client()->m_filetransfers.begin(); it != m_client->m_filetransfers.end(); ++it)
{
AIMFileTransfer *ft = (*it); //Fixme:Local declaration of 'ft' hides declaration from line: 857
if(ft->getICBMCookie() == id)
@@ -1003,13 +641,800 @@
}
}
-void ICQClient::parseAdvancedMessage(const QString &screen, ICQBuffer &m, bool needAck, MessageId id)
+void SnacIcqICBM::sendAutoReply(const QString &screen, MessageId id,
+ const plugin p, unsigned short cookie1, unsigned short cookie2,
+ unsigned short msgType, char msgFlags, unsigned short msgState,
+ const QString &response, unsigned short response_type, ICQBuffer ©)
+{
+ client()->snac(ICQ_SNACxFOOD_MESSAGE, ICQ_SNACxMSG_AUTOREPLY);
+ socket()->writeBuffer() << id.id_l << id.id_h << 0x0002;
+ socket()->writeBuffer().packScreen(screen);
+ socket()->writeBuffer() << 0x0003 << 0x1B00 << 0x0800;
+ socket()->writeBuffer().pack((char*)p, sizeof(plugin));
+ socket()->writeBuffer() << 0x03000000L << (char)0;
+ socket()->writeBuffer().pack(cookie1);
+ socket()->writeBuffer().pack(cookie2);
+ socket()->writeBuffer().pack(cookie1);
+ socket()->writeBuffer() << 0x00000000L << 0x00000000L << 0x00000000L;
+ socket()->writeBuffer().pack(msgType);
+ socket()->writeBuffer() << msgFlags << msgState << (char)0;
+ if (!response.isEmpty()){
+ Contact *contact = NULL;
+ client()->findContact(screen, NULL, false, contact);
+ QCString r = getContacts()->fromUnicode(contact, response);
+ unsigned short size = (unsigned short)(r.length() + 1);
+ socket()->writeBuffer().pack(size);
+ socket()->writeBuffer().pack(r.data(), size);
+ }else{
+ socket()->writeBuffer() << (char)0x01 << response_type;
+ }
+ if (response_type != 3){
+ if (copy.size()){
+ socket()->writeBuffer().pack(copy.data(0), copy.writePos());
+ }else{
+ socket()->writeBuffer() << 0x00000000L << 0xFFFFFF00L;
+ }
+ }
+ client()->sendPacket(false);
+}
+
+void SnacIcqICBM::sendMTN(const QString &screen, unsigned short type)
+{
+ if (client()->getDisableTypingNotification())
+ return;
+ client()->snac(ICQ_SNACxFOOD_MESSAGE, ICQ_SNACxMSG_MTN);
+ socket()->writeBuffer() << 0x00000000L << 0x00000000L << (unsigned short)0x0001;
+ socket()->writeBuffer().packScreen(screen);
+ socket()->writeBuffer() << type;
+ client()->sendPacket(true);
+}
+
+void SnacIcqICBM::sendTimeout()
+{
+ m_sendTimer->stop();
+ if (m_send.screen.length()){
+ log(L_WARN, "Send timeout");
+ if (m_send.msg){
+ m_send.msg->setError(I18N_NOOP("Send timeout"));
+ EventMessageSent(m_send.msg).process();
+ delete m_send.msg;
+ }
+ m_send.msg = NULL;
+ m_send.screen = QString::null;
+ }
+ processSendQueue();
+}
+
+void SnacIcqICBM::accept(Message *msg, ICQUserData *data)
+{
+ MessageId id;
+ if (msg->getFlags() & MESSAGE_DIRECT){
+ Contact *contact = getContacts()->contact(msg->contact());
+ ICQUserData *data = NULL; //Fixme: Local declaration of 'data' hides declaration of the same name in outer scope, see previous declaration at line '2163'
+ if (contact){
+ ClientDataIterator it(contact->clientData, client());
+ while ((data = (client()->toICQUserData(++it))) != NULL){
+ if (msg->client() && (client()->dataName(data) == msg->client()))
+ break;
+ data = NULL;
+ }
+ }
+ if (data == NULL){
+ log(L_WARN, "Data for request not found");
+ return;
+ }
+ DirectClient *dc = dynamic_cast<DirectClient*>(data->Direct.object());
+ if (dc == NULL){
+ log(L_WARN, "No direct connection");
+ return;
+ }
+ dc->acceptMessage(msg);
+ }else{
+ id.id_l = static_cast<ICQFileMessage*>(msg)->getID_L();
+ id.id_h = static_cast<ICQFileMessage*>(msg)->getID_H();
+ ICQBuffer b;
+ unsigned short type = ICQ_MSGxEXT;
+ client()->packMessage(b, msg, data, type, false, 0);
+ unsigned cookie = static_cast<ICQFileMessage*>(msg)->getCookie();
+ sendAdvMessage(client()->screen(data), b, PLUGIN_NULL, id, false, true, (unsigned short)(cookie & 0xFFFF), (unsigned short)((cookie >> 16) & 0xFFFF), 2);
+ }
+}
+
+void SnacIcqICBM::accept(Message *msg, const QString &dir, OverwriteMode overwrite)
+{
+ ICQUserData *data = NULL;
+ bool bDelete = true;
+ if (msg->client()){
+ Contact *contact = getContacts()->contact(msg->contact());
+ if (contact){
+ ClientDataIterator it(contact->clientData, client());
+ while ((data = (client()->toICQUserData(++it))) != NULL){
+ if (client()->dataName(data) == msg->client())
+ break;
+ data = NULL;
+ }
+ }
+ }
+ if (data){
+ switch (msg->type()){
+ case MessageICQFile:{
+ ICQFileTransfer *ft = new ICQFileTransfer(static_cast<FileMessage*>(msg), data, client());
+ ft->setDir(dir);
+ ft->setOverwrite(overwrite);
+ EventMessageAcked(msg).process();
+ client()->m_processMsg.push_back(msg);
+ bDelete = false;
+ ft->listen();
+ break;
+ }
+ case MessageFile:
+ {
+ AIMFileTransfer *ft = new AIMIncomingFileTransfer(static_cast<FileMessage*>(msg), data, client());
+ AIMFileMessage* fmsg = static_cast<AIMFileMessage*>(msg);
+ fmsg->m_transfer = ft;
+ ft->setDir(dir);
+ ft->setOverwrite(overwrite);
+ EventMessageAcked(msg).process();
+ bDelete = false;
+ ft->setPort(fmsg->getPort());
+ MessageId this_id;
+ this_id.id_l = fmsg->getID_L();
+ this_id.id_h = fmsg->getID_H();
+ ft->setICBMCookie(this_id);
+ log(L_DEBUG, "port = %d", fmsg->getPort());
+ ft->setStage(1);
+ if(fmsg->isProxy)
+ {
+ ft->setICBMCookie2(fmsg->cookie2);
+ ft->setProxyActive(false);
+ ft->forceProxyConnection();
+ }
+ ft->accept();
+ return;
+ }
+ default:
+ log(L_DEBUG, "Bad message type %u for accept", msg->type());
+ }
+ }
+ EventMessageDeleted(msg).process();
+ if (bDelete)
+ {
+ delete msg;
+ }
+}
+
+void SnacIcqICBM::decline(Message *msg, const QString &reason)
+{
+ if (msg->getFlags() & MESSAGE_DIRECT){
+ Contact *contact = getContacts()->contact(msg->contact());
+ ICQUserData *data = NULL;
+ if (contact){
+ ClientDataIterator it(contact->clientData, client());
+ while ((data = (client()->toICQUserData(++it))) != NULL){
+ if (msg->client() && (client()->dataName(data) == msg->client()))
+ break;
+ data = NULL;
+ }
+ }
+ if (data == NULL){
+ log(L_WARN, "Data for request not found");
+ return;
+ }
+ DirectClient *dc = dynamic_cast<DirectClient*>(data->Direct.object());
+ if (dc == NULL){
+ log(L_WARN, "No direct connection");
+ return;
+ }
+ dc->declineMessage(msg, reason);
+ }else{
+ MessageId id;
+ unsigned cookie = 0;
+ switch (msg->type()){
+ case MessageICQFile:
+ id.id_l = static_cast<ICQFileMessage*>(msg)->getID_L();
+ id.id_h = static_cast<ICQFileMessage*>(msg)->getID_H();
+ cookie = static_cast<ICQFileMessage*>(msg)->getCookie();
+ break;
+ case MessageFile:
+ id.id_l = static_cast<AIMFileMessage*>(msg)->getID_L();
+ id.id_h = static_cast<AIMFileMessage*>(msg)->getID_H();
+ break;
+ default:
+ log(L_WARN, "Bad type %u for decline", msg->type());
+ }
+ ICQUserData *data = NULL;
+ Contact *contact = NULL;
+ if (msg->client()){
+ contact = getContacts()->contact(msg->contact());
+ if (contact){
+ ClientDataIterator it(contact->clientData, client());
+ while ((data = (client()->toICQUserData(++it))) != NULL){
+ if (client()->dataName(data) == msg->client())
+ break;
+ data = NULL;
+ }
+ }
+ }
+ if (data && (id.id_l || id.id_h)){
+ if (msg->type() == MessageICQFile){
+ ICQBuffer buf, msgBuf;
+ ICQBuffer b;
+ client()->packExtendedMessage(msg, buf, msgBuf, data);
+ b.pack((unsigned short)buf.size());
+ b.pack(buf.data(0), buf.size());
+ b.pack32(msgBuf);
+ unsigned short type = ICQ_MSGxEXT;
+ sendAutoReply(client()->screen(data), id, client()->plugins[PLUGIN_NULL], (unsigned short)(cookie & 0xFFFF),
+ (unsigned short)((cookie >> 16) & 0xFFFF), type, 1, 0, reason, 2, b);
+ }else{
+ client()->snac(ICQ_SNACxFOOD_MESSAGE, ICQ_SNACxMSG_AUTOREPLY);
+ socket()->writeBuffer() << id.id_l << id.id_h << 0x0002;
+ socket()->writeBuffer().packScreen(client()->screen(data));
+ socket()->writeBuffer() << 0x0003 << 0x0002 << 0x0001;
+ client()->sendPacket(false);
+ if (!reason.isEmpty()){
+ Message *msg = new Message(MessageGeneric); //Fixme: Local declaration of 'msg' hides declaration of the same name in outer scope, see previous declaration at line '2262'
+ msg->setText(reason);
+ msg->setFlags(MESSAGE_NOHISTORY);
+ msg->setContact(contact->id());
+ if (!client()->send(msg, data))
+ delete msg;
+ }
+ }
+ }
+ }
+ EventMessageDeleted(msg).process();
+ delete msg;
+}
+
+
+void SnacIcqICBM::requestReverseConnection(const QString &screen, DirectSocket *socket)
+{
+ SendMsg s;
+ s.flags = PLUGIN_REVERSE;
+ s.socket = socket;
+ s.screen = screen;
+ sendFgQueue.push_back(s);
+ processSendQueue();
+}
+
+bool SnacIcqICBM::cancelMessage(SIM::Message* msg)
+{
+ list<Message*>::iterator it;
+ for(it = client()->m_processMsg.begin(); it != m_client->m_processMsg.end(); ++it)
+ if (*it == msg)
+ break;
+ if(it != m_client->m_processMsg.end())
+ {
+ m_client->m_processMsg.erase(it);
+ delete msg;
+ return true;
+ }
+ if(msg->type() == MessageSMS)
+ {
+ for (list<SendMsg>::iterator it = smsQueue.begin(); it != smsQueue.end(); ++it)
+ {
+ if ((*it).msg == msg)
+ {
+ if (it == smsQueue.begin())
+ {
+ (*it).text = QString::null;
+ }
+ else
+ {
+ smsQueue.erase(it);
+ }
+ return msg;
+ }
+ }
+ }
+ else
+ {
+ Contact *contact = getContacts()->contact(msg->contact());
+ if(contact)
+ {
+ ICQUserData *data;
+ ClientDataIterator it(contact->clientData, m_client);
+ while ((data = m_client->toICQUserData(++it)) != NULL)
+ {
+ DirectClient *dc = dynamic_cast<DirectClient*>(data->Direct.object());
+ if (dc && dc->cancelMessage(msg))
+ return msg;
+ }
+ }
+ if(m_send.msg == msg)
+ {
+ m_send.msg = NULL;
+ m_send.screen = QString::null;
+ m_sendTimer->stop();
+ processSendQueue();
+ return msg;
+ }
+ list<SendMsg>::iterator it;
+ for(it = sendFgQueue.begin(); it != sendFgQueue.end(); ++it)
+ {
+ if((*it).msg == msg)
+ {
+ sendFgQueue.erase(it);
+ delete msg;
+ return msg;
+ }
+ }
+ for(it = sendBgQueue.begin(); it != sendBgQueue.end(); ++it)
+ {
+ if ((*it).msg == msg)
+ {
+ sendBgQueue.erase(it);
+ delete msg;
+ return msg;
+ }
+ }
+ for(it = replyQueue.begin(); it != replyQueue.end(); ++it)
+ {
+ if ((*it).msg == msg)
+ {
+ replyQueue.erase(it);
+ delete msg;
+ return msg;
+ }
+ }
+ }
+ return true;
+}
+
+void SnacIcqICBM::sendSMS(SendMsg msg)
+{
+ smsQueue.push_back(msg);
+ m_client->processSMSQueue();
+}
+
+void SnacIcqICBM::pluginInfoRequest(unsigned long uin, unsigned plugin_index)
+{
+ list<SendMsg>::iterator it;
+ for (it = sendBgQueue.begin(); it != sendBgQueue.end(); ++it){
+ SendMsg &s = *it;
+ if((s.screen.toULong() == uin) && (s.flags == plugin_index) && (s.msg == NULL))
+ break;
+ }
+ if (it != sendBgQueue.end())
+ return;
+ SendMsg s;
+ s.screen = QString::number(uin);
+ s.flags = plugin_index;
+ sendBgQueue.push_back(s);
+ processSendQueue();
+}
+
+bool SnacIcqICBM::process(unsigned short subtype, ICQBuffer* buf, unsigned short seq)
+{
+ switch (subtype){
+ case ICQ_SNACxMSG_RIGHTSxGRANTED:
+ log(L_DEBUG, "Message rights granted");
+ break;
+ case ICQ_SNACxMSG_MTN:{
+ buf->incReadPos(10);
+ QString screen = buf->unpackScreen();
+ unsigned short type; //Fixme!!! Local declaration of 'type' hides declaration of the same name in outer scope: Function parameter "type"
+ *buf >> type;
+ bool bType = (type > 1);
+ Contact *contact;
+ ICQUserData *data = m_client->findContact(screen, NULL, false, contact);
+ if (data == NULL)
+ break;
+ if (data->bTyping.toBool() == bType)
+ break;
+ data->bTyping.asBool() = bType;
+ EventContact e(contact, EventContact::eStatus);;
+ e.process();
+ break;
+ }
+ case ICQ_SNACxMSG_ERROR:{
+ if(seq == 0)
+ break;
+ unsigned short error;
+ *buf >> error;
+ QString err_str = I18N_NOOP("Unknown error");
+ if ((error == 0x0009) &&
+ ((m_send.msg == NULL) || (m_send.msg->type() != MessageContacts))){
+ err_str = I18N_NOOP("Not supported by client");
+ Contact *contact;
+ ICQUserData *data = m_client->findContact(m_send.screen, NULL, false, contact);
+ if (data){
+ list<SendMsg>::iterator it;
+ for (it = sendFgQueue.begin(); it != sendFgQueue.end();){
+ if ((*it).screen != m_send.screen){
+ ++it;
+ continue;
+ }
+ if ((*it).msg){
+ (*it).flags = 0;
+ ++it;
+ continue;
+ }
+ sendFgQueue.erase(it);
+ it = sendFgQueue.begin();
+ }
+ for (it = sendBgQueue.begin(); it != sendBgQueue.end();){
+ if ((*it).screen != m_send.screen){
+ ++it;
+ continue;
+ }
+ if ((*it).msg){
+ (*it).flags = 0;
+ ++it;
+ continue;
+ }
+ sendBgQueue.erase(it);
+ it = sendBgQueue.begin();
+ }
+ data->bBadClient.asBool() = true;
+ if (m_send.msg)
+ sendThruServer(m_send.msg, data);
+ m_send.msg = NULL;
+ m_send.screen = QString::null;
+ m_sendTimer->stop();
+ processSendQueue();
+ break;
+ }
+ }else{
+ err_str = m_client->error_message(error);
+ }
+ if(error == 2)
+ m_client->snacService()->requestRateInfo();
+ if (m_send.msg){
+ m_send.msg->setError(err_str);
+ EventMessageSent(m_send.msg).process();
+ delete m_send.msg;
+ }
+ m_send.msg = NULL;
+ m_send.screen = QString::null;
+ m_sendTimer->stop();
+ processSendQueue();
+ break;
+ }
+ case ICQ_SNACxMSG_SRV_MISSED_MSG: {
+ unsigned short mFormat; // missed channel
+ QString screen; // screen
+ unsigned short wrnLevel;// warning level
+ unsigned short nTlv; // number of tlvs
+ TlvList lTlv; // all tlvs in message
+ unsigned short missed; // number of missed messages
+ unsigned short error; // error reason
+ socket()->readBuffer() >> mFormat;
+ screen = socket()->readBuffer().unpackScreen();
+ socket()->readBuffer() >> wrnLevel;
+ socket()->readBuffer() >> nTlv;
+ for(unsigned i = 0; i < nTlv; i++) {
+ unsigned short num;
+ unsigned short size;
+ const char* data;
+ *buf >> num >> size;
+ data = buf->data(socket()->readBuffer().readPos());
+ Tlv* tlv = new Tlv(num,size,data);
+ lTlv += tlv;
+ }
+ *buf >> missed >> error;
+ const char *err_str = NULL;
+ switch (error) {
+ case 0x00:
+ err_str = I18N_NOOP("Invalid message");
+ break;
+ case 0x01:
+ err_str = I18N_NOOP("Message was too large");
+ break;
+ case 0x02:
+ err_str = I18N_NOOP("Message rate exceeded");
+ break;
+ case 0x03:
+ err_str = I18N_NOOP("Sender too evil");
+ break;
+ case 0x04:
+ err_str = I18N_NOOP("We are to evil :(");
+ break;
+ default:
+ err_str = I18N_NOOP("Unknown error");
+ }
+ log(L_DEBUG, "ICMB error %u (%s) - screen(%s)", error, err_str, screen.latin1());
+ break;
+ }
+ case ICQ_SNACxMSG_BLAMExSRVxACK:
+ if((m_send.id.id_l == seq) && m_send.msg)
+ {
+ unsigned short oldLevel, newLevel;
+ *buf >> oldLevel >> newLevel;
+ WarningMessage *msg = static_cast<WarningMessage*>(m_send.msg);
+ msg->setOldLevel((unsigned short)(newLevel - oldLevel));
+ msg->setNewLevel(newLevel);
+ ackMessage(m_send);
+ }
+ break;
+ case ICQ_SNACxMSG_ACK:
+ {
+ MessageId id;
+ *buf >> id.id_l >> id.id_h;
+ buf->incReadPos(2);
+ QString screen = buf->unpackScreen();
+ bool bAck = false;
+ if (m_send.id == id){
+ if(screen.lower() == m_send.screen.lower())
+ bAck = true;
+ }
+ if (bAck){
+ log(L_DEBUG, "Ack: %lu %lu (%s)", m_send.id.id_h, m_send.id.id_l, m_send.screen.latin1());
+ if (m_send.msg){
+ Contact *contact;
+ ICQUserData *data = m_client->findContact(screen, NULL, false, contact);
+ if (((data == NULL) ||
+ (data->Status.toULong() == ICQ_STATUS_OFFLINE) ||
+ (m_client->getAckMode() == 1)) &&
+ (m_send.msg->type() != MessageFile)){
+ m_sendTimer->stop();
+ ackMessage(m_send);
+ return true;
+ }else{
+ replyQueue.push_back(m_send);
+ }
+ }else{
+ replyQueue.push_back(m_send);
+ }
+ }
+ m_send.msg = NULL;
+ m_send.screen = QString::null;
+ m_sendTimer->stop();
+ processSendQueue();
+ break;
+ }
+ case ICQ_SNACxMSG_AUTOREPLY:{
+ MessageId id;
+ unsigned short len, channel, reason, version;
+ *buf >> id.id_l >> id.id_h;
+ buf->unpack(channel);
+ if (channel == 1) {
+ log(L_DEBUG,"Please send paket to developer!");
+ return true;
+ }
+ QString screen = buf->unpackScreen();
+ buf->unpack(reason);
+ buf->unpack(len);
+ buf->unpack(version);
+ plugin p;
+ buf->unpack((char*)p, sizeof(p));
+ buf->incReadPos(len - sizeof(plugin) + 2);
+ buf->unpack(len);
+ buf->incReadPos(len + 12);
+ unsigned short ackFlags, msgFlags;
+ buf->unpack(ackFlags);
+ buf->unpack(msgFlags);
+
+ list<SendMsg>::iterator it;
+ for (it = replyQueue.begin(); it != replyQueue.end(); ++it){
+ SendMsg &s = *it;
+ if ((s.id == id) && (s.screen == screen))
+ break;
+ }
+ if (it == replyQueue.end())
+ break;
+
+ unsigned plugin_type = (*it).flags;
+ if (plugin_type == PLUGIN_AIM_FT_ACK){
+ m_client->m_processMsg.push_back((*it).msg);
+ replyQueue.erase(it);
+ break;
+ }
+ if ((*it).msg){
+ QCString answer;
+ socket()->readBuffer() >> answer;
+ if (ackMessage((*it).msg, ackFlags, answer)){
+ ackMessage(*it);
+ }else{
+ EventMessageSent((*it).msg).process();
+ delete (*it).msg;
+ }
+ replyQueue.erase(it);
+ break;
+ }
+
+ replyQueue.erase(it);
+ Contact *contact;
+ ICQUserData *data = m_client->findContact(screen, NULL, false, contact);
+
+ if (memcmp(p, m_client->plugins[PLUGIN_NULL], sizeof(plugin))){
+ unsigned plugin_index;
+ for (plugin_index = 0; plugin_index < PLUGIN_NULL; plugin_index++){
+ if (memcmp(p, m_client->plugins[plugin_index], sizeof(plugin)) == 0)
+ break;
+ }
+ if (plugin_index == PLUGIN_NULL){
+ QString plugin_str;
+ unsigned i;
+ for (i = 0; i < sizeof(plugin); i++){
+ char b[4];
+ sprintf(b, "%02X ", p[i]);
+ plugin_str += b;
+ }
+ log(L_WARN, "Unknown plugin sign in reply %s", plugin_str.latin1());
+ break;
+ }
+ if ((data == NULL) && (plugin_index != PLUGIN_RANDOMxCHAT))
+ break;
+ m_client->parsePluginPacket(socket()->readBuffer(), plugin_type, data, screen.toULong(), false);
+ break;
+ }
+
+ if (plugin_type == PLUGIN_AR){
+ QCString answer;
+ *buf >> answer;
+ log(L_DEBUG, "Autoreply from %s %s", screen.latin1(), answer.data());
+ Contact *contact; //Fixme: Local declaration of 'contact' hides declaration of the same name in outer scope, see previous declaration at line '300'
+ ICQUserData *data = m_client->findContact(screen, NULL, false, contact);
+ if (data && data->AutoReply.setStr(getContacts()->toUnicode(contact, answer))){
+ EventContact e(contact, EventContact::eChanged);
+ e.process();
+ }
+ }
+ break;
+ }
+ case ICQ_SNACxMSG_SERVERxMESSAGE:{
+ MessageId id;
+ *buf >> id.id_l >> id.id_h;
+ unsigned short mFormat;
+ *buf >> mFormat;
+ QString screen = buf->unpackScreen();
+ log(L_DEBUG, "Message from %s [%04X]", screen.latin1(), mFormat);
+ unsigned short level, nTLV;
+ *buf >> level >> nTLV;
+ TlvList tlvFixed(*buf, nTLV);
+ TlvList tlvChannel(*buf);
+ switch (mFormat){
+ case 0x0001:{
+ if (!tlvChannel(2)){
+ log(L_WARN, "TLV 0x0002 not found");
+ break;
+ }
+ ICQBuffer m(*tlvChannel(2));
+ TlvList tlv_msg(m);
+ Tlv *m_tlv = tlv_msg(0x101);
+ if (m_tlv == NULL){
+ log(L_WARN, "TLV 0x0101 not found");
+ break;
+ }
+ if (m_tlv->Size() <= 4){
+ log(L_WARN, "Bad TLV 0x0101 size (%d)",m_tlv->Size());
+ break;
+ }
+ char *m_data = (*m_tlv);
+ unsigned short encoding = (unsigned short)((m_data[0] << 8) + m_data[1]);
+ m_data += 4;
+ if(encoding == 2)
+ {
+ QString text;
+ for (int i = 0; i < m_tlv->Size() - 5; i += 2){
+ unsigned char r1 = *(m_data++);
+ unsigned char r2 = *(m_data++);
+ unsigned short c = (unsigned short)((r1 << 8) + r2);
+ text += QChar(c);
+ }
+ Message *msg = new Message(MessageGeneric);
+ if (screen.toULong()){
+ msg->setText(text);
+ }else{
+ unsigned bgColor = m_client->clearTags(text);
+ msg->setText(text);
+ msg->setBackground(bgColor);
+ msg->setFlags(MESSAGE_RICHTEXT);
+ }
+ log(L_DEBUG, "Message %s", (const char*)text.local8Bit().data());
+ m_client->messageReceived(msg, screen);
+ break;
+ }
+ log(L_DEBUG, "ServerText: %s", m_data);
+ Message *msg = new Message;
+ if (!m_client->m_bAIM && screen.toULong()){
+ msg->setServerText(m_data);
+ }else{
+ QString text = m_data;
+ unsigned bgColor = m_client->clearTags(text);
+ msg->setServerText(m_data);
+ msg->setBackground(bgColor);
+ msg->setFlags(MESSAGE_RICHTEXT);
+ }
+ m_client->messageReceived(msg, screen);
+ break;
+ }
+ case 0x0002:{
+ Tlv *tlv5 = tlvChannel(5);
+ if(!tlv5)
+ {
+ log(L_WARN, "TLV 0x0005 not found");
+ break;
+ }
+ ICQBuffer msg(*tlv5);
+ unsigned short type; //Fixme: Local declaration of 'type' hides declaration of the same name in outer scope, see previous declaration at line '73'
+ msg >> type;
+ switch (type){
+ case 0:
+ parseAdvancedMessage(screen, msg, tlvChannel(3) != NULL, id);
+ break;
+ case 1:
+ {
+ Contact *contact;
+ ICQUserData *data = m_client->findContact(screen, NULL, false, contact);
+ if (data){
+ QString name = m_client->dataName(data);
+ for (list<Message*>::iterator it = m_client->m_acceptMsg.begin(); it != m_client->m_acceptMsg.end(); ++it){
+ Message *msg = *it; //Fixme: Local declaration of 'msg' hides declaration of the same name in outer scope, see previous declaration at line '413'
+ if (msg->client() && (name == msg->client())){
+ MessageId msg_id;
+ switch (msg->type()){
+ case MessageICQFile:
+ msg_id.id_l = static_cast<ICQFileMessage*>(msg)->getID_L();
+ msg_id.id_h = static_cast<ICQFileMessage*>(msg)->getID_H();
+ break;
+ case MessageFile:
+ msg_id.id_l = static_cast<AIMFileMessage*>(msg)->getID_L();
+ msg_id.id_h = static_cast<AIMFileMessage*>(msg)->getID_H();
+ break;
+ }
+ if (msg_id == id)
+ {
+ m_client->m_acceptMsg.erase(it);
+ EventMessageDeleted(msg).process();
+ delete msg;
+ break;
+ }
+ }
+ }
+ }
+ break;
+ }
+ case 2:
+ log(L_DEBUG, "File ack");
+ break;
+ default:
+ log(L_WARN, "Unknown type: 0x%04X", type);
+ }
+ break;
+ }
+ case 0x0004:{
+ Tlv *tlv5 = tlvChannel(5);
+ if (!tlv5){
+ log(L_WARN, "TLV 0x0005 not found");
+ break;
+ }
+ ICQBuffer msg(*tlv5);
+ unsigned long msg_uin;
+ msg >> msg_uin;
+ if (msg_uin == 0){
+ parseAdvancedMessage(screen, msg, tlvChannel(6) != NULL, id);
+ return true;
+ }
+ unsigned char type, flags; //Fixme: Local declaration of 'type' hides declaration of the same name in outer scope, see previous declaration at line '73'
+ QCString msg_str;
+ msg >> type;
+ msg >> flags;
+ msg >> msg_str;
+ Message *m = m_client->parseMessage(type, screen, msg_str, msg, id, 0);
+ if (m)
+ m_client->messageReceived(m, screen);
+ break;
+ }
+ default:
+ log(L_WARN, "Unknown message format %04X", mFormat);
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ return true;
+}
+
+void SnacIcqICBM::parseAdvancedMessage(const QString &screen, ICQBuffer &m, bool needAck, MessageId id)
{
- log(L_DEBUG, "ICQClient::parseAdvancedMessage");
m.incReadPos(8); /* msg-id cookie */
capability cap;
m.unpack((char*)cap, sizeof(cap));
- if (!memcmp(cap, capabilities[CAP_DIRECT], sizeof(cap)))
+ if (!memcmp(cap, m_client->capabilities[CAP_DIRECT], sizeof(cap)))
{
TlvList tlv(m);
if(!tlv(0x2711))
@@ -1035,7 +1460,7 @@
return;
}
Contact *contact;
- ICQUserData *data = findContact(screen, NULL, false, contact);
+ ICQUserData *data = m_client->findContact(screen, NULL, false, contact);
if ((data == NULL) || contact->getIgnore()){
log(L_DEBUG, "Reverse direct request from unknown user");
return;
@@ -1044,26 +1469,17 @@
set_ip(&data->RealIP, localIP);
in_addr addr;
addr.s_addr = localIP;
- for (list<Message*>::iterator it = m_processMsg.begin(); it != m_processMsg.end(); ++it){
+ for (list<Message*>::iterator it = m_client->m_processMsg.begin(); it != m_client->m_processMsg.end(); ++it){
if ((*it)->type() != MessageICQFile)
continue;
ICQFileMessage *msg = static_cast<ICQFileMessage*>(*it);
if (msg->m_transfer == NULL)
continue;
- /*
- AIMFileTransfer *ft = static_cast<AIMFileTransfer*>(msg->m_transfer);
- if (ft->m_localPort == remotePort){
- log(L_DEBUG, "Setup file transfer reverse connect to %s %s:%lu",
- screen.local8Bit().data(), inet_ntoa(addr), localPort);
- ft->reverseConnect(localIP, localPort);
- return;
- }
- */
}
log(L_DEBUG, "Setup reverse connect to %s %s:%lu",
screen.local8Bit().data(), inet_ntoa(addr), localPort);
- DirectClient *direct = new DirectClient(data, this);
- m_sockets.push_back(direct);
+ DirectClient *direct = new DirectClient(data, m_client);
+ m_client->m_sockets.push_back(direct);
direct->reverseConnect(localIP, localPort);
return;
}
@@ -1088,7 +1504,7 @@
if(real_ip || ip)
{
Contact *contact;
- ICQUserData *data = findContact(screen, NULL, false, contact);
+ ICQUserData *data = m_client->findContact(screen, NULL, false, contact);
if (data)
{
//if(real_ip && (get_ip(data->RealIP) == 0))
@@ -1101,18 +1517,19 @@
}
}
- if (!memcmp(cap, capabilities[CAP_AIM_IMIMAGE], sizeof(cap))){
+ if (!memcmp(cap, m_client->capabilities[CAP_AIM_IMIMAGE], sizeof(cap))){
log(L_DEBUG, "AIM set direct connection");
return;
}
- if (!memcmp(cap, capabilities[CAP_AIM_SENDFILE], sizeof(cap)))
+ if (!memcmp(cap, m_client->capabilities[CAP_AIM_SENDFILE], sizeof(cap)))
{
- icmbSendFile(tlv, test_ip, ip, port, screen, id);
+ sendFile(tlv, test_ip, ip, port, screen, id);
return;
}
- if (!memcmp(cap, capabilities[CAP_AIM_BUDDYLIST], sizeof(cap))){
+ if (!memcmp(cap, m_client->capabilities[CAP_AIM_BUDDYLIST], sizeof(cap)))
+ {
log(L_DEBUG, "AIM buddies list");
if (!tlv(0x2711)){
log(L_WARN, "No body in ICMB message found");
@@ -1143,18 +1560,18 @@
}
}
}
- snac(ICQ_SNACxFOOD_MESSAGE, ICQ_SNACxMSG_AUTOREPLY);
+ m_client->snac(ICQ_SNACxFOOD_MESSAGE, ICQ_SNACxMSG_AUTOREPLY);
socket()->writeBuffer() << id.id_l << id.id_h << 0x0002;
socket()->writeBuffer().packScreen(screen);
socket()->writeBuffer() << 0x0003 << 0x0002 << 0x0002;
- sendPacket(false);
+ m_client->sendPacket(false);
ContactsMessage *msg = new ContactsMessage;
msg->setContacts(contacts);
- messageReceived(msg, screen);
+ m_client->messageReceived(msg, screen);
return;
}
- if (memcmp(cap, capabilities[CAP_SRV_RELAY], sizeof(cap))){
+ if (memcmp(cap, m_client->capabilities[CAP_SRV_RELAY], sizeof(cap))){
QString s;
for (unsigned i = 0; i < sizeof(cap); i++){
char b[5];
@@ -1193,10 +1610,10 @@
adv.unpack(len);
adv.incReadPos(len + 10);
- if (memcmp(p, plugins[PLUGIN_NULL], sizeof(p))){
+ if (memcmp(p, m_client->plugins[PLUGIN_NULL], sizeof(p))){
unsigned plugin_index;
for (plugin_index = 0; plugin_index < PLUGIN_NULL; plugin_index++)
- if (memcmp(p, plugins[plugin_index], sizeof(p)) == 0)
+ if (memcmp(p, m_client->plugins[plugin_index], sizeof(p)) == 0)
break;
if (plugin_index >= PLUGIN_NULL){
QString sign;
@@ -1231,7 +1648,7 @@
adv.unpack((char*)p, sizeof(p));
unsigned plugin_type;
for (plugin_type = 0; plugin_type < PLUGIN_NULL; plugin_type++){
- if (memcmp(p, plugins[plugin_type], sizeof(p)) == 0)
+ if (memcmp(p, m_client->plugins[plugin_type], sizeof(p)) == 0)
break;
}
if (plugin_type >= PLUGIN_NULL){
@@ -1239,8 +1656,8 @@
return;
}
ICQBuffer info;
- pluginAnswer(plugin_type, screen.toULong(), info);
- sendAutoReply(screen, id, plugins[plugin_index],
+ m_client->pluginAnswer(plugin_type, screen.toULong(), info);
+ sendAutoReply(screen, id, m_client->plugins[plugin_index],
cookie1, cookie2, 0, 0, 0x0200, QString::null, 1, info);
return;
}
@@ -1276,11 +1693,11 @@
break;
}
Contact *contact;
- ICQUserData *data = findContact(screen, NULL, false, contact);
+ ICQUserData *data = m_client->findContact(screen, NULL, false, contact);
if (data == NULL)
return;
- if ((getInvisible() && (data->VisibleId.toULong() == 0)) ||
- (!getInvisible() && data->InvisibleId.toULong()))
+ if ((m_client->getInvisible() && (data->VisibleId.toULong() == 0)) ||
+ (!m_client->getInvisible() && data->InvisibleId.toULong()))
return;
ar_request req;
req.screen = screen;
@@ -1290,18 +1707,18 @@
req.id1 = cookie1;
req.id2 = cookie2;
req.bDirect = false;
- arRequests.push_back(req);
+ m_client->arRequests.push_back(req);
ARRequest ar;
ar.contact = contact;
- ar.param = &arRequests.back();
- ar.receiver = this;
+ ar.param = &m_client->arRequests.back();
+ ar.receiver = m_client;
ar.status = req_status;
EventARRequest(&ar).process();
if (!msg.isEmpty()){
Contact *contact; //Fixme: Local declaration of 'contact' hides declaration of the same name in outer scope, see previous declaration at line '1278'
- ICQUserData *data = findContact(screen, NULL, false, contact); //Fixme: Local declaration of 'data' hides declaration of the same name in outer scope, see previous declaration at line '1279'
+ ICQUserData *data = m_client->findContact(screen, NULL, false, contact); //Fixme: Local declaration of 'data' hides declaration of the same name in outer scope, see previous declaration at line '1279'
QString m = getContacts()->toUnicode(contact, msg); //Fixme: Local declaration of 'm' hides declaration of the same name in outer scope. For additional information, see previous declaration at line '1006'
data->AutoReply.str() = m;
EventContact e(contact, EventContact::eChanged);
@@ -1316,7 +1733,7 @@
copy.pack(adv.data(adv.readPos()), adv.writePos() - adv.readPos());
log(L_DEBUG, "Msg size=%lu type=%u", (unsigned long) msg.size(), msgType);
if (msg.size() || (msgType == ICQ_MSGxEXT)){
- Message *m = parseMessage(msgType, screen, msg, adv, id, cookie1 | (cookie2 << 16)); //Fixme: Local declaration of 'm' hides declaration of the same name in outer scope. For additional information, see previous declaration at line '1006'
+ Message *m = m_client->parseMessage(msgType, screen, msg, adv, id, cookie1 | (cookie2 << 16)); //Fixme: Local declaration of 'm' hides declaration of the same name in outer scope. For additional information, see previous declaration at line '1006'
if (m){
if ((m_send.id == id) && (m_send.screen == screen)){
replyQueue.push_back(m_send);
@@ -1342,15 +1759,15 @@
if (m->type() == MessageStatus){
bAccept = false;
}else{
- switch (getStatus()){
+ switch (m_client->getStatus()){
case STATUS_DND:
- if (getAcceptInDND())
+ if (m_client->getAcceptInDND())
break;
ackFlags = ICQ_TCPxACK_DND;
bAccept = false;
break;
case STATUS_OCCUPIED:
- if (getAcceptInOccupied())
+ if (m_client->getAcceptInOccupied())
break;
ackFlags = ICQ_TCPxACK_OCCUPIED;
bAccept = false;
@@ -1361,7 +1778,7 @@
}
if (!bAccept){
Contact *contact;
- ICQUserData *data = findContact(screen, NULL, false, contact);
+ ICQUserData *data = m_client->findContact(screen, NULL, false, contact);
if (data == NULL)
return;
@@ -1373,13 +1790,13 @@
req.id1 = cookie1;
req.id2 = cookie2;
req.bDirect = false;
- arRequests.push_back(req);
+ m_client->arRequests.push_back(req);
ARRequest ar;
ar.contact = contact;
- ar.param = &arRequests.back();
- ar.receiver = this;
- ar.status = getStatus();
+ ar.param = &m_client->arRequests.back();
+ ar.receiver = m_client;
+ ar.status = m_client->getStatus();
EventARRequest(&ar).process();
return;
}
@@ -1388,7 +1805,7 @@
m->setFlags(m->getFlags() | MESSAGE_URGENT);
if (msgFlags & ICQ_TCPxMSG_LIST)
m->setFlags(m->getFlags() | MESSAGE_LIST);
- needAck = messageReceived(m, screen);
+ needAck = m_client->messageReceived(m, screen);
}
else
{
@@ -1397,7 +1814,7 @@
if(msg->type() == MessageFile)
{
Contact *contact;
- ICQUserData *data = findContact(screen, NULL, false, contact);
+ ICQUserData *data = m_client->findContact(screen, NULL, false, contact);
if ((m->type() != MessageICQFile) || (data == NULL)){
log(L_WARN, "Bad answer type");
msg->setError(I18N_NOOP("Send failed"));
@@ -1405,17 +1822,13 @@
delete msg;
return;
}
- if(m_state == 1)
+ if(m_client->m_state == 1)
{
msg->setError(I18N_NOOP("Message declined"));
EventMessageSent(msg).process();
delete msg;
return;
}
- //AIMFileTransfer *ft = new AIMOutcomingFileTransfer(static_cast<FileMessage*>(msg), data, this); //ft is not used, remove?
- //EventMessageAcked(msg).process();
- //m_processMsg.push_back(msg);
- //ft->connect(static_cast<AIMFileMessage*>(m)->getPort());
}
else
{
@@ -1432,54 +1845,6 @@
msgType, 0, 0, QString::null, 0, copy); //variable p seems corrupted, maybe crash?
}
-void ICQClient::sendAutoReply(const QString &screen, MessageId id,
- const plugin p, unsigned short cookie1, unsigned short cookie2,
- unsigned short msgType, char msgFlags, unsigned short msgState,
- const QString &response, unsigned short response_type, ICQBuffer ©)
-{
- snac(ICQ_SNACxFOOD_MESSAGE, ICQ_SNACxMSG_AUTOREPLY);
- socket()->writeBuffer() << id.id_l << id.id_h << 0x0002;
- socket()->writeBuffer().packScreen(screen);
- socket()->writeBuffer() << 0x0003 << 0x1B00 << 0x0800;
- socket()->writeBuffer().pack((char*)p, sizeof(plugin));
- socket()->writeBuffer() << 0x03000000L << (char)0;
- socket()->writeBuffer().pack(cookie1);
- socket()->writeBuffer().pack(cookie2);
- socket()->writeBuffer().pack(cookie1);
- socket()->writeBuffer() << 0x00000000L << 0x00000000L << 0x00000000L;
- socket()->writeBuffer().pack(msgType);
- socket()->writeBuffer() << msgFlags << msgState << (char)0;
- if (!response.isEmpty()){
- Contact *contact = NULL;
- findContact(screen, NULL, false, contact);
- QCString r = getContacts()->fromUnicode(contact, response);
- unsigned short size = (unsigned short)(r.length() + 1);
- socket()->writeBuffer().pack(size);
- socket()->writeBuffer().pack(r.data(), size);
- }else{
- socket()->writeBuffer() << (char)0x01 << response_type;
- }
- if (response_type != 3){
- if (copy.size()){
- socket()->writeBuffer().pack(copy.data(0), copy.writePos());
- }else{
- socket()->writeBuffer() << 0x00000000L << 0xFFFFFF00L;
- }
- }
- sendPacket(false);
-}
-
-void ICQClient::sendMTN(const QString &screen, unsigned short type)
-{
- if (getDisableTypingNotification())
- return;
- snac(ICQ_SNACxFOOD_MESSAGE, ICQ_SNACxMSG_MTN);
- socket()->writeBuffer() << 0x00000000L << 0x00000000L << (unsigned short)0x0001;
- socket()->writeBuffer().packScreen(screen);
- socket()->writeBuffer() << type;
- sendPacket(true);
-}
-
class AIMParser : public HTMLParser
{
public:
@@ -1607,38 +1972,22 @@
res += ">";*/
}
-void ICQClient::sendTimeout()
-{
- m_sendTimer->stop();
- if (m_send.screen.length()){
- log(L_WARN, "Send timeout");
- if (m_send.msg){
- m_send.msg->setError(I18N_NOOP("Send timeout"));
- EventMessageSent(m_send.msg).process();
- delete m_send.msg;
- }
- m_send.msg = NULL;
- m_send.screen = QString::null;
- }
- processSendQueue();
-}
-
-void ICQClient::processSendQueue()
+void SnacIcqICBM::processSendQueue()
{
if (m_sendTimer->isActive())
return;
- m_processTimer->stop();
- if (m_bNoSend)
+ m_client->m_processTimer->stop();
+ if (m_client->m_bNoSend)
return;
- if (getState() != Connected){
+ if (m_client->getState() != Client::Connected){
m_sendTimer->stop();
return;
}
unsigned delay = 0;
unsigned send_delay = 0;
- if (m_bReady){
+ if (m_client->m_bReady){
while (!sendFgQueue.empty()){
- send_delay = delayTime(SNAC(ICQ_SNACxFOOD_MESSAGE, ICQ_SNACxMSG_SENDxSERVER));
+ send_delay = m_client->delayTime(SNAC(ICQ_SNACxFOOD_MESSAGE, ICQ_SNACxMSG_SENDxSERVER));
if (send_delay){
delay = send_delay;
break;
@@ -1652,44 +2001,44 @@
m_sendTimer->stop();
}
}
- send_delay = processSMSQueue();
+ send_delay = m_client->processSMSQueue();
if (send_delay && (delay > send_delay))
delay = send_delay;
- for (unsigned i = 0; i < m_rates.size(); i++){
- RateInfo &r = m_rates[i];
+ for (unsigned i = 0; i < m_client->m_rates.size(); i++){
+ RateInfo &r = m_client->m_rates[i];
for (;;){
if (r.delayed.readPos() == r.delayed.writePos())
break;
- send_delay = delayTime(r);
+ send_delay = m_client->delayTime(r);
if (send_delay){
log(L_DEBUG, "Delay for group %d: %u", i, send_delay);
- m_processTimer->start(send_delay);
+ m_client->m_processTimer->start(send_delay);
return;
}
unsigned char *packet = (unsigned char*)(r.delayed.data(r.delayed.readPos()));
unsigned size = (packet[4] << 8) + packet[5] + 6;
- ++m_nFlapSequence;
- packet[2] = (m_nFlapSequence >> 8);
- packet[3] = m_nFlapSequence;
+ ++m_client->m_nFlapSequence;
+ packet[2] = (m_client->m_nFlapSequence >> 8);
+ packet[3] = m_client->m_nFlapSequence;
socket()->writeBuffer().packetStart();
socket()->writeBuffer().pack(r.delayed.data(r.delayed.readPos()), size);
EventLog::log_packet(socket()->writeBuffer(), true, ICQPlugin::icq_plugin->OscarPacket);
r.delayed.incReadPos(size);
- setNewLevel(r);
+ m_client->setNewLevel(r);
socket()->write();
}
if (r.delayed.readPos() == r.delayed.writePos())
r.delayed.init(0);
}
- send_delay = processInfoRequest();
+ send_delay = m_client->processInfoRequest();
if (send_delay && (delay > send_delay))
delay = send_delay;
- send_delay = processListRequest();
+ send_delay = m_client->processListRequest();
if (send_delay && (delay > send_delay))
delay = send_delay;
- if (m_bReady){
+ if (m_client->m_bReady){
while (!sendBgQueue.empty()){
- send_delay = delayTime(SNAC(ICQ_SNACxFOOD_MESSAGE, ICQ_SNACxMSG_SENDxSERVER));
+ send_delay = m_client->delayTime(SNAC(ICQ_SNACxFOOD_MESSAGE, ICQ_SNACxMSG_SENDxSERVER));
if (send_delay){
if (send_delay < delay)
delay = send_delay;
@@ -1705,7 +2054,7 @@
}
if (delay){
log(L_DEBUG, "Delay: %u", delay);
- m_processTimer->start(delay);
+ m_client->m_processTimer->start(delay);
}
}
@@ -1753,10 +2102,11 @@
return res;
}
-bool ICQClient::processMsg()
+bool SnacIcqICBM::processMsg()
{
+ log(L_DEBUG, "SnacIcqICBM::processMsg()");
Contact *contact;
- ICQUserData *data = findContact(m_send.screen, NULL, false, contact);
+ ICQUserData *data = m_client->findContact(m_send.screen, NULL, false, contact);
if ((data == NULL) && (m_send.flags != PLUGIN_RANDOMxCHAT)){
if (m_send.msg != NULL)
{
@@ -1784,7 +2134,7 @@
case MessageContacts:
if (data->Uin.toULong() == 0){
CONTACTS_MAP c;
- QString nc = packContacts(static_cast<ContactsMessage*>(m_send.msg), data, c);
+ QString nc = m_client->packContacts(static_cast<ContactsMessage*>(m_send.msg), data, c);
if (c.empty()){
m_send.msg->setError(I18N_NOOP("No contacts for send"));
EventMessageSent(m_send.msg).process();
@@ -1846,7 +2196,7 @@
case MessageUrl:{
if (data->Uin.toULong() == 0)
break;
- packMessage(b, m_send.msg, data, type, false);
+ m_client->packMessage(b, m_send.msg, data, type, false);
QString err = m_send.msg->getError();
if (!err.isEmpty()){
EventMessageSent(m_send.msg).process();
@@ -1855,10 +2205,10 @@
m_send.screen = QString::null;
return false;
}
- sendThroughServer(screen(data), 4, b, m_send.id, true, false);
+ sendThroughServer(m_client->screen(data), 4, b, m_send.id, true, false);
if (data->Status.toULong() != ICQ_STATUS_OFFLINE)
m_sendTimer->stop();
- if ((data->Status.toULong() != ICQ_STATUS_OFFLINE) || (getAckMode() == 0))
+ if ((data->Status.toULong() != ICQ_STATUS_OFFLINE) || (m_client->getAckMode() == 0))
ackMessage(m_send);
return true;
}
@@ -1866,9 +2216,9 @@
{
log(L_DEBUG, "processMsg: MessageFile");
MessageId id;
- generateCookie(id);
+ m_client->generateCookie(id);
FileMessage* msg = static_cast<FileMessage*>(m_send.msg);
- AIMOutcomingFileTransfer *ft = new AIMOutcomingFileTransfer(msg, data, this);
+ AIMOutcomingFileTransfer *ft = new AIMOutcomingFileTransfer(msg, data, m_client);
ft->setICBMCookie(id);
ft->listen();
QString filename = msg->getDescription();
@@ -1879,21 +2229,22 @@
}
case MessageWarning:{
WarningMessage *msg = static_cast<WarningMessage*>(m_send.msg);
- snac(ICQ_SNACxFOOD_MESSAGE, ICQ_SNACxMSG_BLAMExUSER, true);
- m_send.id.id_l = m_nMsgSequence;
+ m_client->snac(ICQ_SNACxFOOD_MESSAGE, ICQ_SNACxMSG_BLAMExUSER, true);
+ m_send.id.id_l = m_client->m_nMsgSequence;
unsigned short flag = 0;
if (msg->getAnonymous())
flag = 1;
socket()->writeBuffer() << flag;
- socket()->writeBuffer().packScreen(screen(data));
- sendPacket(false);
+ socket()->writeBuffer().packScreen(m_client->screen(data));
+ m_client->sendPacket(false);
return true;
}
}
QCString text;
+ log(L_DEBUG, "Alpha %x", m_send.flags);
switch (m_send.flags & SEND_MASK){
case SEND_RTF:
- text = createRTF(m_send.text, m_send.part, m_send.msg->getForeground(), contact, MAX_TYPE2_MESSAGE_SIZE);
+ text = m_client->createRTF(m_send.text, m_send.part, m_send.msg->getForeground(), contact, MAX_TYPE2_MESSAGE_SIZE);
break;
case SEND_UTF:
m_send.part = getUtf8Part(m_send.text, MAX_TYPE2_MESSAGE_SIZE);
@@ -1952,7 +2303,7 @@
if (m_send.msg->getFlags() & MESSAGE_LIST)
flags = ICQ_TCPxMSG_LIST;
msgBuf.pack((unsigned short)1);
- msgBuf.pack(msgStatus());
+ msgBuf.pack(m_client->msgStatus());
msgBuf.pack(flags);
msgBuf.pack(size);
msgBuf.pack(text.data(), size);
@@ -1963,7 +2314,7 @@
}
if ((m_send.flags & SEND_MASK) != SEND_TYPE2){
msgBuf << 0x26000000L;
- packCap(msgBuf, capabilities[((m_send.flags & SEND_MASK) == SEND_RTF) ? CAP_RTF : CAP_UTF]);
+ packCap(msgBuf, m_client->capabilities[((m_send.flags & SEND_MASK) == SEND_RTF) ? CAP_RTF : CAP_UTF]);
}
m_send.id.id_l = rand();
m_send.id.id_h = rand();
@@ -1982,9 +2333,9 @@
ICQBuffer b;
b << (unsigned short)0;
b << m_send.id.id_l << m_send.id.id_h;
- b.pack((char*)capabilities[CAP_AIM_SENDFILE], sizeof(capability));
+ b.pack((char*)m_client->capabilities[CAP_AIM_SENDFILE], sizeof(capability));
b.tlv(0x0A, (unsigned short)2);
- b.tlv(0x03, (unsigned long)htonl(get_ip(this->data.owner.RealIP)));
+ b.tlv(0x03, (unsigned long)htonl(get_ip(m_client->data.owner.RealIP)));
b.tlv(0x05, static_cast<AIMFileTransfer*>(msg->m_transfer)->remotePort());
sendThroughServer(m_send.screen, 2, b, m_send.id, false, false);
replyQueue.push_back(m_send);
@@ -2002,7 +2353,7 @@
sprintf(b, "%06X", (unsigned)(m_send.msg->getBackground() & 0xFFFFFF));
QString text = QString("<HTML><BODY BGCOLOR=\"#%1\">%2</BODY></HTML>")
.arg(b)
- .arg(removeImages(m_send.msg->getRichText(), false));
+ .arg(m_client->removeImages(m_send.msg->getRichText(), false));
bool bWide = false;
int i;
for (i = 0; i < (int)(text.length()); i++){
@@ -2054,17 +2405,17 @@
sendType2(m_send.screen, msgBuf, m_send.id, CAP_AIM_SENDFILE, false, m_send.socket->localPort(), &tlvs);
return true;
}
- msgBuf.pack(this->data.owner.Uin.toULong());
- unsigned long ip = get_ip(this->data.owner.IP);
+ msgBuf.pack(m_client->data.owner.Uin.toULong());
+ unsigned long ip = get_ip(m_client->data.owner.IP);
if (ip == get_ip(m_send.socket->m_data->IP))
- ip = get_ip(this->data.owner.RealIP);
+ ip = get_ip(m_client->data.owner.RealIP);
msgBuf.pack(ip);
msgBuf.pack((unsigned long)(m_send.socket->localPort()));
msgBuf.pack((char)MODE_DIRECT);
msgBuf.pack((unsigned long)(m_send.socket->remotePort()));
- msgBuf.pack(this->data.owner.Port.toULong());
+ msgBuf.pack(m_client->data.owner.Port.toULong());
msgBuf.pack((unsigned short)8);
- msgBuf.pack((unsigned long)m_nMsgSequence);
+ msgBuf.pack((unsigned long)m_client->m_nMsgSequence);
sendType2(m_send.screen, msgBuf, m_send.id, CAP_DIRECT, false, 0);
return true;
}
@@ -2088,12 +2439,12 @@
ICQBuffer msg;
msg.pack(type);
- msg.pack((unsigned short)(fullStatus(m_status) & 0xFFFF));
+ msg.pack((unsigned short)(m_client->fullStatus(m_client->m_status) & 0xFFFF));
msg << 0x0100 << 0x0100 << (char)0;
m_send.id.id_l = rand();
m_send.id.id_h = rand();
- sendAdvMessage(screen(data), msg, PLUGIN_NULL, m_send.id, false, false);
+ sendAdvMessage(m_client->screen(data), msg, PLUGIN_NULL, m_send.id, false, false);
return true;
}else if (m_send.flags == PLUGIN_RANDOMxCHAT){
m_send.id.id_l = rand();
@@ -2119,7 +2470,7 @@
b.pack((unsigned short)2);
b.pack((unsigned short)1);
b.pack((char)0);
- b.pack((char*)plugins[plugin_index], sizeof(plugin));
+ b.pack((char*)m_client->plugins[plugin_index], sizeof(plugin));
b.pack((unsigned long)0);
m_send.id.id_l = rand();
@@ -2130,229 +2481,6 @@
return false;
}
-void ICQClient::sendType1(const QString &text, bool bWide, ICQUserData *data)
-{
- ICQBuffer msgBuf;
- if (bWide){
- QByteArray ba(text.length() * 2);
- for (int i = 0; i < (int)text.length(); i++) {
- unsigned short c = text[i].unicode();
- char c1 = (char)((c >> 8) & 0xFF);
- char c2 = (char)(c & 0xFF);
- ba[i * 2 + 0] = c1;
- ba[i * 2 + 1] = c2;
- }
- msgBuf << 0x00020000L;
- msgBuf.pack(ba.data(), ba.size());
- }else{
- QCString msg_text = getContacts()->fromUnicode(getContact(data), text);
- EventSend e(m_send.msg, msg_text);
- e.process();
- msg_text = e.localeText();
- msgBuf << 0x0000FFFFL;
- msgBuf << msg_text.data();
- }
- ICQBuffer b;
- b.tlv(0x0501, "\x01", 1);
- b.tlv(0x0101, msgBuf);
- sendThroughServer(m_send.screen, 1, b, m_send.id, true, true);
- if ((data->Status.toULong() != ICQ_STATUS_OFFLINE) || (getAckMode() == 0))
- ackMessage(m_send);
-}
-
-void ICQClient::accept(Message *msg, ICQUserData *data)
-{
- MessageId id;
- if (msg->getFlags() & MESSAGE_DIRECT){
- Contact *contact = getContacts()->contact(msg->contact());
- ICQUserData *data = NULL; //Fixme: Local declaration of 'data' hides declaration of the same name in outer scope, see previous declaration at line '2163'
- if (contact){
- ClientDataIterator it(contact->clientData, this);
- while ((data = (toICQUserData(++it))) != NULL){
- if (msg->client() && (dataName(data) == msg->client()))
- break;
- data = NULL;
- }
- }
- if (data == NULL){
- log(L_WARN, "Data for request not found");
- return;
- }
- DirectClient *dc = dynamic_cast<DirectClient*>(data->Direct.object());
- if (dc == NULL){
- log(L_WARN, "No direct connection");
- return;
- }
- dc->acceptMessage(msg);
- }else{
- id.id_l = static_cast<ICQFileMessage*>(msg)->getID_L();
- id.id_h = static_cast<ICQFileMessage*>(msg)->getID_H();
- ICQBuffer b;
- unsigned short type = ICQ_MSGxEXT;
- packMessage(b, msg, data, type, false, 0);
- unsigned cookie = static_cast<ICQFileMessage*>(msg)->getCookie();
- sendAdvMessage(screen(data), b, PLUGIN_NULL, id, false, true, (unsigned short)(cookie & 0xFFFF), (unsigned short)((cookie >> 16) & 0xFFFF), 2);
- }
-}
-
-void ICQClient::accept(Message *msg, const QString &dir, OverwriteMode overwrite)
-{
- ICQUserData *data = NULL;
- bool bDelete = true;
- if (msg->client()){
- Contact *contact = getContacts()->contact(msg->contact());
- if (contact){
- ClientDataIterator it(contact->clientData, this);
- while ((data = (toICQUserData(++it))) != NULL){
- if (dataName(data) == msg->client())
- break;
- data = NULL;
- }
- }
- }
- if (data){
- switch (msg->type()){
- case MessageICQFile:{
- ICQFileTransfer *ft = new ICQFileTransfer(static_cast<FileMessage*>(msg), data, this);
- ft->setDir(dir);
- ft->setOverwrite(overwrite);
- EventMessageAcked(msg).process();
- m_processMsg.push_back(msg);
- bDelete = false;
- ft->listen();
- break;
- }
- case MessageFile:
- {
- AIMFileTransfer *ft = new AIMIncomingFileTransfer(static_cast<FileMessage*>(msg), data, this);
- AIMFileMessage* fmsg = static_cast<AIMFileMessage*>(msg);
- fmsg->m_transfer = ft;
- ft->setDir(dir);
- ft->setOverwrite(overwrite);
- EventMessageAcked(msg).process();
- bDelete = false;
- ft->setPort(fmsg->getPort());
- MessageId this_id;
- this_id.id_l = fmsg->getID_L();
- this_id.id_h = fmsg->getID_H();
- ft->setICBMCookie(this_id);
- log(L_DEBUG, "port = %d", fmsg->getPort());
- ft->setStage(1);
- if(fmsg->isProxy)
- {
- ft->setICBMCookie2(fmsg->cookie2);
- ft->setProxyActive(false);
- ft->forceProxyConnection();
- }
- ft->accept();
- return;
- }
- default:
- log(L_DEBUG, "Bad message type %u for accept", msg->type());
- }
- }
- EventMessageDeleted(msg).process();
- if (bDelete)
- {
- delete msg;
- }
-}
-
-void ICQClient::decline(Message *msg, const QString &reason)
-{
- log(L_WARN, "ICQClient::decline");
- if (msg->getFlags() & MESSAGE_DIRECT){
- Contact *contact = getContacts()->contact(msg->contact());
- ICQUserData *data = NULL;
- if (contact){
- ClientDataIterator it(contact->clientData, this);
- while ((data = (toICQUserData(++it))) != NULL){
- if (msg->client() && (dataName(data) == msg->client()))
- break;
- data = NULL;
- }
- }
- if (data == NULL){
- log(L_WARN, "Data for request not found");
- return;
- }
- DirectClient *dc = dynamic_cast<DirectClient*>(data->Direct.object());
- if (dc == NULL){
- log(L_WARN, "No direct connection");
- return;
- }
- dc->declineMessage(msg, reason);
- }else{
- MessageId id;
- unsigned cookie = 0;
- switch (msg->type()){
- case MessageICQFile:
- id.id_l = static_cast<ICQFileMessage*>(msg)->getID_L();
- id.id_h = static_cast<ICQFileMessage*>(msg)->getID_H();
- cookie = static_cast<ICQFileMessage*>(msg)->getCookie();
- break;
- case MessageFile:
- id.id_l = static_cast<AIMFileMessage*>(msg)->getID_L();
- id.id_h = static_cast<AIMFileMessage*>(msg)->getID_H();
- break;
- default:
- log(L_WARN, "Bad type %u for decline", msg->type());
- }
- ICQUserData *data = NULL;
- Contact *contact = NULL;
- if (msg->client()){
- contact = getContacts()->contact(msg->contact());
- if (contact){
- ClientDataIterator it(contact->clientData, this);
- while ((data = (toICQUserData(++it))) != NULL){
- if (dataName(data) == msg->client())
- break;
- data = NULL;
- }
- }
- }
- if (data && (id.id_l || id.id_h)){
- if (msg->type() == MessageICQFile){
- ICQBuffer buf, msgBuf;
- ICQBuffer b;
- packExtendedMessage(msg, buf, msgBuf, data);
- b.pack((unsigned short)buf.size());
- b.pack(buf.data(0), buf.size());
- b.pack32(msgBuf);
- unsigned short type = ICQ_MSGxEXT;
- sendAutoReply(screen(data), id, plugins[PLUGIN_NULL], (unsigned short)(cookie & 0xFFFF),
- (unsigned short)((cookie >> 16) & 0xFFFF), type, 1, 0, reason, 2, b);
- }else{
- snac(ICQ_SNACxFOOD_MESSAGE, ICQ_SNACxMSG_AUTOREPLY);
- socket()->writeBuffer() << id.id_l << id.id_h << 0x0002;
- socket()->writeBuffer().packScreen(screen(data));
- socket()->writeBuffer() << 0x0003 << 0x0002 << 0x0001;
- sendPacket(false);
- if (!reason.isEmpty()){
- Message *msg = new Message(MessageGeneric); //Fixme: Local declaration of 'msg' hides declaration of the same name in outer scope, see previous declaration at line '2262'
- msg->setText(reason);
- msg->setFlags(MESSAGE_NOHISTORY);
- msg->setContact(contact->id());
- if (!send(msg, data))
- delete msg;
- }
- }
- }
- }
- EventMessageDeleted(msg).process();
- delete msg;
-}
-
-void ICQClient::requestReverseConnection(const QString &screen, DirectSocket *socket)
-{
- SendMsg s;
- s.flags = PLUGIN_REVERSE;
- s.socket = socket;
- s.screen = screen;
- sendFgQueue.push_back(s);
- processSendQueue();
-}
-
static const plugin arrPlugins[] =
{
// PLUGIN_PHONExBOOK
@@ -2420,3 +2548,7 @@
return ((m1.id_l == m2.id_l) && (m1.id_h == m2.id_h));
}
+#ifndef NO_MOC_INCLUDES
+#include "icqicmb.moc"
+#endif
+
|
[-]
[+]
|
Added |
sim-0.9.5.tar.bz2/plugins/icq/icqicmb.h
^
|
@@ -0,0 +1,104 @@
+
+#ifndef ICQICMB_H
+#define ICQICMB_H
+
+#include <list>
+#include <qobject.h>
+#include "snac.h"
+
+class ICQBuffer;
+class ICQClientSocket;
+class DirectSocket;
+class TlvList;
+struct MessageId;
+struct ICQUserData;
+
+
+struct MessageId
+{
+ unsigned long id_l;
+ unsigned long id_h;
+ MessageId() : id_l(0), id_h(0) {}
+};
+
+bool operator == (const MessageId &m1, const MessageId &m2);
+
+struct SendMsg
+{
+ QString screen;
+ MessageId id;
+ SIM::Message *msg;
+ QString text;
+ QString part;
+ unsigned flags;
+ DirectSocket *socket;
+ SendMsg() : msg(NULL), socket(NULL) {}
+};
+
+typedef unsigned char plugin[0x12];
+namespace SIM
+{
+ class Message;
+}
+
+class SnacIcqICBM : public QObject, public SnacHandler
+{
+ Q_OBJECT
+public:
+ SnacIcqICBM(ICQClient* client);
+ virtual ~SnacIcqICBM();
+
+ virtual bool process(unsigned short subtype, ICQBuffer* buf, unsigned short seq);
+ void rightsRequest();
+ void sendICMB(unsigned short channel, unsigned long flags);
+ void sendThroughServer(const QString &screen, unsigned short channel, ICQBuffer &b, const MessageId &id, bool bOffline, bool bReqAck);
+ void sendType2(const QString &screen, ICQBuffer &msgBuf, const MessageId &id, unsigned cap, bool bOffline, unsigned short port, TlvList *tlvs = NULL, unsigned short type = 1);
+ bool ackMessage(SIM::Message *msg, unsigned short ackFlags, const QCString &msg_str);
+ void sendType1(const QString &text, bool bWide, ICQUserData *data);
+ void sendAdvMessage(const QString &screen, ICQBuffer &msgText, unsigned plugin_index,
+ const MessageId &id, bool bOffline, bool bDirect, unsigned short cookie1 = 0,
+ unsigned short cookie2 = 0, unsigned short type = 1);
+ void ackMessage(SendMsg &s);
+ bool sendThruServer(SIM::Message *msg, void *_data);
+ void clearMsgQueue();
+ void sendFile(TlvList& tlv, unsigned long primary_ip, unsigned long secondary_ip, unsigned short port,const QString &screen, MessageId const& id);
+ void sendAutoReply(const QString &screen, MessageId id,
+ const plugin p, unsigned short cookie1, unsigned short cookie2,
+ unsigned short msgType, char msgFlags, unsigned short msgState,
+ const QString &response, unsigned short response_type, ICQBuffer ©);
+ void sendMTN(const QString &screen, unsigned short type);
+ void accept(SIM::Message *msg, ICQUserData *data);
+ void accept(SIM::Message *msg, const QString &dir, SIM::OverwriteMode overwrite);
+ void decline(SIM::Message *msg, const QString &reason);
+ void requestReverseConnection(const QString &screen, DirectSocket *socket);
+ void parseAdvancedMessage(const QString &screen, ICQBuffer &m, bool needAck, MessageId id);
+ bool processMsg();
+ bool cancelMessage(SIM::Message* msg);
+ void sendSMS(SendMsg msg);
+ void pluginInfoRequest(unsigned long, unsigned plugin_index);
+
+ QTimer* getSendTimer() { return m_sendTimer; }
+
+public slots:
+ void processSendQueue();
+
+protected:
+ virtual ICQClientSocket *socket();
+
+protected slots:
+ void sendTimeout();
+
+private:
+ QTimer *m_sendTimer;
+ SendMsg m_send;
+ std::list<SendMsg> sendFgQueue;
+ std::list<SendMsg> sendBgQueue;
+ std::list<SendMsg> replyQueue;
+ std::list<SendMsg> smsQueue;
+
+ friend class SMSRequest;
+ friend class ICQClient;
+};
+
+#endif
+
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/icq/icqlists.cpp
^
|
@@ -98,8 +98,11 @@
virtual void process(ICQClient *client, unsigned short res)
{
Q_UNUSED(res);
- client->snac(ICQ_SNACxFOOD_LISTS, ICQ_SNACxLISTS_SAVE, true, false);
- client->sendPacket(true);
+ if(client->isSSITransaction())
+ {
+ client->snac(ICQ_SNACxFOOD_LISTS, ICQ_SNACxLISTS_SAVE, true, false);
+ client->sendPacket(true);
+ }
}
unsigned short seq() const { return m_seq; }
@@ -615,6 +618,10 @@
log(L_DEBUG, "Rosters OK");
QTimer::singleShot(PING_TIMEOUT * 1000, this, SLOT(ping()));
setPreviousPassword(QString::null);
+
+
+ snac(ICQ_SNACxFOOD_LISTS, ICQ_SNACxLISTS_ACTIVATE, true, false);
+ sendPacket(true);
if (m_bAIM){
Group *grp;
ContactList::GroupIterator it;
@@ -632,9 +639,9 @@
if (m_logonStatus == STATUS_ONLINE){
m_status = STATUS_ONLINE;
sendCapability();
- sendICMB(1, 11);
- sendICMB(2, 3);
- sendICMB(4, 3);
+ snacICBM()->sendICMB(1, 11);
+ snacICBM()->sendICMB(2, 3);
+ snacICBM()->sendICMB(4, 3);
fetchProfiles();
}else{
m_status = STATUS_AWAY;
@@ -650,22 +657,18 @@
ar.status = m_logonStatus;
EventARRequest(&ar).process();
}
- snac(ICQ_SNACxFOOD_LISTS, ICQ_SNACxLISTS_ACTIVATE, true, false);
- sendPacket(true);
m_snacService->sendClientReady();
setState(Connected);
m_bReady = true;
- processSendQueue();
+ snacICBM()->processSendQueue();
break;
}
sendCapability();
- sendICMB(1, 11);
- sendICMB(2, 3);
- sendICMB(4, 3);
+ // 0x070b will send html text.
+ // Probably, later we can use it.
+ snacICBM()->sendICMB(0, 0x000b);
snacService()->sendLogonStatus();
snacService()->sendClientReady();
- snac(ICQ_SNACxFOOD_LISTS, ICQ_SNACxLISTS_ACTIVATE, true, false);
- sendPacket(true);
sendMessageRequest();
setState(Connected);
@@ -806,7 +809,7 @@
m_listRequest->process(this, res);
delete m_listRequest;
m_listRequest = NULL;
- processSendQueue();
+ snacICBM()->processSendQueue();
}
break;
default:
@@ -1031,7 +1034,7 @@
lr.icq_id = m_icqUserData->buddyRosterID.toULong();
lr.icqUserData = m_icqUserData;
client->listRequests.push_back(lr);
- client->processSendQueue();
+ client->snacICBM()->processSendQueue();
}
if(res != 0)
return;
@@ -1104,7 +1107,7 @@
lr.icq_id = data->buddyRosterID.toULong();
lr.icqUserData = data;
listRequests.push_back(lr);
- processSendQueue();
+ snacICBM()->processSendQueue();
}
void ICQClient::ssiStartTransaction()
@@ -1231,6 +1234,24 @@
return m_nMsgSequence;
}
+unsigned short ICQClient::ssiModifyBuddy(const QString& name, unsigned short grp_id, unsigned short usr_id, unsigned short subCmd, TlvList* tlv)
+{
+ snac(ICQ_SNACxFOOD_LISTS, ICQ_SNACxLISTS_UPDATE, true, false);
+ QByteArray sName = name.utf8();
+ socket()->writeBuffer().pack(static_cast<unsigned short>(htons(sName.size())));
+ socket()->writeBuffer().pack(sName.data(), sName.size());
+ socket()->writeBuffer()
+ << grp_id
+ << usr_id
+ << subCmd;
+ if (tlv){
+ socket()->writeBuffer() << *tlv;
+ }else{
+ socket()->writeBuffer() << (unsigned short)0;
+ }
+ sendPacket(true);
+ return m_nMsgSequence;
+}
unsigned short ICQClient::sendRoster(unsigned short cmd, const QString &name, unsigned short grp_id,
unsigned short usr_id, unsigned short subCmd, TlvList *tlv)
{
@@ -1401,7 +1422,7 @@
}
break;
}
- if (data->IcqID.toULong() == 0)
+ if ((data->IcqID.toULong() == 0) || (data->Uin.toULong() == 0))
break;
if (isContactRenamed(data, contact)){
log(L_DEBUG, "%s rename", userStr(contact, data).local8Bit().data());
@@ -1501,7 +1522,7 @@
if(hash == this->data.owner.buddyHash.toBinary() &&
1 == this->data.owner.buddyID.toULong()) {
log(L_DEBUG, "No need to upload buddy");
- break;
+ // break;
}
TlvList *tlvList = new TlvList;
@@ -1510,11 +1531,14 @@
ba.data()[0] = 0x01;
ba.data()[1] = hash.size();
memcpy(&ba.data()[2], hash.data(), hash.size());
- *tlvList += new Tlv(TLV_BUDDYHASH, ba.size(), ba.data());
*tlvList += new Tlv(TLV_ALIAS, 0, NULL);
+ *tlvList += new Tlv(TLV_BUDDYHASH, ba.size(), ba.data());
- unsigned short seq = sendRoster(lr.icq_id ? ICQ_SNACxLISTS_UPDATE : ICQ_SNACxLISTS_CREATE,
- "1", lr.grp_id, lr.icq_id, ICQ_BUDDY_CHECKSUM, tlvList);
+ //unsigned short seq = sendRoster(lr.icq_id ? ICQ_SNACxLISTS_UPDATE : ICQ_SNACxLISTS_CREATE,
+ // "1", lr.grp_id, lr.icq_id, ICQ_BUDDY_CHECKSUM, tlvList);
+ ssiStartTransaction();
+ unsigned short seq = ssiModifyBuddy("1", lr.grp_id, lr.icq_id, ICQ_BUDDY_CHECKSUM, tlvList);
+ ssiEndTransaction();
m_listRequest = new SetBuddyRequest(seq, &this->data.owner);
}
break;
@@ -1535,7 +1559,7 @@
m_listRequest->process(this, (unsigned short)(-1));
delete m_listRequest;
m_listRequest = NULL;
- processSendQueue();
+ snacICBM()->processSendQueue();
}
}
@@ -1556,7 +1580,7 @@
lr.type = LIST_GROUP_CHANGED;
lr.screen = QString::number(group->id());
listRequests.push_back(lr);
- processSendQueue();
+ snacICBM()->processSendQueue();
return;
}
list<ListRequest>::iterator it;
@@ -1574,7 +1598,7 @@
lr.icq_id = (unsigned short)(data->IcqID.toULong());
lr.screen = QString::number(group->id());
listRequests.push_back(lr);
- processSendQueue();
+ snacICBM()->processSendQueue();
}
void ICQClient::addContactRequest(Contact *contact)
@@ -1652,7 +1676,7 @@
lr.type = LIST_USER_CHANGED;
lr.screen = screen(data);
listRequests.push_back(lr);
- processSendQueue();
+ snacICBM()->processSendQueue();
}
}
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/icq/icqlocation.cpp
^
|
@@ -16,6 +16,7 @@
***************************************************************************/
#include "icqclient.h"
+#include "icqlocation.h"
#include <qtextcodec.h>
#ifdef Q_OS_WIN32
@@ -39,6 +40,14 @@
const unsigned short ICQ_SNACxLOC_REQUESTxDIRxINFO = 0x000B;
const unsigned short ICQ_SNACxLOC_DIRxINFO = 0x000C;
+SnacIcqLocation::SnacIcqLocation(ICQClient* client) : QObject(NULL), SnacHandler(client, 0x0002)
+{
+}
+
+SnacIcqLocation::~SnacIcqLocation()
+{
+}
+
static bool extractInfo(TlvList &tlvs, unsigned short id, SIM::Data &data, Contact *c = NULL)
{
const char *info = NULL;
@@ -494,7 +503,7 @@
addCapability(cap, CAP_AIM_SENDFILE); //Since we add this, ICQ6 accepts the client as filetransfer partner
addCapability(cap, CAP_DIRECT);
addCapability(cap, CAP_SRV_RELAY);
- addCapability(cap, CAP_XTRAZ);
+ addCapability(cap, CAP_XTRAZ); // What? We don't support it. Yet.
if (getSendFormat() <= 1)
addCapability(cap, CAP_UTF);
if (getSendFormat() == 0)
@@ -630,4 +639,7 @@
sendPacket(false);
}
+#ifndef NO_MOC_INCLUDES
+#include "icqlocation.moc"
+#endif
|
[-]
[+]
|
Added |
sim-0.9.5.tar.bz2/plugins/icq/icqlocation.h
^
|
@@ -0,0 +1,17 @@
+
+#ifndef ICQLOCATION_H
+#define ICQLOCATION_H
+
+#include "snac.h"
+
+class SnacIcqLocation : public QObject, public SnacHandler
+{
+ Q_OBJECT
+public:
+ SnacIcqLocation(ICQClient* client);
+ virtual ~SnacIcqLocation();
+
+};
+
+
+#endif
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/icq/icqlogin.cpp
^
|
@@ -110,15 +110,15 @@
md += getContacts()->fromUnicode(NULL, getPassword());
md += "AOL Instant Messenger (SM)";
md = md5(md);
- socket()->writeBuffer().tlv(0x0025, md.data(), md.length());
+ socket()->writeBuffer().tlv(0x0025, md.data(), md.size());
if (data.owner.Uin.toULong()){
- socket()->writeBuffer().tlv(0x0003, "ICQ Inc. - Product of ICQ (TM).2003b.5.56.1.3916.85"); //ToDo: Should be updated anytime
- socket()->writeBuffer().tlv(0x0016, 0x014A); // ID Number
- socket()->writeBuffer().tlv(0x0017, 0x0024); // major
- socket()->writeBuffer().tlv(0x0018, 0x003D); // minor
- socket()->writeBuffer().tlv(0x0019, 0x0001);
- socket()->writeBuffer().tlv(0x001A, 0x0F4C);
- socket()->writeBuffer().tlv(0x0014, 0x00000055L);
+ socket()->writeBuffer().tlv(0x0003, "ICQBasic"); //ToDo: Should be updated anytime
+ socket()->writeBuffer().tlv(0x0016, 0x010A); // ID Number
+ socket()->writeBuffer().tlv(0x0017, 0x0014); // major
+ socket()->writeBuffer().tlv(0x0018, 0x0034); // minor
+ socket()->writeBuffer().tlv(0x0019, 0x0009);
+ socket()->writeBuffer().tlv(0x001A, 0x0c18);
+ socket()->writeBuffer().tlv(0x0014, 0x0000043dL);
socket()->writeBuffer().tlv(0x000f, "en");
socket()->writeBuffer().tlv(0x000e, "us");
}else{
@@ -184,6 +184,7 @@
void ICQClient::chn_login()
{
+ m_connectionLost = false;
if (m_cookie.size()){
flap(ICQ_CHNxNEW);
socket()->writeBuffer() << 0x00000001L;
@@ -202,13 +203,14 @@
socket()->writeBuffer() << 0x00000001L;
socket()->writeBuffer().tlv(0x0001, uin);
socket()->writeBuffer().tlv(0x0002, pswd.data(), pswd.size());
+ // Thanks to pidgin guys for those values
socket()->writeBuffer().tlv(0x0003, "ICQBasic"); // ID String, currently ICQ 5.1 (21.08.2006)
- socket()->writeBuffer().tlv(0x0016, 0x014A); // ID Number
- socket()->writeBuffer().tlv(0x0017, 0x0024); // major
- socket()->writeBuffer().tlv(0x0018, 0x003D); // minor
+ socket()->writeBuffer().tlv(0x0016, 0x010A); // ID Number
+ socket()->writeBuffer().tlv(0x0017, 0x0014); // major
+ socket()->writeBuffer().tlv(0x0018, 0x0034); // minor
socket()->writeBuffer().tlv(0x0019, 0x0000); // lesser
- socket()->writeBuffer().tlv(0x001A, 0x0bb8); // build number
- socket()->writeBuffer().tlv(0x0014, 0x00000442L); // distribution number
+ socket()->writeBuffer().tlv(0x001A, 0x0c18); // build number
+ socket()->writeBuffer().tlv(0x0014, 0x0000043dL); // distribution number
socket()->writeBuffer().tlv(0x000f, "en"); //Todo Send right language shortcut
socket()->writeBuffer().tlv(0x000e, "us");
sendPacket(true);
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/icq/icqmessage.cpp
^
|
@@ -403,7 +403,7 @@
#ifdef __OS2__ // to make it compileable under OS/2 (gcc 3.3.5)
m->setServerDescr(fileName.c_str());
#else
- m->setServerDescr(fileName);
+ m->setServerDescr(fileName); //Crash here, accepting filetransfer from 0.9.4.3...???
#endif
m->setServerText(QCString(fileDescr.data()));
m->setSize(fileSize);
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/icq/icqpicture.cpp
^
|
@@ -20,6 +20,7 @@
#include "editfile.h"
#include "preview.h"
#include "ballonmsg.h"
+#include "log.h"
#include <qpushbutton.h>
#include <qlabel.h>
@@ -72,12 +73,15 @@
{
if (client != m_client)
return;
- ICQUserData *data = m_client->toICQUserData((SIM::clientData*)_data); // FIXME unsafe type conversion
QString pict = edtPict->text();
+ log(L_DEBUG, "Pict: %s", pict.utf8().data());
+ m_client->setPicture(pict);
+ m_client->data.owner.Picture.setStr(pict);
+ ICQUserData *data = m_client->toICQUserData((SIM::clientData*)_data); // FIXME unsafe type conversion
if (lblPict->pixmap() == NULL)
pict = QString::null;
- if (pict != m_client->getPicture()){
- m_client->setPicture(pict);
+ if(pict != m_client->getPicture())
+ {
data->PluginInfoTime.asULong() = time(NULL);
}
}
@@ -105,7 +109,7 @@
edtPict->setText(QString::null);
}
-const unsigned short MAX_PICTURE_SIZE = 8081;
+const unsigned short MAX_PICTURE_SIZE = 7168;
void ICQPicture::pictSelected(const QString &file)
{
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/icq/icqservice.cpp
^
|
@@ -68,7 +68,7 @@
{
}
-bool SnacIcqService::process(unsigned short subtype, ICQBuffer* buf)
+bool SnacIcqService::process(unsigned short subtype, ICQBuffer* buf, unsigned short seq)
{
switch (subtype)
{
@@ -90,7 +90,7 @@
case ICQ_SNACxSRV_RESUME:
log(L_DEBUG, "Server resume");
m_client->m_bNoSend = false;
- m_client->processSendQueue();
+ m_client->snacICBM()->processSendQueue();
break;
case ICQ_SNACxSRV_MIGRATE:
{
@@ -171,7 +171,7 @@
r.m_minLevel = alert_level;
r.m_curLevel = current_level;
r.m_lastSend = QDateTime::currentDateTime();
- m_client->processSendQueue();
+ m_client->snacICBM()->processSendQueue();
}
break;
}
@@ -243,9 +243,13 @@
m_client->sendPacket(true);
m_client->listsRequest();
m_client->locationRequest();
+ log(L_DEBUG, "alpha");
m_client->buddyRequest();
- m_client->icmbRequest();
+ log(L_DEBUG, "beta");
+ m_client->snacICBM()->rightsRequest();
+ log(L_DEBUG, "gamma");
m_client->bosRequest();
+ log(L_DEBUG, "delta");
}
break;
case ICQ_SNACxSRV_MOTD:
@@ -291,7 +295,21 @@
m_client->uploadBuddy(&m_client->data.owner);
break;
}
- m_client->uploadBuddyIcon(1, img);
+ log(L_DEBUG, "SRV_EXT_STATUS");
+ if(flags & FirstSend)
+ {
+ m_client->uploadBuddyIcon(1, img);
+ }
+ else
+ {
+ ICQUserData* data = &m_client->data.owner;
+ data->buddyHash.setBinary(hash);
+ /*
+ m_client->sendCapability(QString::null);
+ m_client->requestBuddy(data);
+ */
+ }
+
}
break;
case ICQ_SNACxSRV_NAMExINFO:
@@ -462,16 +480,16 @@
{
snac(ICQ_SNACxSRV_READYxCLIENT);
m_client->socket()->writeBuffer()
- << 0x00010004L << 0x011008E4L
- << 0x00130004L << 0x011008E4L
- << 0x00020001L << 0x011008E4L
- << 0x00030001L << 0x011008E4L
- << 0x00150001L << 0x011008E4L
- << 0x00040001L << 0x011008E4L
- << 0x00060001L << 0x011008E4L
- << 0x00090001L << 0x011008E4L
- << 0x000A0001L << 0x011008E4L
- << 0x000B0001L << 0x011008E4L;
+ << 0x00010004L << 0x0110164FL
+ << 0x00130004L << 0x0110164FL
+ << 0x00020001L << 0x0110164FL
+ << 0x00030001L << 0x0110164FL
+ << 0x00150001L << 0x0110164FL
+ << 0x00040001L << 0x0110164FL
+ << 0x00060001L << 0x0110164FL
+ << 0x00090001L << 0x0110164FL
+ << 0x000A0001L << 0x0110164FL
+ << 0x000B0001L << 0x0110164FL;
m_client->sendPacket(true);
}
@@ -509,10 +527,16 @@
snac(ICQ_SNACxSRV_SETxSTATUS);
m_client->socket()->writeBuffer().tlv(0x0006, m_client->getFullStatus());
- m_client->socket()->writeBuffer().tlv(0x0008, (unsigned short)0);
+ m_client->socket()->writeBuffer().tlv(0x0008, (unsigned short)0x0a06);
m_client->socket()->writeBuffer().tlv(0x000C, directInfo);
- m_client->socket()->writeBuffer().tlv(0x001f, (unsigned short)0);
+ Buffer b;
+ b << (unsigned short)0x000e
+ << (unsigned short)0x0000
+ << (unsigned short)0x0002
+ << (unsigned short)0x0000;
+ m_client->socket()->writeBuffer().tlv(0x001d, b);
+ m_client->socket()->writeBuffer().tlv(0x001f, (unsigned short)0);
m_client->sendPacket(true);
if (!m_client->getInvisible())
m_client->sendInvisible(true);
@@ -522,6 +546,7 @@
void SnacIcqService::setInvisible()
{
+ log(L_DEBUG, "SnacIcqService::setInvisible");
if(m_client->getInvisible())
m_client->sendInvisible(false);
snac(ICQ_SNACxSRV_SETxSTATUS);
@@ -533,6 +558,7 @@
void SnacIcqService::sendStatus()
{
+ log(L_DEBUG, "SnacIcqService::sendStatus");
snac(ICQ_SNACxSRV_SETxSTATUS);
m_client->socket()->writeBuffer().tlv(0x0006, m_client->getFullStatus());
m_client->sendPacket(true);
@@ -541,6 +567,7 @@
void SnacIcqService::sendPluginInfoUpdate(unsigned plugin_id)
{
+ log(L_DEBUG, "SnacIcqService::sendPluginInfoUpdate");
snac(ICQ_SNACxSRV_SETxSTATUS);
m_client->socket()->writeBuffer().tlv(0x0006, m_client->getFullStatus());
ICQBuffer directInfo(25);
@@ -562,6 +589,7 @@
void SnacIcqService::sendPluginStatusUpdate(unsigned plugin_id, unsigned long status)
{
+ log(L_DEBUG, "SnacIcqService::sendPluginInfoUpdate");
snac(ICQ_SNACxSRV_SETxSTATUS);
m_client->socket()->writeBuffer().tlv(0x0006, m_client->fullStatus(m_client->m_logonStatus));
ICQBuffer directInfo(25);
@@ -603,6 +631,7 @@
void SnacIcqService::fillDirectInfo(ICQBuffer &directInfo)
{
set_ip(&m_client->data.owner.RealIP, m_client->socket()->localHost());
+ /*
if (m_client->getHideIP()){
directInfo
<< (unsigned long)0
@@ -629,19 +658,30 @@
default:
break;
}
+ */
directInfo
- << mode
+ << (unsigned long)0
+ << (unsigned long)0
+ << (char)0x00//mode
<< (char)0x00
- << (char)ICQ_TCP_VERSION;
+ << (char)ICQ_TCP_VERSION
+ << m_client->data.owner.DCcookie.toULong()
+ << 0x00000000L
+ << 0x00000000L
+ << 0x00000000L
+ << 0x00000000L
+ << 0x00000000L
+ << (unsigned short)0x0000;
+ /*
directInfo
- << m_client->data.owner.DCcookie.toULong()
<< 0x00000050L
<< 0x00000003L
<< m_client->data.owner.InfoUpdateTime.toULong()
<< m_client->data.owner.PluginInfoTime.toULong()
<< m_client->data.owner.PluginStatusTime.toULong()
<< (unsigned short) 0x0000;
+ */
}
void SnacIcqService::sendIdleTime()
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/icq/icqservice.h
^
|
@@ -14,7 +14,7 @@
SnacIcqService(ICQClient* client);
virtual ~SnacIcqService();
- virtual bool process(unsigned short subtype, ICQBuffer* buf);
+ virtual bool process(unsigned short subtype, ICQBuffer* buf, unsigned short seq);
void requestRateInfo();
void addService(ServiceSocket* s);
@@ -32,6 +32,8 @@
void sendIdleTime();
void requestService(ServiceSocket *s);
+ static const unsigned int FirstSend = 0x40;
+
protected:
void fillDirectInfo(ICQBuffer &directInfo);
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/icq/icqssbi.cpp
^
|
@@ -121,7 +121,7 @@
socket()->writeBuffer() << 0x00010002L << 0x00030004L << 0x0005;
sendPacket();
snac(ICQ_SNACxFOOD_SERVICE, ICQ_SNACxSRV_READYxCLIENT);
- socket()->writeBuffer() << 0x00010004L << 0x00100739L << 0x00100001L << 0x00100739L;
+ socket()->writeBuffer() << 0x00010004L << 0x0010157fL << 0x00100001L << 0x0010157fL;
sendPacket();
m_bConnected = true;
process();
@@ -152,12 +152,14 @@
socket()->readBuffer().unpack(ba.data(), size);
break;
}
- case ICQ_SNACxSSBI_REQ_AIM_ACK: {
+ case ICQ_SNACxSSBI_REQ_AIM_ACK:
+ {
ICQUserData *data;
Contact *contact;
QString screen;
QByteArray hash(16), icon(1024);
- unsigned short iconID, iconSize;
+ uint16_t iconID, iconSize;
+ uint8_t unknown_byte;
char iconFlags, hashSize;
screen = socket()->readBuffer().unpackScreen();
@@ -165,18 +167,26 @@
data = &m_client->data.owner;
else
data = m_client->findContact(screen, NULL, false, contact);
- if(data) {
- socket()->readBuffer() >> iconID >> iconFlags >> hashSize;
+ if(data)
+ {
+ // 3 unknown bytes
+ socket()->readBuffer() >> unknown_byte;
+ socket()->readBuffer() >> unknown_byte;
+ socket()->readBuffer() >> unknown_byte;
+ // then hash (should be 5 bytes)
+ socket()->readBuffer() >> hashSize;
hash.resize(hashSize);
socket()->readBuffer().unpack(hash.data(), hashSize);
socket()->readBuffer() >> iconSize;
+ // then icon size and the icon itself
icon.resize(iconSize);
- socket()->readBuffer().unpack(icon.data(), iconSize);
-
- if(icon.isEmpty()) {
+ if(iconSize == 0)
+ {
+ log(L_DEBUG, "Empty icon");
process();
break;
}
+ socket()->readBuffer().unpack(icon.data(), iconSize);
QString filename = ICQClient::pictureFile(data);
QFile f(filename);
@@ -186,15 +196,17 @@
log(L_WARN, QString("Can't open %1").arg(filename));
f.close();
}
- process();
+ //process();
break;
}
- case ICQ_SNACxSSBI_REQ_ICQ_ACK: {
+ case ICQ_SNACxSSBI_REQ_ICQ_ACK:
+ {
ICQUserData *data;
Contact *contact;
QString screen;
QByteArray hash(16), icon(1024);
- unsigned short iconID, iconSize;
+ uint16_t iconID, iconSize;
+ uint8_t unknown_byte;
char iconFlags, hashSize, unknown1;
screen = socket()->readBuffer().unpackScreen();
@@ -202,24 +214,26 @@
data = &m_client->data.owner;
else
data = m_client->findContact(screen, NULL, false, contact);
- if(data) {
- socket()->readBuffer() >> iconID >> iconFlags >> hashSize;
+ if(data)
+ {
+ // 3 unknown bytes
+ socket()->readBuffer() >> unknown_byte;
+ socket()->readBuffer() >> unknown_byte;
+ socket()->readBuffer() >> unknown_byte;
+ // then hash (should be 5 bytes)
+ socket()->readBuffer() >> hashSize;
hash.resize(hashSize);
socket()->readBuffer().unpack(hash.data(), hashSize);
- socket()->readBuffer() >> unknown1;
- // again ...
- socket()->readBuffer() >> iconID >> iconFlags >> hashSize;
- hash.resize(hashSize);
- socket()->readBuffer().unpack(hash.data(), hashSize);
-
socket()->readBuffer() >> iconSize;
+ // then icon size and the icon itself
icon.resize(iconSize);
- socket()->readBuffer().unpack(icon.data(), iconSize);
-
- if(icon.isEmpty()) {
+ if(iconSize == 0)
+ {
+ log(L_DEBUG, "Empty icon");
process();
break;
}
+ socket()->readBuffer().unpack(icon.data(), iconSize);
QString filename = ICQClient::pictureFile(data);
QFile f(filename);
@@ -240,14 +254,16 @@
void SSBISocket::process()
{
- if(!m_img.isNull()) {
+ if(!m_img.isNull())
+ {
unsigned short ref = m_refNumber;
QImage img = m_img;
m_refNumber = 0;
m_img = QImage();
- uploadBuddyIcon(ref, img);
+ //uploadBuddyIcon(ref, img);
}
- while(m_buddyRequests.count()) {
+ while(m_buddyRequests.count())
+ {
// implement me: we can also request more than one buddy at a time !
ICQUserData *data;
Contact *contact;
@@ -312,13 +328,16 @@
void SSBISocket::requestBuddy(const QString &screen, unsigned short buddyID, const QByteArray &buddyHash)
{
- if(buddyHash.size() != 0x10) {
- log(L_ERROR, "Invalid buddyHash size (%d, id: %d) for %s", buddyHash.size(), buddyID, screen.latin1());
- return;
+ log(L_DEBUG, "SSBISocket::requestBuddy: %s", screen.utf8().data());
+ if(!((buddyHash.size() == 0x05) || (buddyHash.size() == 0x10)))
+ {
+ log(L_WARN, "Invalid buddyHash size (%d, id: %d) for %s", buddyHash.size(), buddyID, screen.latin1());
+ return;
}
// buddyID == 1 -> jpeg
// buddyID == 8 -> xml/swf
- if(!connected()) {
+ if(!connected())
+ {
// wait
if(!m_buddyRequests.contains(screen))
m_buddyRequests.append(screen);
@@ -326,12 +345,14 @@
}
char len = buddyHash.size();
- snac(ICQ_SNACxFOOD_SSBI, m_client->m_bAIM ? ICQ_SNACxSSBI_REQ_AIM : ICQ_SNACxSSBI_REQ_ICQ, true);
+ //snac(ICQ_SNACxFOOD_SSBI, m_client->m_bAIM ? ICQ_SNACxSSBI_REQ_AIM : ICQ_SNACxSSBI_REQ_ICQ, true);
+ snac(ICQ_SNACxFOOD_SSBI, ICQ_SNACxSSBI_REQ_AIM, true);
socket()->writeBuffer().packScreen(screen);
socket()->writeBuffer() << (char)0x01
- << (unsigned short)buddyID
- << (char)0x01;
+ << (char)0x00//(unsigned short)buddyID
+ << (char)0x01
+ << (char)0x00;
socket()->writeBuffer().pack(&len, 1);
socket()->writeBuffer().pack(buddyHash.data(), len);
sendPacket();
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/icq/icqvarious.cpp
^
|
@@ -226,7 +226,7 @@
setChatGroup();
addFullInfoRequest(data.owner.Uin.toULong());
m_bReady = true;
- processSendQueue();
+ snacICBM()->processSendQueue();
break;
case ICQ_SRVxOFFLINE_MSG:{
unsigned long uin;
@@ -288,7 +288,8 @@
log(L_WARN, "Various event ID %04X not found (%X)", nId, nResult);
break;
}
- if (req->answer(msg, nSubtype)){
+ if (req->answer(msg, nSubtype))
+ {
log(L_DEBUG, "removing server request %d (%p)", nId, this);
varRequests.remove(req);
delete req;
@@ -308,7 +309,7 @@
void ICQClient::serverRequest(unsigned short cmd, unsigned short seq)
{
- snac(ICQ_SNACxFOOD_VARIOUS, ICQ_SNACxVAR_REQxSRV, true);
+ snac(ICQ_SNACxFOOD_VARIOUS, ICQ_SNACxVAR_REQxSRV, true, false);
socket()->writeBuffer().tlv(0x0001, 0);
socket()->writeBuffer().pack(data.owner.Uin.toULong());
socket()->writeBuffer() << cmd;
@@ -317,7 +318,6 @@
void ICQClient::sendServerRequest()
{
- log(L_DEBUG, "add server request %d (%p)", m_nMsgSequence, this);
ICQBuffer &b = socket()->writeBuffer();
char *packet = b.data(b.packetStartPos());
unsigned short packet_size = (unsigned short)(b.size() - b.packetStartPos());
@@ -645,7 +645,7 @@
r.request_id = 0;
r.start_time = 0;
infoRequests.push_back(r);
- processSendQueue();
+ snacICBM()->processSendQueue();
}
void ICQClient::removeFullInfoRequest(unsigned long uin)
@@ -1466,7 +1466,7 @@
}
setChatGroup();
- snacService()->sendStatus();
+ //snacService()->sendStatus();
}
class SetPasswordRequest : public ServerRequest
@@ -1487,6 +1487,17 @@
bool SetPasswordRequest::answer(ICQBuffer&, unsigned short)
{
m_client->setPassword(m_pwd);
+ log(L_DEBUG, "Password change success: %X");
+ EventError::ClientErrorData d;
+ d.client = m_client;
+ d.code = 0;
+ d.err_str = I18N_NOOP("Password successfuly changed");
+ d.args = QString::null;
+ d.flags = EventError::ClientErrorData::E_INFO;
+ d.options = NULL;
+ d.id = CmdPasswordSuccess;
+ EventClientError e(d);
+ e.process();
return true;
}
@@ -1508,10 +1519,13 @@
void ICQClient::changePassword(const QString &new_pswd)
{
QString pwd = new_pswd;
+ unsigned short passlen = htons(pwd.length() + 1);
serverRequest(ICQ_SRVxREQ_MORE);
socket()->writeBuffer()
<< ICQ_SRVxREQ_CHANGE_PASSWD
- << (const char*)getContacts()->fromUnicode(NULL, pwd).data();
+ << passlen
+ << (const char*)getContacts()->fromUnicode(NULL, pwd).data()
+ << (unsigned char)0x00;
sendServerRequest();
varRequests.push_back(new SetPasswordRequest(this, m_nMsgSequence, new_pswd));
}
@@ -1544,13 +1558,14 @@
bool SMSRequest::answer(ICQBuffer &b, unsigned short code)
{
m_client->m_sendSmsId = 0;
- if (code == 0x0100){
- if (m_client->smsQueue.empty())
+ if (code == 0x0100)
+ {
+ if (m_client->snacICBM()->smsQueue.empty())
return true;
QCString errStr = b.data(b.readPos());
- SendMsg &s = m_client->smsQueue.front();
+ SendMsg &s = m_client->snacICBM()->smsQueue.front();
SMSMessage *sms = static_cast<SMSMessage*>(s.msg);
- m_client->smsQueue.erase(m_client->smsQueue.begin());
+ m_client->snacICBM()->smsQueue.erase(m_client->snacICBM()->smsQueue.begin());
sms->setError(errStr.data());
EventMessageSent(sms).process();
delete sms;
@@ -1588,8 +1603,8 @@
}
if (error.isEmpty()){
- if (!m_client->smsQueue.empty()){
- SendMsg &s = m_client->smsQueue.front();
+ if (!m_client->snacICBM()->smsQueue.empty()){
+ SendMsg &s = m_client->snacICBM()->smsQueue.front();
SMSMessage *sms = static_cast<SMSMessage*>(s.msg);
sms->setNetwork(network);
if ((sms->getFlags() & MESSAGE_NOHISTORY) == 0){
@@ -1602,31 +1617,31 @@
}
}
}else{
- if (!m_client->smsQueue.empty()){
- SendMsg &s = m_client->smsQueue.front();
+ if (!m_client->snacICBM()->smsQueue.empty()){
+ SendMsg &s = m_client->snacICBM()->smsQueue.front();
s.msg->setError(error);
EventMessageSent(s.msg).process();
delete s.msg;
- m_client->smsQueue.erase(m_client->smsQueue.begin());
+ m_client->snacICBM()->smsQueue.erase(m_client->snacICBM()->smsQueue.begin());
}
}
}
- m_client->processSendQueue();
+ m_client->snacICBM()->processSendQueue();
return true;
}
void SMSRequest::fail(unsigned short)
{
- if (m_client->smsQueue.empty())
+ if (m_client->snacICBM()->smsQueue.empty())
return;
- SendMsg &s = m_client->smsQueue.front();
+ SendMsg &s = m_client->snacICBM()->smsQueue.front();
Message *sms = s.msg;
sms->setError(I18N_NOOP("SMS send fail"));
- m_client->smsQueue.erase(m_client->smsQueue.begin());
+ m_client->snacICBM()->smsQueue.erase(m_client->snacICBM()->smsQueue.begin());
EventMessageSent(sms).process();
delete sms;
m_client->m_sendSmsId = 0;
- m_client->processSendQueue();
+ m_client->snacICBM()->processSendQueue();
}
const unsigned MAX_SMS_LEN_LATIN1 = 160;
@@ -1664,16 +1679,16 @@
if (m_sendSmsId)
return 0;
for (;;){
- if (smsQueue.empty())
+ if (snacICBM()->smsQueue.empty())
break;
unsigned delay = delayTime(SNAC(ICQ_SNACxFOOD_VARIOUS, ICQ_SNACxVAR_REQxSRV));
if (delay)
return delay;
- SendMsg &s = smsQueue.front();
+ SendMsg &s = snacICBM()->smsQueue.front();
if (s.text.isEmpty() || (!(s.flags & SEND_1STPART) && (s.msg->getFlags() & MESSAGE_1ST_PART))){
EventMessageSent(s.msg).process();
delete s.msg;
- smsQueue.erase(smsQueue.begin());
+ snacICBM()->smsQueue.erase(snacICBM()->smsQueue.begin());
continue;
}
SMSMessage *sms = static_cast<SMSMessage*>(s.msg);
@@ -1727,12 +1742,12 @@
void ICQClient::clearSMSQueue()
{
- for (list<SendMsg>::iterator it = smsQueue.begin(); it != smsQueue.end(); ++it){
+ for (list<SendMsg>::iterator it = snacICBM()->smsQueue.begin(); it != snacICBM()->smsQueue.end(); ++it){
(*it).msg->setError(I18N_NOOP("Client go offline"));
EventMessageSent((*it).msg).process();
delete (*it).msg;
}
- smsQueue.clear();
+ snacICBM()->smsQueue.clear();
m_sendSmsId = 0;
}
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/icq/snac.cpp
^
|
@@ -15,3 +15,8 @@
{
m_client->snac(m_snac, subtype, bMsgID, bType);
}
+
+ICQClient* SnacHandler::client()
+{
+ return m_client;
+}
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/icq/snac.h
^
|
@@ -11,9 +11,11 @@
virtual ~SnacHandler();
unsigned short getType() { return m_snac; };
- virtual bool process(unsigned short subtype, ICQBuffer* buf) = 0;
+ virtual bool process(unsigned short subtype, ICQBuffer* buf, unsigned short seq) = 0;
void snac(const unsigned short subtype, bool bMsgID = true, bool bType = false);
+
+ ICQClient* client();
protected:
unsigned short m_snac;
ICQClient* m_client;
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/jabber/CMakeLists.txt
^
|
@@ -62,6 +62,8 @@
jidsearchbase.ui
)
+SET(jabber_MESSAGE_SOURCES ${jabber_SRCS} ${jabber_UICS} PARENT_SCOPE)
+
SIM_ADD_PLUGIN(jabber)
# install some sounds
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/jabber/jabber_rosters.cpp
^
|
@@ -1406,9 +1406,13 @@
for (int i = 0; i < attrs.count(); i++){
*m_data += ' ';
*m_data += attrs.qName(i);
- *m_data += "=\'";
+ QChar ch('\'');
+ if(attrs.value(i).contains(QChar('\'')))
+ ch = QChar('"');
+ *m_data += "=";
+ *m_data += ch;
*m_data += attrs.value(i);
- *m_data += "\'";
+ *m_data += ch;
}
*m_data += '>';
return;
@@ -1511,7 +1515,7 @@
*m_data += '>';
return;
}
- if (el == "x")
+ if ((el == "x"))
if (m_bEnc){
m_bEnc = false;
*m_data += "\n-----END PGP MESSAGE-----\n";
@@ -2852,10 +2856,17 @@
{
if (getState() != Connected)
return;
+ QString id_name = data.owner.ID.str();
+ int pos = id_name.find('@');
+
+ if(pos != -1)
+ {
+ id_name = id_name.left(pos);
+ }
ChangePasswordRequest *req = new ChangePasswordRequest(this, password);
req->start_element("query");
req->add_attribute("xmlns", "jabber:iq:register");
- req->text_tag("username", data.owner.ID.str());
+ req->text_tag("username", id_name);
req->text_tag("password", password);
m_requests.push_back(req);
req->send();
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/jabber/jabberbrowser.cpp
^
|
@@ -876,7 +876,7 @@
bool JabberBrowser::haveFeature(const char *feature, const QString &features)
{
- if (features == NULL)
+ if (features.isEmpty())
return false;
QString ff = features;
while (!ff.isEmpty()){
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/jabber/jabberclient.cpp
^
|
@@ -315,7 +315,7 @@
case eEventAddContact: {
EventAddContact *ec = static_cast<EventAddContact*>(e);
EventAddContact::AddContact *ac = ec->addContact();
- if (ac->proto && !strcmp(protocol()->description()->text, ac->proto)){
+ if (!ac->proto.isEmpty() && (protocol()->description()->text == ac->proto)){
Contact *contact = NULL;
QString resource;
findContact(ac->addr, ac->nick, true, contact, resource);
@@ -996,7 +996,7 @@
data->ID.str() = jid;
if (!resource.isEmpty())
data->Resource.str() = resource;
- if (name)
+ if (!name.isEmpty())
data->Name.str() = name;
info_request(data, false);
EventContact e(contact, EventContact::eChanged);
@@ -1041,11 +1041,11 @@
const char *JabberClient::get_icon(JabberUserData *data, unsigned status, bool invisible)
{
const CommandDef *def = protocol()->statusList();
- for (; def->text; def++){
+ for (; !def->text.isNull(); def++){
if (def->id == status)
break;
}
- if ((def == NULL) || (def->text == NULL))
+ if ((def == NULL) || (def->text.isNull()))
return "Jabber_offline";
const char *dicon = def->icon;
if (invisible)
@@ -1211,7 +1211,7 @@
const char *dicon = get_icon(data, data->Status.toULong(), data->invisible.toBool());
if (data->Status.toULong() > curStatus){
curStatus = data->Status.toULong();
- if (statusIcon && icons){
+ if (!statusIcon.isEmpty() && icons){
QString iconSave = *icons;
*icons = statusIcon;
if (iconSave.length())
@@ -1219,7 +1219,7 @@
}
statusIcon = dicon;
}else{
- if (statusIcon){
+ if (!statusIcon.isEmpty()){
addIcon(icons, dicon, statusIcon);
}else{
statusIcon = dicon;
@@ -2566,7 +2566,7 @@
msg->setContact(contact->id());
msg->setClient(dataName(data));
msg->setFlags(MESSAGE_RECEIVED);
- if (text)
+ if (!text.isEmpty())
msg->setText(unquoteString(text));
EventMessageReceived e(msg);
e.process();
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/jabber/jabbersearch.cpp
^
|
@@ -190,7 +190,7 @@
for (unsigned i = 0; i < data->nOptions.toULong(); i++){
QString label = get_str(data->OptionLabels, i);
QString val = get_str(data->Options, i);
- if (label && val){
+ if (!label.isEmpty() && !val.isEmpty()){
box->addItem(i18(label), val);
if (data->Value.str() == val)
cur = n;
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/jabber/jidsearch.cpp
^
|
@@ -17,6 +17,7 @@
#include <qpushbutton.h>
#include <qgroupbox.h>
+#include <qobjectlist.h>
#include "icons.h"
#include "misc.h"
@@ -65,7 +66,7 @@
connect(this, SIGNAL(setAdd(bool)), topLevelWidget(), SLOT(setAdd(bool)));
connect(this, SIGNAL(showResult(QWidget*)), topLevelWidget(), SLOT(showResult(QWidget*)));
connect(this, SIGNAL(addResult(QWidget*)), topLevelWidget(), SLOT(addResult(QWidget*)));
- if (m_adv->grpSearch->children()){
+ if (m_adv->grpSearch->children()->count()>0){
emit addResult(m_adv);
}else{
btnAdvanced->hide();
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/livejournal/CMakeLists.txt
^
|
@@ -21,4 +21,6 @@
msgjournalbase.ui
)
+SET(livejournal_MESSAGE_SOURCES ${livejournal_SRCS} ${livejournal_UICS} PARENT_SCOPE)
+
SIM_ADD_PLUGIN(livejournal)
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/logger/CMakeLists.txt
^
|
@@ -14,5 +14,6 @@
SET(logger_UICS
logconfigbase.ui
)
+SET(logger_MESSAGE_SOURCES ${logger_SRCS} ${logger_UICS} PARENT_SCOPE)
SIM_ADD_PLUGIN(logger)
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/msn/CMakeLists.txt
^
|
@@ -28,4 +28,6 @@
msnsearchbase.ui
)
+SET(msn_MESSAGE_SOURCES ${msn_SRCS} ${msn_UICS} PARENT_SCOPE)
+
SIM_ADD_PLUGIN(msn)
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/msn/msnclient.cpp
^
|
@@ -688,7 +688,7 @@
{
m_msg = new MSNServerMessage(this, size);
// only we post the message in log now.....
- log(L_WARN, "Personal message: %s", m_msg);
+ //log(L_WARN, "Personal message: %s", m_msg);
//packet_ready();
}
return;
@@ -1349,7 +1349,7 @@
case eEventAddContact: {
EventAddContact *ec = static_cast<EventAddContact*>(e);
EventAddContact::AddContact *ac = ec->addContact();
- if (ac->proto && !strcmp(protocol()->description()->text, ac->proto)){
+ if (!ac->proto.isEmpty() && (protocol()->description()->text == ac->proto)){
Contact *contact = NULL;
findContact(ac->addr, ac->nick, contact);
if (contact && (contact->getGroup() != ac->group)){
@@ -1769,7 +1769,7 @@
MSNUserData *data = toMSNUserData((SIM::clientData*)_data); // FIXME unsafe type conversion
unsigned cmp_status = data->Status.toULong();
const CommandDef *def;
- for (def = protocol()->statusList(); def->text; def++){
+ for (def = protocol()->statusList(); !def->text.isEmpty(); def++){
if (def->id == cmp_status)
break;
}
@@ -2613,7 +2613,7 @@
message += "MIME-Version: 1.0\r\n";
message += "Content-Type: text/plain; charset=UTF-8\r\n";
message += "X-MMS_IM-Format: ";
- if (msg->getFont()){
+ if (!msg->getFont().isEmpty()){
QString font = msg->getFont();
if (!font.isEmpty()){
QString font_type;
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/navigate/CMakeLists.txt
^
|
@@ -15,6 +15,9 @@
navcfgbase.ui
)
+SET(navigate_MESSAGE_SOURCES ${navigate_SRCS} ${navigate_UICS} PARENT_SCOPE)
+
ADD_FLEX_FILES(navigate_SRCS parseurl.ll)
+
SIM_ADD_PLUGIN(navigate)
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/netmonitor/CMakeLists.txt
^
|
@@ -13,4 +13,6 @@
netmonitor.h
)
+SET(netmonitor_MESSAGE_SOURCES ${netmonitor_SRCS} PARENT_SCOPE)
+
SIM_ADD_PLUGIN(netmonitor)
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/netmonitor/netmonitor.cpp
^
|
@@ -62,7 +62,7 @@
{
load_data(monitorData, &data, config);
- if (getLogPackets()){
+ if (!getLogPackets().isEmpty()){
QString packets = getLogPackets();
while (packets.length()){
QString v = getToken(packets, ',');
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/ontop/CMakeLists.txt
^
|
@@ -15,4 +15,6 @@
ontopcfgbase.ui
)
+SET(ontop_MESSAGE_SOURCES ${ontop_SRCS} ${ontop_UICS} PARENT_SCOPE)
+
SIM_ADD_PLUGIN(ontop)
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/osd/CMakeLists.txt
^
|
@@ -18,4 +18,6 @@
osdifacebase.ui
)
+SET(osd_MESSAGE_SOURCES ${osd_SRCS} ${osd_UICS} PARENT_SCOPE)
+
SIM_ADD_PLUGIN(osd)
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/proxy/CMakeLists.txt
^
|
@@ -23,6 +23,8 @@
# some needed include dirs
INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}/plugins/_core)
+SET(proxy_MESSAGE_SOURCES ${proxy_SRCS} ${proxy_UICS} PARENT_SCOPE)
+
SIM_ADD_PLUGIN(proxy)
ADD_DEPENDENCIES(proxy _core)
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/remote/CMakeLists.txt
^
|
@@ -12,6 +12,8 @@
remotecfgbase.ui
)
+SET(remote_MESSAGE_SOURCES ${remote_LIB_SRCS} ${remote_UI_FILES} PARENT_SCOPE)
+
# moc, if needed
KDE3_AUTOMOC(${remote_LIB_SRCS})
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/replace/CMakeLists.txt
^
|
@@ -14,5 +14,6 @@
SET(replace_UICS
replacecfgbase.ui
)
+SET(replace_MESSAGE_SOURCES ${replace_SRCS} ${replace_UICS} PARENT_SCOPE)
SIM_ADD_PLUGIN(replace)
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/shortcuts/CMakeLists.txt
^
|
@@ -18,4 +18,6 @@
shortcutcfgbase.ui
)
+SET(shortcuts_MESSAGE_SOURCES ${shortcuts_SRCS} ${shortcuts_UICS} PARENT_SCOPE)
+
SIM_ADD_PLUGIN(shortcuts)
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/shortcuts/shortcutcfg.cpp
^
|
@@ -82,7 +82,7 @@
const char *cfg_accel = m_plugin->getKey(s->id);
if (cfg_accel)
key = QAccel::stringToKey(cfg_accel);
- if ((key == 0) && s->accel)
+ if ((key == 0) && !s->accel.isEmpty())
key = QAccel::stringToKey(i18n(s->accel));
if (key)
accel = QAccel::keyToString(key);
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/shortcuts/shortcuts.cpp
^
|
@@ -727,7 +727,7 @@
s->flags |= COMMAND_GLOBAL_ACCEL;
}
}
- if (s->accel && (s->flags & COMMAND_GLOBAL_ACCEL)){
+ if (!s->accel.isEmpty() && (s->flags & COMMAND_GLOBAL_ACCEL)){
if (globalKeys == NULL)
globalKeys = new list<GlobalKey*>;
globalKeys->push_back(new GlobalKey(s));
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/sms/CMakeLists.txt
^
|
@@ -22,6 +22,8 @@
# some needed include dirs
INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}/plugins/_core)
+SET(sms_MESSAGE_SOURCES ${sms_SRCS} ${sms_UICS} PARENT_SCOPE)
+
SIM_ADD_PLUGIN(sms)
ADD_DEPENDENCIES(sms _core)
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/sound/CMakeLists.txt
^
|
@@ -18,6 +18,8 @@
sounduserbase.ui
)
+SET(sound_MESSAGE_SOURCES ${sound_SRCS} ${sound_UICS} PARENT_SCOPE)
+
SIM_ADD_PLUGIN(sound)
# install some sounds
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/sound/sound.cpp
^
|
@@ -304,7 +304,7 @@
return QString::null;
if (sound.isEmpty()){
def = core->messageTypes.find(type);
- if ((def == NULL) || (def->icon == NULL))
+ if ((def == NULL) || (def->icon.isEmpty()))
return QString::null;
MessageDef *mdef = (MessageDef*)(def->param);
if (mdef->flags & MESSAGE_SYSTEM){
@@ -391,7 +391,7 @@
/* If there is an external player selected, don't use Qt
Check first for getPlayer() since QSound::available()
can take 5 seconds to return a value */
- bool bSound = !getPlayer() && QSound::available();
+ bool bSound = !getPlayer().isEmpty() && QSound::available();
#endif
if (bSound){
if (!QSound::available()){
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/sound/sounds/Makefile.in
^
|
@@ -571,7 +571,7 @@
.NOEXPORT:
#>+ 2
-KDE_DIST=deleted.wav filedone.wav file.wav system.wav sms.wav Makefile.in message.wav auth.wav vip-online.wav error.wav refused.wav contacts.wav mailpager.wav contactrequest.wav web.wav authrequest.wav url.wav startup.wav added.wav msgsent.wav Makefile.am alert.wav
+KDE_DIST=deleted.wav filedone.wav file.wav system.wav sms.wav Makefile.in message.wav startup2.wav auth.wav vip-online.wav error.wav refused.wav contacts.wav mailpager.wav contactrequest.wav web.wav authrequest.wav url.wav startup.wav added.wav msgsent.wav Makefile.am alert.wav
#>+ 2
docs-am:
|
|
Changed |
sim-0.9.5.tar.bz2/plugins/sound/sounds/startup.ogg
^
|
|
Changed |
sim-0.9.5.tar.bz2/plugins/sound/sounds/startup.wav
^
|
|
Added |
sim-0.9.5.tar.bz2/plugins/sound/sounds/startup2.ogg
^
|
|
Added |
sim-0.9.5.tar.bz2/plugins/sound/sounds/startup2.wav
^
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/sound/sounduser.cpp
^
|
@@ -49,7 +49,7 @@
CommandsMapIterator it(m_plugin->core->messageTypes);
while ((cmd = ++it) != NULL){
MessageDef *def = (MessageDef*)(cmd->param);
- if ((def == NULL) || (cmd->icon == NULL) ||
+ if ((def == NULL) || (cmd->icon.isEmpty()) ||
(def->flags & (MESSAGE_HIDDEN | MESSAGE_SENDONLY | MESSAGE_CHILD)))
continue;
if ((def->singular == NULL) || (def->plural == NULL) ||
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/spell/CMakeLists.txt
^
|
@@ -1,37 +1,46 @@
+SET(spell_SRCS
+ spell.cpp
+ spellcfg.cpp
+ speller.cpp
+ spellhighlight.cpp
+)
+
+SET(spell_UICS
+ spellcfgbase.ui
+ spellfindbase.ui
+)
+
+SET(spell_HDRS
+ spell.h
+ spellcfg.h
+ speller.h
+ spellhighlight.h
+)
+
+IF(WIN32)
+ SET(spell_SRCS
+ ${spell_SRCS}
+ spellfind.cpp
+ )
+ SET(spell_HDRS
+ ${spell_HDRS}
+ spellfind.h
+ )
+ENDIF(WIN32)
+
+SET(spell_MESSAGE_SOURCES ${spell_SRCS} ${spell_UICS})
+IF(NOT WIN32)
+ SET(spell_MESSAGE_SOURCES ${spell_MESSAGE_SOURCES} spellfind.cpp)
+ENDIF(NOT WIN32)
+SET(spell_MESSAGE_SOURCES ${spell_MESSAGE_SOURCES} PARENT_SCOPE)
+
IF(ASPELL_FOUND AND NOT ENABLE_KDE3)
#################
# spell library #
#################
- SET(spell_SRCS
- spell.cpp
- spellcfg.cpp
- speller.cpp
- spellhighlight.cpp
- )
-
- SET(spell_HDRS
- spell.h
- spellcfg.h
- speller.h
- spellhighlight.h
- )
-
- IF(WIN32)
- SET(spell_SRCS
- ${spell_SRCS}
- spellfind.cpp
- )
- SET(spell_HDRS
- ${spell_HDRS}
- spellfind.h
- )
- ENDIF(WIN32)
-
- SET(spell_UICS
- spellcfgbase.ui
- spellfindbase.ui
- )
+
+
SET(spell_LIBS
${ASPELL_LIBRARIES}
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/splash/CMakeLists.txt
^
|
@@ -8,6 +8,7 @@
SET(splash_HDRS
splash.h
)
+SET(splash_MESSAGE_SOURCES ${splash_SRCS} PARENT_SCOPE)
SIM_ADD_PLUGIN(splash)
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/styles/CMakeLists.txt
^
|
@@ -21,4 +21,6 @@
stylescfgbase.ui
)
+SET(styles_MESSAGE_SOURCES ${styles_SRCS} ${styles_UICS} PARENT_SCOPE)
+
SIM_ADD_PLUGIN(styles)
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/transparent/CMakeLists.txt
^
|
@@ -1,27 +1,35 @@
#######################
# transparent library #
#######################
-IF(WIN32 OR ENABLE_KDE3)
- SET(transparent_SRCS
- transparent.cpp
- transparentcfg.cpp
- )
+SET(transparent_SRCS
+ transparent.cpp
+ transparentcfg.cpp
+)
+
+SET(transparent_HDRS
+ transparent.h
+ transparentcfg.h
+)
- SET(transparent_HDRS
- transparent.h
- transparentcfg.h
- )
+SET(transparent_UICS
+ transparentcfgbase.ui
+)
- SET(transparent_UICS
- transparentcfgbase.ui
- )
+IF(NOT WIN32)
+ SET(transparent_SRCS
+ ${transparent_SRCS}
+ transtop.cpp
+ )
+ENDIF(NOT WIN32)
- IF(NOT WIN32)
- SET(transparent_SRCS ${transparent_SRCS}
- transtop.cpp)
- ENDIF(NOT WIN32)
+SET(transparent_MESSAGE_SOURCES ${transparent_SRCS} ${transparent_UICS} )
+IF(WIN32)
+ SET( transparent_MESSAGE_SOURCES ${transparent_MESSAGE_SOURCES} transtop.cpp )
+ENDIF(WIN32)
+SET( transparent_MESSAGE_SOURCES ${transparent_MESSAGE_SOURCES} PARENT_SCOPE )
+IF(WIN32 OR ENABLE_KDE3)
SIM_ADD_PLUGIN(transparent)
ELSE(WIN32 OR ENABLE_KDE3)
- MESSAGE(STATUS "This plugin can only be used on windows or KDE")
+ MESSAGE(STATUS "This plugin can only be used on windows or KDE")
ENDIF(WIN32 OR ENABLE_KDE3)
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/update/CMakeLists.txt
^
|
@@ -1,8 +1,3 @@
-##################
-# update library #
-##################
-IF(FALSE)
-
SET(update_SRCS
update.cpp
)
@@ -11,6 +6,11 @@
update.h
)
-SIM_ADD_PLUGIN(update)
+SET(update_MESSAGE_SOURCES ${update_SRCS} PARENT_SCOPE)
+##################
+# update library #
+##################
+IF(FALSE) # Update plugin is disabled in cmake builds because it really works only in noragen's MSVC builds
+ SIM_ADD_PLUGIN(update)
ENDIF(FALSE)
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/weather/CMakeLists.txt
^
|
@@ -18,6 +18,8 @@
wifacecfgbase.ui
)
+SET(weather_MESSAGE_SOURCES ${weather_SRCS} ${weather_UICS} PARENT_SCOPE)
+
ADD_JISP_ARCHIVE(jisp weather.jisp weather_SRCS)
SIM_ADD_PLUGIN(weather)
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/windock/CMakeLists.txt
^
|
@@ -1,14 +1,17 @@
+SET(windock_SRCS
+ windock.cpp
+)
+
+SET(windock_HDRS
+ windock.h
+)
+
+SET(windock_MESSAGE_SOURCES ${windock_SRCS} ${windock_UICS} PARENT_SCOPE)
+
IF(WIN32)
###################
# windock library #
###################
- SET(windock_SRCS
- windock.cpp
- )
-
- SET(windock_HDRS
- windock.h
- )
# some needed include dirs
INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/plugins/ontop)
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/yahoo/CMakeLists.txt
^
|
@@ -1,34 +1,37 @@
#################
# yahoo library #
#################
+SET(yahoo_SRCS
+ crypt.cpp
+ yahoo.cpp
+ yahooauth.cpp
+ yahoocfg.cpp
+ yahooclient.cpp
+ yahoofiletransfer.cpp
+ yahoohttp.cpp
+ yahooinfo.cpp
+ yahoosearch.cpp
+ yahootransformtables.c
+)
+
+SET(yahoo_HDRS
+ yahoo.h
+ yahoocfg.h
+ yahooclient.h
+ yahooinfo.h
+ yahoosearch.h
+)
+
+SET(yahoo_UICS
+ yahoocfgbase.ui
+ yahooinfobase.ui
+ yahoosearchbase.ui
+)
+
+SET(yahoo_MESSAGE_SOURCES ${yahoo_SRCS} ${yahoo_UICS} PARENT_SCOPE)
+
+
if(OPENSSL_FOUND)
- SET(yahoo_SRCS
- crypt.cpp
- yahoo.cpp
- yahooauth.cpp
- yahoocfg.cpp
- yahooclient.cpp
- yahoofiletransfer.cpp
- yahoohttp.cpp
- yahooinfo.cpp
- yahoosearch.cpp
- yahootransformtables.c
- )
-
- SET(yahoo_HDRS
- yahoo.h
- yahoocfg.h
- yahooclient.h
- yahooinfo.h
- yahoosearch.h
- )
-
- SET(yahoo_UICS
- yahoocfgbase.ui
- yahooinfobase.ui
- yahoosearchbase.ui
- )
-
INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR})
LINK_DIRECTORIES(${OPENSSL_LIBRARY_DIR})
SIM_ADD_PLUGIN(yahoo)
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/yahoo/yahooclient.cpp
^
|
@@ -1324,7 +1324,7 @@
}
const CommandDef *def;
- for (def = protocol()->statusList(); def->text; def++){
+ for (def = protocol()->statusList(); !def->text.isEmpty(); def++){
if (def->id == cmp_status)
break;
}
@@ -1338,7 +1338,7 @@
}
statusIcon = def->icon;
}else{
- if (statusIcon){
+ if (!statusIcon.isEmpty()){
addIcon(icons, def->icon, statusIcon);
}else{
statusIcon = def->icon;
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/yahoo/yahoosearch.cpp
^
|
@@ -56,15 +56,16 @@
{
m_client = client;
connect(this, SIGNAL(setAdd(bool)), topLevelWidget(), SLOT(setAdd(bool)));
- edtID->setValidator(new QRegExpValidator(QRegExp("[0-9A-Za-z \\-_]+"), this));
+ edtID->setValidator(new QRegExpValidator(QRegExp("[0-9A-Za-z \\.\\-_]+"), this));
initCombo(cmbAge, 0, ages);
initCombo(cmbGender, 0, genders);
+ emit setAdd(true);
}
void YahooSearch::showEvent(QShowEvent *e)
{
YahooSearchBase::showEvent(e);
- emit setAdd(false);
+ emit setAdd(true);
}
void YahooSearch::search()
@@ -174,6 +175,12 @@
emit searchDone(this);
return false;
}
+void YahooSearch::createContact(unsigned tmpFlags, Contact *&contact)
+{
+ QString resource;
+ QString name = edtID->text();
+ createContact(name, tmpFlags, contact);
+}
void YahooSearch::createContact(const QString &id, unsigned tmpFlags, Contact *&contact)
{
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/yahoo/yahoosearch.h
^
|
@@ -41,6 +41,7 @@
void searchStop();
void searchMail(const QString&);
void searchName(const QString&, const QString&, const QString&);
+ void createContact(unsigned tmpFlags, SIM::Contact *&contact);
void createContact(const QString&, unsigned tmpFlags, SIM::Contact *&contact);
protected:
YahooClient *m_client;
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/plugins/zodiak/CMakeLists.txt
^
|
@@ -8,5 +8,6 @@
SET(zodiak_HDRS
zodiak.h
)
+SET(zodiak_MESSAGE_SOURCES ${zodiak_SRCS} ${zodiak_UICS} PARENT_SCOPE)
SIM_ADD_PLUGIN(zodiak)
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/sim/CMakeLists.txt
^
|
@@ -46,6 +46,8 @@
qzip/qzip.cpp
qzip/unzip.c
)
+SET(sim_LIB_MESSAGE_SOURCES ${sim_LIB_SRCS} PARENT_SCOPE)
+
SET(sim_LIB_HDRS
aboutdata.h
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/sim/buffer.h
^
|
@@ -25,10 +25,14 @@
#include "simapi.h"
#ifdef HAVE_STDINT_H
-#include <stdint.h>
+ #include <stdint.h>
#else
-typedef unsigned short uint16_t;
-typedef unsigned uint32_t;
+ typedef signed char int8_t;
+ typedef signed short int16_t;
+ typedef signed long int32_t;
+ typedef unsigned char uint8_t;
+ typedef unsigned short uint16_t;
+ typedef unsigned long uint32_t;
#endif
class EXPORT Buffer : public QByteArray
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/sim/event.h
^
|
@@ -305,14 +305,18 @@
class EXPORT EventInterfaceDown : public Event
{
+ int m_fd;
public:
- EventInterfaceDown() : Event(eEventInterfaceDown) {};
+ EventInterfaceDown(int fd) : Event(eEventInterfaceDown), m_fd(fd) {};
+ int getFd() { return m_fd; }
};
class EXPORT EventInterfaceUp : public Event
{
+ int m_fd;
public:
- EventInterfaceUp() : Event(eEventInterfaceUp) {};
+ EventInterfaceUp(int fd) : Event(eEventInterfaceUp), m_fd(fd) {};
+ int getFd() { return m_fd; }
};
class EXPORT EventArg : public Event
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/sim/socket.cpp
^
|
@@ -26,6 +26,8 @@
#include <netinet/in.h>
#include <netdb.h>
#include <arpa/inet.h>
+#include <net/if.h>
+#include <sys/ioctl.h>
#endif
@@ -502,6 +504,137 @@
#endif
+InterfaceChecker::InterfaceChecker(int polltime, bool raiseevents) : QObject(), m_pollTime(polltime), m_raiseEvents(raiseevents)
+{
+ m_timerID = startTimer(polltime);
+ m_testSocket = socket(PF_INET, SOCK_STREAM, 0);
+}
+
+InterfaceChecker::~InterfaceChecker()
+{
+ killTimer(m_timerID);
+#ifdef WIN32
+ closesocket(m_testSocket);
+#else
+ close(m_testSocket);
+#endif
+}
+
+void InterfaceChecker::setPollTime(int polltime)
+{
+ killTimer(m_timerID);
+ m_timerID = startTimer(polltime);
+ m_pollTime = polltime;
+}
+
+void InterfaceChecker::timerEvent(QTimerEvent* ev)
+{
+ if(ev->timerId() != m_timerID)
+ return;
+#ifndef WIN32
+ if(m_testSocket == -1)
+ {
+ log(L_DEBUG, "testsocket == -1");
+ // TODO try to reinitialize test socket
+ return;
+ }
+ struct ifreq ifr;
+ struct ifreq* ifrp;
+ struct ifreq ibuf[16];
+ struct ifconf ifc;
+
+ ifc.ifc_len = sizeof(ifr)*16;
+ ifc.ifc_buf = (caddr_t)&ibuf;
+ memset(ibuf, 0, sizeof(struct ifreq)*16);
+
+ int hret = ioctl(m_testSocket, SIOCGIFCONF, &ifc);
+ if(hret == -1)
+ {
+ log(L_DEBUG, "hret == -1");
+ return;
+ }
+
+ for(std::map<std::string, tIFState>::iterator it = m_states.begin(); it != m_states.end(); ++it)
+ {
+ (*it).second.present = false;
+ }
+
+ for(int i = 0; i < ifc.ifc_len/sizeof(struct ifreq); i++)
+ {
+ ifrp = ibuf + i;
+ strncpy(ifr.ifr_name, ifrp->ifr_name, sizeof(ifr.ifr_name));
+
+ if(strcmp(ifr.ifr_name, "lo") == 0 )
+ continue;
+
+ std::map<std::string, tIFState>::iterator it = m_states.find(ifr.ifr_name);
+ if(it == m_states.end())
+ {
+ // New interface
+ tIFState s = {true, true};
+ m_states[ifr.ifr_name] = s;
+ emit interfaceUp(QString(ifr.ifr_name));
+ log(L_DEBUG, "%s: appeared", ifr.ifr_name);
+ }
+
+ m_states[ifr.ifr_name].present = true;
+ hret = ioctl(m_testSocket, SIOCGIFFLAGS, &ifr);
+ if(hret != -1)
+ {
+ int state = ifr.ifr_flags & IFF_RUNNING;
+ if(state < 0)
+ {
+ log(L_DEBUG, "Incorrect state: %d (%s)", state, ifr.ifr_name);
+ return;
+ }
+ if((state == 0) && (m_states[ifr.ifr_name].state))
+ {
+ m_states[ifr.ifr_name].state = false;
+ emit interfaceDown(QString(ifr.ifr_name));
+ if(m_raiseEvents)
+ {
+ EventInterfaceDown e(-1);
+ e.process();
+ }
+ return;
+ }
+ if((state != 0) && (!m_states[ifr.ifr_name].state))
+ {
+ m_states[ifr.ifr_name].state = true;
+ emit interfaceUp(QString(ifr.ifr_name));
+ if(m_raiseEvents)
+ {
+ EventInterfaceUp e(-1);
+ e.process();
+ }
+ return;
+ }
+ return;
+ }
+ }
+
+ for(std::map<std::string, tIFState>::iterator it = m_states.begin(); it != m_states.end(); ++it)
+ {
+ if(it->second.present == false)
+ {
+ log(L_DEBUG, "%s: disappeared", it->first.c_str());
+ it->second.state = false;
+ emit interfaceDown(QString(it->first));
+ if(m_raiseEvents)
+ {
+ EventInterfaceDown e(-1);
+ e.process();
+ }
+ // TODO make it work with more than one disappeared interface
+ m_states.erase(it);
+ return;
+ }
+ }
+#else
+ return;
+#endif
+}
+
}
#ifndef NO_MOC_INCLUDES
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/sim/socket.h
^
|
@@ -18,6 +18,7 @@
#ifndef _SOCKET_H
#define _SOCKET_H
+#include <vector>
#include <qobject.h>
#include "buffer.h"
#include "contacts.h"
@@ -78,6 +79,7 @@
const QString &getHost() const { return m_host; }
unsigned short getPort() const { return m_port; }
const SocketNotify *getNotify() const { return notify; }
+ virtual int getFd() { return 0;}; // kind of hack
};
class ServerSocket;
@@ -235,6 +237,36 @@
ClientSocket *m_clientSocket;
};
+class EXPORT InterfaceChecker : public QObject
+{
+ Q_OBJECT
+public:
+ InterfaceChecker(int polltime = 5000, bool raiseEvents = false);
+ virtual ~InterfaceChecker();
+
+ void setPollTime(int polltime);
+
+signals:
+ void interfaceUp(QString ifname);
+ void interfaceDown(QString ifname);
+
+protected:
+ void timerEvent(QTimerEvent* e);
+
+private:
+ typedef struct
+ {
+ bool present;
+ bool state;
+ } tIFState;
+
+ int m_pollTime;
+ int m_timerID;
+ int m_testSocket;
+ std::map<std::string, tIFState> m_states;
+ bool m_raiseEvents;
+};
+
#ifdef ENABLE_OPENSSL
EXPORT QByteArray md5(const char*, int size = -1);
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/sim/sockfactory.cpp
^
|
@@ -144,23 +144,99 @@
return dns->label();
}
+bool SIMResolver::isDone()
+{
+ return bDone;
+}
+
+bool SIMResolver::isTimeout()
+{
+ return bTimeout;
+}
+
+
+
+StdResolver::StdResolver(QObject* parent, const QString& host) : QObject(parent), QThread(), m_done(false),
+ m_timeout(false), m_addr(0),
+ m_host(host)
+{
+ log(L_DEBUG, "StdResolver::StdResolver()");
+ this->start();
+ m_timer = new QTimer(this);
+ QObject::connect(m_timer, SIGNAL(timeout()), this, SLOT(timeout()));
+ m_timer->start(2000);
+}
+
+StdResolver::~StdResolver()
+{
+ delete m_timer;
+}
+
+unsigned long StdResolver::addr()
+{
+ return m_addr;
+}
+
+QString StdResolver::host() const
+{
+ return m_host;
+}
+
+void StdResolver::run()
+{
+ struct hostent* server_entry = gethostbyname(m_host.utf8().data());
+ if(server_entry == NULL)
+ {
+ log(L_WARN, "gethostbyname failed");
+ return;
+ }
+ m_addr = inet_addr(inet_ntoa(*(struct in_addr*)server_entry->h_addr_list[0]));
+ m_done = true;
+ QTimer::singleShot(0, parent(), SLOT(resultsReady()));
+}
+
+void StdResolver::timeout()
+{
+ m_timeout = true;
+ m_done = true;
+ QTimer::singleShot(0, parent(), SLOT(resultsReady()));
+}
+
+bool StdResolver::isDone()
+{
+ return m_done;
+}
+
+bool StdResolver::isTimeout()
+{
+ return m_timeout;
+}
+
+
+
void SIMSockets::resolve(const QString &host)
{
- SIMResolver *resolver = new SIMResolver(this, host);
+ // Win32 uses old resolver, based on QDns (which is buggy in qt3)
+ // *nix use new resolver
+//#ifdef WIN32
+// SIMResolver *resolver = new SIMResolver(this, host);
+//#else
+ StdResolver *resolver = new StdResolver(this, host);
+//#endif
resolvers.push_back(resolver);
}
void SIMSockets::resultsReady()
{
- list<SIMResolver*>::iterator it;
+ list<IResolver*>::iterator it;
for (it = resolvers.begin(); it != resolvers.end();){
- SIMResolver *r = *it;
- if (!r->bDone){
+ IResolver *r = *it;
+ if (!r->isDone()){
++it;
continue;
}
bool isActive;
- if (r->bTimeout){
+ if (r->isTimeout()){
isActive = false;
}else{
isActive = true;
@@ -190,6 +266,7 @@
return new SIMServerSocket();
}
+
SIMClientSocket::SIMClientSocket(QSocket *s)
{
sock = s;
@@ -360,14 +437,7 @@
void SIMClientSocket::checkInterface()
{
-#ifdef WIN32
- return;
-#endif
- if(!sock)
- return;
#ifndef WIN32
- // crissi: disabled until detection is fixed, see below FIXME
- return;
int fd = sock->socket();
if(fd == -1)
{
@@ -376,7 +446,7 @@
struct ifreq ifr;
struct ifreq* ifrp;
struct ifreq ibuf[16];
- struct ifconf ifc;
+ struct ifconf ifc;
ifc.ifc_len = sizeof(ifr)*16;
ifc.ifc_buf = (caddr_t)&ibuf;
@@ -387,16 +457,23 @@
{
return;
}
+ bool iffound = false;
for(int i = 0; i < ifc.ifc_len/sizeof(struct ifreq); i++)
{
ifrp = ibuf + i;
strncpy(ifr.ifr_name, ifrp->ifr_name, sizeof(ifr.ifr_name));
- if(strcmp(ifr.ifr_name, "lo") == 0)
- continue;
+
+ if (
+ strcmp(ifr.ifr_name, "lo") == 0 ||
+ (htonl(((sockaddr_in*)&ifrp->ifr_addr)->sin_addr.s_addr) != sock->address().toIPv4Address())
+ ) continue;
+
+ m_interface = ifr.ifr_name;
+ iffound = true;
+
hret = ioctl(fd, SIOCGIFFLAGS, &ifr);
if(hret != -1)
{
- // FIXME!!! check only interface where default route points (i.e. if default route points to eth1 and eth0 is up or not configured -> failes always
int state = ifr.ifr_flags & IFF_RUNNING;
if(state < 0)
{
@@ -406,22 +483,30 @@
if((state == 0) && (m_state))
{
m_state = false;
- log(L_DEBUG, "Carrier lost at: %s", ifr.ifr_name);
- EventInterfaceDown e;
+ emit interfaceDown(fd);
+ EventInterfaceDown e(fd);
e.process();
return;
}
if((state != 0) && (!m_state))
{
m_state = true;
- log(L_DEBUG, "Carrier is up again at: %s", ifr.ifr_name);
- EventInterfaceUp e;
+ emit interfaceUp(fd);
+ EventInterfaceUp e(fd);
e.process();
return;
}
return;
}
}
+ if(!iffound)
+ {
+ m_state = false;
+ emit interfaceDown(fd);
+ EventInterfaceDown e(fd);
+ e.process();
+ }
+#else
return;
#endif
}
@@ -488,6 +573,11 @@
QTimer::singleShot(t * 1000, this, SLOT(slotBytesWritten()));
}
+int SIMClientSocket::getFd()
+{
+ return sock->socket();
+}
+
SIMServerSocket::SIMServerSocket()
{
sn = NULL;
|
[-]
[+]
|
Changed |
sim-0.9.5.tar.bz2/sim/sockfactory.h
^
|
@@ -20,6 +20,7 @@
#include "simapi.h"
#include "socket.h"
+#include <qthread.h>
class QDns;
class QTimer;
@@ -42,6 +43,12 @@
virtual unsigned long localHost();
virtual void pause(unsigned);
virtual void close();
+ virtual int getFd();
+
+signals:
+ void interfaceDown(int sockfd); // Probably, sockfd is not needed
+ void interfaceUp(int sockfd);
+
protected slots:
void slotConnected();
void slotConnectionClosed();
@@ -64,6 +71,7 @@
QSocket *sock;
QTimer *timer;
bool bInWrite;
+ QString m_interface;
};
class SIMServerSocket : public QObject, public ServerSocket
@@ -91,23 +99,69 @@
unsigned short m_nPort;
};
-class SIMResolver : public QObject
+class IResolver
+{
+public:
+ virtual ~IResolver() {};
+ virtual unsigned long addr() = 0;
+ virtual QString host() const = 0;
+ virtual bool isDone() = 0;
+ virtual bool isTimeout() = 0;
+
+};
+
+class SIMResolver : public QObject, public IResolver
{
Q_OBJECT
public:
SIMResolver(QObject *parent, const QString &host);
- ~SIMResolver();
+ virtual ~SIMResolver();
+ virtual unsigned long addr();
+ virtual QString host() const;
+ virtual bool isDone();
+ virtual bool isTimeout();
+
+protected slots:
+ void resolveTimeout();
+ void resolveReady();
+
+private:
QTimer *timer;
QDns *dns;
bool bDone;
bool bTimeout;
- unsigned long addr();
- QString host() const;
+};
+
+// I'm not sure if this resolver will compile well in win32, hence this ifndef
+
+
+class StdResolver : public QObject, public QThread, public IResolver
+{
+ Q_OBJECT
+public:
+ StdResolver(QObject* parent, const QString& host);
+ virtual ~StdResolver();
+ virtual unsigned long addr();
+ virtual QString host() const;
+ virtual bool isDone();
+ virtual bool isTimeout();
+
+protected:
+ virtual void run();
+
protected slots:
- void resolveTimeout();
- void resolveReady();
+ void timeout();
+
+private:
+ bool m_done;
+ bool m_timeout;
+ unsigned long m_addr;
+ QString m_host;
+ QTimer* m_timer;
};
+
+
class SIMSockets : public SocketFactory
{
Q_OBJECT
@@ -124,7 +178,8 @@
void idle();
void checkState();
protected:
- std::list<SIMResolver*> resolvers;
+ std::list<IResolver*> resolvers;
+
};
class IP
|