Merge branch 'master' into fix-centos
This commit is contained in:
commit
8f136c2aa6
9 changed files with 137 additions and 13 deletions
|
@ -1,4 +1,4 @@
|
|||
TGL_OBJECTS=${OBJ}/mtproto-common.o ${OBJ}/mtproto-client.o ${OBJ}/queries.o ${OBJ}/structures.o ${OBJ}/binlog.o ${OBJ}/tgl.o ${OBJ}/updates.o ${OBJ}/tg-mime-types.o
|
||||
TGL_OBJECTS=${OBJ}/mtproto-common.o ${OBJ}/mtproto-client.o ${OBJ}/queries.o ${OBJ}/structures.o ${OBJ}/binlog.o ${OBJ}/tgl.o ${OBJ}/updates.o ${OBJ}/tg-mime-types.o ${OBJ}/mtproto-utils.o
|
||||
TLD_OBJECTS=${OBJ}/dump-tl-file.o
|
||||
GENERATE_OBJECTS=${OBJ}/generate.o
|
||||
TGL_COMMON_OBJECTS=${OBJ}/tools.o
|
||||
|
@ -14,16 +14,13 @@ dump-tl: ${EXE}/dump-tl-file
|
|||
|
||||
${OBJ}/auto/auto.o ${TGL_OBJECTS}: ${AUTO}/constants.h ${AUTO}/auto-header.h
|
||||
|
||||
${OBJ}/mime-types.o: ${srcdir}/mime.types
|
||||
ld -r -b binary -o $@ $^
|
||||
|
||||
${TGL_OBJ_C}: ${OBJ}/%.o: ${srcdir}/tgl/%.c | create_dirs
|
||||
${CC} ${INCLUDE} ${COMPILE_FLAGS} -iquote ${srcdir}/tgl -c -MP -MD -MF ${DEP}/$*.d -MQ ${OBJ}/$*.o -o $@ $<
|
||||
|
||||
${OBJ}/auto/auto.o: ${AUTO}/auto.c
|
||||
${CC} ${INCLUDE} ${COMPILE_FLAGS} -iquote ${srcdir}/tgl -c -MP -MD -MF ${DEP}/auto/auto.d -MQ ${OBJ}/auto/auto.o -o $@ $<
|
||||
|
||||
${LIB}/libtgl.a: ${TGL_OBJECTS} ${TGL_COMMON_OBJECTS} ${OBJ}/auto/auto.o ${OBJ}/mime-types.o
|
||||
${LIB}/libtgl.a: ${TGL_OBJECTS} ${TGL_COMMON_OBJECTS} ${OBJ}/auto/auto.o
|
||||
ar ruv $@ $^
|
||||
|
||||
${EXE}/generate: ${GENERATE_OBJECTS} ${TGL_COMMON_OBJECTS}
|
||||
|
@ -32,7 +29,7 @@ ${EXE}/generate: ${GENERATE_OBJECTS} ${TGL_COMMON_OBJECTS}
|
|||
${AUTO}/scheme.tlo: ${AUTO}/scheme.tl ${EXE}/tl-parser
|
||||
${EXE}/tl-parser -e $@ ${AUTO}/scheme.tl
|
||||
|
||||
${AUTO}/scheme.tl: ${srcdir}/tgl/scheme.tl ${srcdir}/tgl/encrypted_scheme.tl ${srcdir}/tgl/binlog.tl ${srcdir}/tgl/append.tl | ${AUTO}
|
||||
${AUTO}/scheme.tl: ${srcdir}/tgl/scheme.tl ${srcdir}/tgl/encrypted_scheme.tl ${srcdir}/tgl/binlog.tl ${srcdir}/tgl/append.tl ${srcdir}/tgl/mtproto.tl | ${AUTO}
|
||||
cat $^ > $@
|
||||
|
||||
${AUTO}/scheme2.tl: ${AUTO}/scheme.tl ${EXE}/tl-parser
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
TL_PARSER_OBJECTS=${OBJ}/tl-parser.o ${OBJ}/tlc.o ${OBJ}/crc32.o
|
||||
ALL_OBJS+=${TL_PARSER_OBJS}
|
||||
|
||||
|
|
2
telegram-adium/.gitignore
vendored
Normal file
2
telegram-adium/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
telegram-adium.xcodeproj/project.xcworkspace/xcuserdata/
|
||||
telegram-adium.xcodeproj/xcuserdata/matj.xcuserdatad/xcdebugger/
|
|
@ -337,6 +337,7 @@
|
|||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
|
||||
|
@ -375,11 +376,12 @@
|
|||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = s;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
|
@ -422,7 +424,7 @@
|
|||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)",
|
||||
"$(PROJECT_DIR)/../tgl",
|
||||
"$(PROJECT_DIR)/../tgl/libs",
|
||||
);
|
||||
OTHER_CFLAGS = "-DPURPLE_STATIC_PRPL";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
buildConfiguration = "Release"
|
||||
buildConfiguration = "Debug"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
allowLocationSimulation = "YES">
|
||||
|
|
|
@ -0,0 +1,71 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0510"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "C410948519BB2D7D0083BF3F"
|
||||
BuildableName = "telegram-adium.AdiumLibpurplePlugin"
|
||||
BlueprintName = "telegram-adium"
|
||||
ReferencedContainer = "container:telegram-adium.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
buildConfiguration = "Release">
|
||||
<Testables>
|
||||
</Testables>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
buildConfiguration = "Release"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
allowLocationSimulation = "YES">
|
||||
<PathRunnable
|
||||
FilePath = "/Applications/Adium.app">
|
||||
</PathRunnable>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "C410948519BB2D7D0083BF3F"
|
||||
BuildableName = "telegram-adium.AdiumLibpurplePlugin"
|
||||
BlueprintName = "telegram-adium"
|
||||
ReferencedContainer = "container:telegram-adium.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
buildConfiguration = "Release"
|
||||
debugDocumentVersioning = "YES">
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Release">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
|
@ -9,6 +9,11 @@
|
|||
<key>orderHint</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<key>telegrma-adium Release.xcscheme</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>1</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>SuppressBuildableAutocreation</key>
|
||||
<dict>
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <pwd.h>
|
||||
#include <regex.h>
|
||||
|
||||
#include "purple.h"
|
||||
#include "notify.h"
|
||||
|
@ -247,24 +248,28 @@ static char *format_document_desc (char *type, char *caption, gint64 size) {
|
|||
static char *format_message (struct tgl_message *M) {
|
||||
|
||||
switch (M->media.type) {
|
||||
/*
|
||||
case tgl_message_media_audio:
|
||||
return format_document_desc("AUDIO", "", M->media.audio.size);
|
||||
break;
|
||||
case tgl_message_media_audio_encr:
|
||||
return format_document_desc("AUDIO", "", M->media.encr_audio.size);
|
||||
break;
|
||||
*/
|
||||
case tgl_message_media_document:
|
||||
return format_document_desc("DOCUMENT", M->media.document.caption, M->media.document.size);
|
||||
break;
|
||||
case tgl_message_media_document_encr:
|
||||
return format_document_desc("DOCUMENT", M->media.encr_document.file_name, M->media.encr_document.size);
|
||||
return format_document_desc("DOCUMENT", M->media.encr_document.caption, M->media.encr_document.size);
|
||||
break;
|
||||
/*
|
||||
case tgl_message_media_video:
|
||||
return format_document_desc("VIDEO", M->media.video.caption, M->media.video.size);
|
||||
break;
|
||||
case tgl_message_media_video_encr:
|
||||
return format_document_desc("VIDEO", "", M->media.encr_video.size);
|
||||
break;
|
||||
*/
|
||||
case tgl_message_media_photo_encr:
|
||||
return format_document_desc("PHOTO", "", M->media.encr_photo.size);
|
||||
break;
|
||||
|
@ -1116,10 +1121,51 @@ static void tgprpl_rename_group (PurpleConnection * gc, const char *old_name, Pu
|
|||
debug ("tgprpl_rename_group()\n");
|
||||
}
|
||||
|
||||
static void tgprpl_convo_closed (PurpleConnection * gc, const char *who){
|
||||
static void tgprpl_convo_closed (PurpleConnection * gc, const char *who) {
|
||||
debug ("tgprpl_convo_closed()\n");
|
||||
}
|
||||
|
||||
static char *strdup_replace (char *str, const char *replace, char *with) {
|
||||
char **splitted = g_strsplit (str, replace, -1);
|
||||
char *joined = g_strjoinv ("", splitted);
|
||||
g_strfreev (splitted);
|
||||
return joined;
|
||||
}
|
||||
|
||||
static const char *tgprpl_normalize_phone_number (const PurpleAccount *account, const char *phone) {
|
||||
|
||||
// remove all special characters
|
||||
char *a = g_strdup(phone);
|
||||
char *b = strdup_replace (a, " ", "");
|
||||
char *c = strdup_replace (b, "/", "");
|
||||
char *normalized = strdup_replace (c, "-", "");
|
||||
g_free (b);
|
||||
g_free (a);
|
||||
g_free (c);
|
||||
|
||||
if (strlen (normalized) >= 22 ||
|
||||
strlen (normalized) < 5) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (normalized[0] != '+') {
|
||||
char *fixed = g_strdup_printf ("+%s", normalized);
|
||||
g_free (normalized);
|
||||
normalized = fixed;
|
||||
}
|
||||
|
||||
regex_t exp;
|
||||
if (regcomp (&exp, "\\+[0-9]+$", REG_EXTENDED) != 0) {
|
||||
warning ("Regex invalid");
|
||||
return NULL;
|
||||
}
|
||||
if (regexec (&exp, normalized, 0, 0, 0) != 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return normalized;
|
||||
}
|
||||
|
||||
static void tgprpl_set_buddy_icon (PurpleConnection * gc, PurpleStoredImage * img) {
|
||||
debug ("tgprpl_set_buddy_icon()\n");
|
||||
|
||||
|
@ -1199,7 +1245,7 @@ static PurplePluginProtocolInfo prpl_info = {
|
|||
tgprpl_rename_group,
|
||||
NULL, // buddy_free
|
||||
tgprpl_convo_closed,
|
||||
purple_normalize_nocase,
|
||||
tgprpl_normalize_phone_number,
|
||||
tgprpl_set_buddy_icon,
|
||||
NULL, // remove_group
|
||||
NULL, // get_cb_real_name
|
||||
|
|
2
tgl
2
tgl
|
@ -1 +1 @@
|
|||
Subproject commit be0fb0335bf68c07202f6dd24825db65a4ea1e59
|
||||
Subproject commit 76824c29a6dcb424e1109e691d31280a9cbaa954
|
Loading…
Add table
Reference in a new issue