mirror of https://github.com/LeOS-GSI/LeOS-Genesis
Bug Fixes
parent
70947fa670
commit
a4dc6cc1dd
|
@ -18,9 +18,6 @@
|
|||
</value>
|
||||
</option>
|
||||
</JetCodeStyleSettings>
|
||||
<MarkdownNavigatorCodeStyleSettings>
|
||||
<option name="RIGHT_MARGIN" value="72" />
|
||||
</MarkdownNavigatorCodeStyleSettings>
|
||||
<codeStyleSettings language="XML">
|
||||
<indentOptions>
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="4" />
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<bytecodeTargetLevel target="1.8" />
|
||||
</component>
|
||||
</project>
|
|
@ -16,6 +16,7 @@
|
|||
</set>
|
||||
</option>
|
||||
<option name="resolveModulePerSourceSet" value="false" />
|
||||
<option name="useQualifiedModuleNames" value="true" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
|
|
|
@ -1,13 +1,8 @@
|
|||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="ConstantConditions" enabled="false" level="WARNING" enabled_by_default="false">
|
||||
<option name="SUGGEST_NULLABLE_ANNOTATIONS" value="false" />
|
||||
<option name="DONT_REPORT_TRUE_ASSERT_STATEMENTS" value="false" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="FieldCanBeLocal" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="RawTypeCanBeGeneric" enabled="false" level="INFORMATION" enabled_by_default="false" />
|
||||
<inspection_tool class="RawUseOfParameterizedType" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="FieldMayBeFinal" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="SameParameterValue" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false">
|
||||
<option name="processCode" value="true" />
|
||||
|
@ -16,10 +11,5 @@
|
|||
</inspection_tool>
|
||||
<inspection_tool class="SuspiciousListRemoveInLoop" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="UNCHECKED_WARNING" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="UnnecessaryLocalVariable" enabled="false" level="WARNING" enabled_by_default="false">
|
||||
<option name="m_ignoreImmediatelyReturnedVariables" value="false" />
|
||||
<option name="m_ignoreAnnotatedVariables" value="false" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="UnusedReturnValue" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
</profile>
|
||||
</component>
|
|
@ -1,10 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="MarkdownEnhProjectSettings">
|
||||
<AnnotatorSettings targetHasSpaces="true" linkCaseMismatch="true" wikiCaseMismatch="true" wikiLinkHasDashes="true" notUnderWikiHome="true" targetNotWikiPageExt="true" notUnderSourceWikiHome="true" targetNameHasAnchor="true" targetPathHasAnchor="true" wikiLinkHasSlash="true" wikiLinkHasSubdir="true" wikiLinkHasOnlyAnchor="true" linkTargetsWikiHasExt="true" linkTargetsWikiHasBadExt="true" notUnderSameRepo="true" targetNotUnderVcs="false" linkNeedsExt="true" linkHasBadExt="true" linkTargetNeedsExt="true" linkTargetHasBadExt="true" wikiLinkNotInWiki="true" imageTargetNotInRaw="true" repoRelativeAcrossVcsRoots="true" multipleWikiTargetsMatch="true" unresolvedLinkReference="true" linkIsIgnored="true" anchorIsIgnored="true" anchorIsUnresolved="true" anchorLineReferenceIsUnresolved="true" anchorLineReferenceFormat="true" anchorHasDuplicates="true" abbreviationDuplicates="true" abbreviationNotUsed="true" attributeIdDuplicateDefinition="true" attributeIdNotUsed="true" footnoteDuplicateDefinition="true" footnoteUnresolved="true" footnoteDuplicates="true" footnoteNotUsed="true" macroDuplicateDefinition="true" macroUnresolved="true" macroDuplicates="true" macroNotUsed="true" referenceDuplicateDefinition="true" referenceUnresolved="true" referenceDuplicates="true" referenceNotUsed="true" referenceUnresolvedNumericId="true" enumRefDuplicateDefinition="true" enumRefUnresolved="true" enumRefDuplicates="true" enumRefNotUsed="true" enumRefLinkUnresolved="true" enumRefLinkDuplicates="true" simTocUpdateNeeded="true" simTocTitleSpaceNeeded="true" />
|
||||
<HtmlExportSettings updateOnSave="false" parentDir="" targetDir="" cssDir="css" scriptDir="js" plainHtml="false" imageDir="" copyLinkedImages="false" imagePathType="0" targetPathType="2" targetExt="" useTargetExt="false" noCssNoScripts="false" useElementStyleAttribute="false" linkToExportedHtml="true" exportOnSettingsChange="true" regenerateOnProjectOpen="false" linkFormatType="HTTP_ABSOLUTE" />
|
||||
<LinkMapSettings>
|
||||
<textMaps />
|
||||
</LinkMapSettings>
|
||||
</component>
|
||||
</project>
|
|
@ -1,62 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="MarkdownProjectSettings">
|
||||
<PreviewSettings splitEditorLayout="SPLIT" splitEditorPreview="PREVIEW" useGrayscaleRendering="false" zoomFactor="1.0" maxImageWidth="0" synchronizePreviewPosition="true" highlightPreviewType="LINE" highlightFadeOut="5" highlightOnTyping="true" synchronizeSourcePosition="true" verticallyAlignSourceAndPreviewSyncPosition="true" showSearchHighlightsInPreview="true" showSelectionInPreview="true" lastLayoutSetsDefault="false">
|
||||
<PanelProvider>
|
||||
<provider providerId="com.vladsch.md.nav.editor.swing.html.panel" providerName="Default - Swing" />
|
||||
</PanelProvider>
|
||||
</PreviewSettings>
|
||||
<ParserSettings gitHubSyntaxChange="false" correctedInvalidSettings="false" emojiShortcuts="1" emojiImages="0">
|
||||
<PegdownExtensions>
|
||||
<option name="ATXHEADERSPACE" value="true" />
|
||||
<option name="FENCED_CODE_BLOCKS" value="true" />
|
||||
<option name="INTELLIJ_DUMMY_IDENTIFIER" value="true" />
|
||||
<option name="RELAXEDHRULES" value="true" />
|
||||
<option name="STRIKETHROUGH" value="true" />
|
||||
<option name="TABLES" value="true" />
|
||||
<option name="TASKLISTITEMS" value="true" />
|
||||
</PegdownExtensions>
|
||||
<ParserOptions>
|
||||
<option name="COMMONMARK_LISTS" value="true" />
|
||||
<option name="EMOJI_SHORTCUTS" value="true" />
|
||||
<option name="GFM_TABLE_RENDERING" value="true" />
|
||||
<option name="PRODUCTION_SPEC_PARSER" value="true" />
|
||||
<option name="SIM_TOC_BLANK_LINE_SPACER" value="true" />
|
||||
</ParserOptions>
|
||||
</ParserSettings>
|
||||
<HtmlSettings headerTopEnabled="false" headerBottomEnabled="false" bodyTopEnabled="false" bodyBottomEnabled="false" addPageHeader="false" addAnchorLinks="false" anchorLinksWrapText="false" imageUriSerials="false" addDocTypeHtml="true" noParaTags="false" defaultUrlTitle="false" migratedPlantUml="true" migratedAnchorLinks="true" plantUmlConversion="0">
|
||||
<GeneratorProvider>
|
||||
<provider providerId="com.vladsch.md.nav.editor.text.html.generator" providerName="Unmodified HTML Generator" />
|
||||
</GeneratorProvider>
|
||||
<headerTop />
|
||||
<headerBottom />
|
||||
<bodyTop />
|
||||
<bodyBottom />
|
||||
<fencedCodeConversions>
|
||||
<option name="c4plantuml" value="NONE" />
|
||||
<option name="ditaa" value="NONE" />
|
||||
<option name="erd" value="NONE" />
|
||||
<option name="graphviz" value="NONE" />
|
||||
<option name="latex" value="KATEX" />
|
||||
<option name="math" value="KATEX" />
|
||||
<option name="mermaid" value="NONE" />
|
||||
<option name="nomnoml" value="NONE" />
|
||||
<option name="plantuml" value="NONE" />
|
||||
<option name="puml" value="NONE" />
|
||||
<option name="svgbob" value="NONE" />
|
||||
<option name="umlet" value="NONE" />
|
||||
<option name="vega" value="NONE" />
|
||||
<option name="vegalite" value="NONE" />
|
||||
<option name="wavedrom" value="NONE" />
|
||||
</fencedCodeConversions>
|
||||
</HtmlSettings>
|
||||
<CssSettings previewScheme="UI_SCHEME" cssUri="" isCssUriEnabled="false" isCssUriSerial="true" isCssTextEnabled="false" isDynamicPageWidth="true">
|
||||
<StylesheetProvider>
|
||||
<provider providerId="com.vladsch.md.nav.editor.text.html.css" providerName="No Stylesheet" />
|
||||
</StylesheetProvider>
|
||||
<ScriptProviders />
|
||||
<cssText />
|
||||
<cssUriHistory />
|
||||
</CssSettings>
|
||||
</component>
|
||||
</project>
|
|
@ -1,9 +1,4 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
<option name="id" value="Android" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK" />
|
||||
</project>
|
|
@ -1,12 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RunConfigurationProducerService">
|
||||
<option name="ignoredProducers">
|
||||
<set>
|
||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
|
||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
|
||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
|
||||
</set>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
|
@ -1,19 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/orbotservice/shadowsocks-android" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/orbotservice/src/main/shadowsocks-android" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/orbotservice/src/main/shadowsocks-android/core/src/main/jni/badvpn" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/orbotservice/src/main/shadowsocks-android/core/src/main/jni/libancillary" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/orbotservice/src/main/shadowsocks-android/core/src/main/jni/libevent" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/orbotservice/src/main/shadowsocks-android/core/src/main/jni/redsocks" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/orbotservice/src/main/shadowsocks-android/core/src/main/rust/shadowsocks-rust" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/shadowsocks-android" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/shadowsocks-android/core/src/main/jni/badvpn" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/shadowsocks-android/core/src/main/jni/libancillary" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/shadowsocks-android/core/src/main/jni/libevent" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/shadowsocks-android/core/src/main/jni/redsocks" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/shadowsocks-android/core/src/main/rust/shadowsocks-rust" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
|
@ -2,7 +2,7 @@ apply plugin: 'com.android.application'
|
|||
apply from: 'variables.gradle'
|
||||
|
||||
apply plugin: 'maven-publish'
|
||||
apply plugin: 'io.fabric'
|
||||
apply plugin: 'com.google.gms.google-services'
|
||||
|
||||
ext {
|
||||
geckoviewChannel = project.ext.firefox_channel
|
||||
|
@ -12,7 +12,6 @@ ext {
|
|||
repositories {
|
||||
maven {
|
||||
url "https://maven.mozilla.org/maven2/"
|
||||
maven { url 'https://maven.fabric.io/public' }
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
google()
|
||||
|
@ -26,11 +25,11 @@ android {
|
|||
defaultConfig {
|
||||
applicationId project.ext.applicationId
|
||||
minSdkVersion project.ext.minSdkVersion
|
||||
targetSdkVersion project.ext.targetSdkVersion
|
||||
// targetSdkVersion project.ext.targetSdkVersion
|
||||
versionCode project.ext.versionCode
|
||||
versionName project.ext.versionName
|
||||
}
|
||||
buildToolsVersion '29.0.2'
|
||||
buildToolsVersion '29.0.3'
|
||||
|
||||
flavorDimensions "abi"
|
||||
|
||||
|
@ -43,49 +42,61 @@ android {
|
|||
flavorDimensions project.ext.dimen
|
||||
|
||||
productFlavors {
|
||||
|
||||
arm {
|
||||
versionCode project.ext.arm_vcode
|
||||
versionName project.ext.arm_vname
|
||||
dimension "abi"
|
||||
ndk {
|
||||
abiFilters "armeabi-v7a"
|
||||
ndk.abiFilters 'armeabi-v7a','arm64-v8a', 'x86', 'x86_64'
|
||||
}
|
||||
}
|
||||
aarch64 {
|
||||
versionCode project.ext.aarch_vcode
|
||||
versionName project.ext.aarch_vname
|
||||
dimension "abi"
|
||||
ndk {
|
||||
abiFilters "armeabi", "armeabi-v7a", "x86"
|
||||
ndk.abiFilters 'armeabi-v7a','arm64-v8a', 'x86', 'x86_64'
|
||||
}
|
||||
}
|
||||
x86 {
|
||||
versionCode project.ext.x86_vcode
|
||||
versionName project.ext.x86_vname
|
||||
dimension "abi"
|
||||
ndk {
|
||||
abiFilters "armeabi", "armeabi-v7a", "x86"
|
||||
ndk.abiFilters 'armeabi-v7a','arm64-v8a', 'x86', 'x86_64'
|
||||
}
|
||||
}
|
||||
x86_64 {
|
||||
versionCode project.ext.x64_vcode
|
||||
versionName project.ext.x64_vname
|
||||
dimension "abi"
|
||||
ndk {
|
||||
abiFilters "armeabi", "armeabi-v7a", "x86"
|
||||
}
|
||||
}
|
||||
|
||||
signingConfigs {
|
||||
release {
|
||||
keyAlias 'demo'
|
||||
keyPassword 'demodemo'
|
||||
storeFile file("${rootProject.projectDir}/demo.keystore")
|
||||
storePassword 'demodemo'
|
||||
ndk.abiFilters 'armeabi-v7a','arm64-v8a', 'x86', 'x86_64'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
res.srcDirs =
|
||||
[
|
||||
'src/main/res/layouts/history',
|
||||
'src/main/res/layouts/language',
|
||||
'src/main/res/layouts/orbot',
|
||||
'src/main/res/layouts/bridge',
|
||||
'src/main/res/layouts/alert',
|
||||
'src/main/res/layouts/bookmark',
|
||||
'src/main/res/layouts/shared',
|
||||
'src/main/res/layouts/shared/listviews',
|
||||
'src/main/res/layouts/other',
|
||||
'src/main/res/custom-xml/alert',
|
||||
'src/main/res/custom-xml/images',
|
||||
'src/main/res/custom-xml/bookmark',
|
||||
'src/main/res/custom-xml/generic',
|
||||
'src/main/res/custom-xml/history',
|
||||
'src/main/res/custom-xml/home',
|
||||
'src/main/res/custom-xml/landing',
|
||||
'src/main/res/custom-xml/orbot',
|
||||
'src/main/res/custom-xml/setting',
|
||||
'src/main/res/layouts',
|
||||
'src/main/res/images',
|
||||
'src/main/res'
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
|
@ -119,11 +130,11 @@ dependencies {
|
|||
}
|
||||
|
||||
/*Default Libraries*/
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.2'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.2'
|
||||
implementation 'androidx.appcompat:appcompat:1.2.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
|
||||
implementation 'com.google.android.material:material:1.3.0-alpha02'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.2'
|
||||
implementation 'com.google.android.material:material:1.3.0-alpha03'
|
||||
implementation 'androidx.preference:preference:1.1.1'
|
||||
implementation 'com.google.android.material:material:1.2.1'
|
||||
implementation 'androidx.appcompat:appcompat:1.2.0'
|
||||
|
@ -158,3 +169,4 @@ dependencies {
|
|||
|
||||
apply plugin: 'com.android.application'
|
||||
apply plugin: 'com.google.gms.google-services'
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
<uses-permission android:name="android.permission.READ_CLIPBOARD" />
|
||||
<uses-permission android:name="android.permission.VIBRATE"/>
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
|
@ -18,7 +19,7 @@
|
|||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:launchMode="singleTask"
|
||||
android:networkSecurityConfig="@xml/ex_network_security_config"
|
||||
android:networkSecurityConfig="@xml/gx_network_security_config"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme"
|
||||
|
|
|
@ -1,147 +1,590 @@
|
|||
package com.darkweb.genesissearchengine.appManager.bookmarkManager;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewConfiguration;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import android.widget.*;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.darkweb.genesissearchengine.appManager.historyManager.bookmarkEnums;
|
||||
import com.darkweb.genesissearchengine.constants.enums;
|
||||
import com.darkweb.genesissearchengine.constants.strings;
|
||||
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
||||
import com.darkweb.genesissearchengine.helperManager.helperMethod;
|
||||
import com.example.myapplication.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import static android.content.Context.LAYOUT_INFLATER_SERVICE;
|
||||
|
||||
public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listViewHolder>
|
||||
{
|
||||
/*Private Variables*/
|
||||
|
||||
private ArrayList<bookmarkRowModel> mModelList;
|
||||
private ArrayList<bookmarkRowModel> temp_model_list;
|
||||
private eventObserver.eventListener event;
|
||||
private String filter = strings.EMPTY_STR;
|
||||
private boolean isClosing = false;
|
||||
private ArrayList<bookmarkRowModel> mModelList = new ArrayList<>();
|
||||
private ArrayList<bookmarkRowModel> mCurrentList;
|
||||
private ArrayList<bookmarkRowModel> mPassedList;
|
||||
private ArrayList<Integer> mRealID = new ArrayList<>();
|
||||
private ArrayList<Integer> mRealIndex = new ArrayList<>();
|
||||
private ArrayList<Date> mLongSelectedDate = new ArrayList<>();
|
||||
private ArrayList<String> mLongSelectedIndex = new ArrayList<>();
|
||||
private ArrayList<Integer> mLongSelectedID = new ArrayList<>();
|
||||
private ArrayList<View> mLongPressedViewHolders = new ArrayList<>();
|
||||
|
||||
bookmarkAdapter(ArrayList<bookmarkRowModel> model_list, eventObserver.eventListener event) {
|
||||
this.mModelList = model_list;
|
||||
this.event = event;
|
||||
temp_model_list = new ArrayList<>();
|
||||
private AppCompatActivity mContext;
|
||||
private bookmarkAdapterView mHistroyAdapterView;
|
||||
private Context mListHolderContext;
|
||||
private PopupWindow mPopupWindow = null;
|
||||
private eventObserver.eventListener mEvent;
|
||||
boolean mLongPressedMenuActive = false;
|
||||
private String mFilter = strings.GENERIC_EMPTY_STR;
|
||||
|
||||
/*Local Variables*/
|
||||
|
||||
private float mRecyclerPositionX1, mRecyclerPositionX2;
|
||||
private boolean mDisableCallable = false;
|
||||
private boolean mSearchEnabled = false;
|
||||
|
||||
bookmarkAdapter(ArrayList<bookmarkRowModel> pModelList, eventObserver.eventListener mEvent, AppCompatActivity pMainContext) {
|
||||
this.mEvent = mEvent;
|
||||
this.mCurrentList = new ArrayList<>();
|
||||
this.mPassedList = pModelList;
|
||||
this.mContext = pMainContext;
|
||||
this.mHistroyAdapterView = new bookmarkAdapterView(mContext);
|
||||
|
||||
initializeModelWithDate(false);
|
||||
}
|
||||
|
||||
|
||||
private void onLoading(){
|
||||
mContext.runOnUiThread(() -> {
|
||||
mCurrentList.add(new bookmarkRowModel(null, "loading",-2));
|
||||
notifyItemInserted(mCurrentList.size());
|
||||
});
|
||||
}
|
||||
|
||||
private void onLoadingClear(){
|
||||
|
||||
for(int mCounter = 0; mCounter< mCurrentList.size(); mCounter++){
|
||||
if(mCurrentList.get(mCounter).getHeader().equals("loading")){
|
||||
int finalM_counter = mCounter;
|
||||
mContext.runOnUiThread(() -> {
|
||||
mCurrentList.remove(finalM_counter);
|
||||
notifyItemRemoved(finalM_counter);
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void initializeModelWithDate(boolean pFilterEnabled){
|
||||
int m_real_counter=0;
|
||||
|
||||
mRealID.clear();
|
||||
mRealIndex.clear();
|
||||
mCurrentList.clear();
|
||||
this.mModelList.clear();
|
||||
onVerifyLongSelectedURL();
|
||||
|
||||
ArrayList<bookmarkRowModel> p_model_list = mPassedList;
|
||||
int m_date_state = -1;
|
||||
int m_last_day = -1;
|
||||
for(int counter = 0; counter< p_model_list.size(); counter++){
|
||||
|
||||
if(pFilterEnabled){
|
||||
if(!p_model_list.get(counter).getHeader().toLowerCase().contains(this.mFilter.toLowerCase()) && !p_model_list.get(counter).getDescription().toLowerCase().contains(this.mFilter)){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(p_model_list.get(counter).getDate());
|
||||
|
||||
int m_date_1 = cal.get(Calendar.DAY_OF_YEAR);
|
||||
cal.setTime(Calendar.getInstance().getTime());
|
||||
int m_date_2 = cal.get(Calendar.DAY_OF_YEAR);
|
||||
|
||||
float diff = m_date_2-m_date_1;
|
||||
|
||||
if(diff==0){
|
||||
if(m_date_state!=1){
|
||||
this.mModelList.add(new bookmarkRowModel(null, "Today ",-1));
|
||||
mRealID.add(m_real_counter);
|
||||
mRealIndex.add(m_real_counter);
|
||||
m_date_state = 1;
|
||||
}
|
||||
}else if (diff>=1){
|
||||
|
||||
if(m_date_state!=2 || m_last_day!=(int)(Math.ceil(diff/7)*7)){
|
||||
m_last_day = (int)(Math.ceil(diff/7)*7);
|
||||
this.mModelList.add(new bookmarkRowModel(null, "Last " + m_last_day + " Days",-1));
|
||||
mRealID.add(m_real_counter);
|
||||
mRealIndex.add(m_real_counter);
|
||||
m_date_state = 2;
|
||||
}
|
||||
}else {
|
||||
if(m_date_state!=3){
|
||||
this.mModelList.add(new bookmarkRowModel(null, "Older ",-1));
|
||||
mRealID.add(m_real_counter);
|
||||
mRealIndex.add(m_real_counter);
|
||||
m_date_state = 3;
|
||||
}
|
||||
}
|
||||
|
||||
mRealID.add(p_model_list.get(counter).getID());
|
||||
mRealIndex.add(m_real_counter);
|
||||
this.mModelList.add(p_model_list.get(counter));
|
||||
m_real_counter+=1;
|
||||
}
|
||||
mCurrentList.addAll(this.mModelList);
|
||||
}
|
||||
|
||||
/*Initializations*/
|
||||
|
||||
private ArrayList<String> getLongSelectedURL(){
|
||||
return mLongSelectedIndex;
|
||||
}
|
||||
|
||||
public void onDeleteSelected(){
|
||||
for(int m_counter = 0; m_counter< mLongSelectedIndex.size(); m_counter++){
|
||||
for(int m_counter_inner = 0; m_counter_inner< mCurrentList.size(); m_counter_inner++){
|
||||
if(mCurrentList.get(m_counter_inner).getDate() == mLongSelectedDate.get(m_counter) && mLongSelectedIndex.get(m_counter).equals(mCurrentList.get(m_counter_inner).getDescription())){
|
||||
mEvent.invokeObserver(Collections.singletonList(mRealIndex.get(m_counter_inner)),enums.etype.url_clear);
|
||||
mEvent.invokeObserver(Collections.singletonList(mLongSelectedID.get(m_counter)),enums.etype.url_clear_at);
|
||||
invokeFilter(false);
|
||||
mEvent.invokeObserver(Collections.singletonList(m_counter_inner),enums.etype.is_empty);
|
||||
|
||||
boolean mDateVerify = false;
|
||||
initializeModelWithDate(false);
|
||||
if(mCurrentList.size()>0 && mCurrentList.get(m_counter_inner-1).getHeader()==null && (mCurrentList.size()>m_counter_inner+1 && mCurrentList.get(m_counter_inner+1).getHeader()==null || mCurrentList.size()==m_counter_inner+1)){
|
||||
mDateVerify = true;
|
||||
}
|
||||
|
||||
if(m_counter_inner==0){
|
||||
notifyDataSetChanged();
|
||||
}else {
|
||||
|
||||
if(mDateVerify){
|
||||
notifyItemRemoved(m_counter_inner-1);
|
||||
mCurrentList.remove(m_counter_inner-1);
|
||||
notifyItemRemoved(m_counter_inner-1);
|
||||
mCurrentList.remove(m_counter_inner-1);
|
||||
notifyItemRangeChanged(m_counter_inner-1, mCurrentList.size());
|
||||
}else {
|
||||
notifyItemRemoved(m_counter_inner);
|
||||
mCurrentList.remove(m_counter_inner);
|
||||
notifyItemRangeChanged(m_counter_inner, mCurrentList.size());
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
clearLongSelectedURL();
|
||||
}
|
||||
|
||||
private void clearLongSelectedURL(){
|
||||
|
||||
for(int m_counter = 0; m_counter< mLongSelectedIndex.size(); m_counter++){
|
||||
|
||||
View m_item_view = mLongPressedViewHolders.get(m_counter);
|
||||
ImageButton m_popup_menu = m_item_view.findViewById(R.id.pRowMenu);
|
||||
ImageView p_logo_image = m_item_view.findViewById(R.id.pLogoImage);
|
||||
mPopupWindow = (PopupWindow) mHistroyAdapterView.onTrigger(bookmarkEnums.eBookmarkViewAdapterCommands.M_CLEAR_LONG_SELECTED_VIEW, Arrays.asList(m_popup_menu, p_logo_image, m_item_view));
|
||||
}
|
||||
mLongSelectedDate.clear();
|
||||
mLongSelectedIndex.clear();
|
||||
mLongSelectedID.clear();
|
||||
mLongPressedViewHolders.clear();
|
||||
}
|
||||
|
||||
private String getSelectedURL(){
|
||||
String m_joined_url = "\n";
|
||||
for(int m_counter = 0; m_counter< mLongSelectedIndex.size(); m_counter++){
|
||||
m_joined_url = m_joined_url.concat("\n"+ mLongSelectedIndex.get(m_counter));
|
||||
}
|
||||
return m_joined_url;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public listViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_row_view, parent, false);
|
||||
mListHolderContext = parent.getContext();
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.recyclerview_row, parent, false);
|
||||
return new listViewHolder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull bookmarkAdapter.listViewHolder holder, int position)
|
||||
{
|
||||
holder.bindListView(temp_model_list.get(position));
|
||||
clearMessageItem(holder.messageButton,position);
|
||||
holder.bindListView(mCurrentList.get(position), position);
|
||||
}
|
||||
|
||||
public int getItem(){
|
||||
return mCurrentList.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return temp_model_list.size();
|
||||
return mCurrentList.size();
|
||||
}
|
||||
|
||||
/*Listeners*/
|
||||
|
||||
private void setItemViewOnClickListener(View itemView, String url)
|
||||
{
|
||||
itemView.setOnClickListener(v ->event.invokeObserver(Collections.singletonList(url),enums.etype.url_triggered));
|
||||
public void onUpdateSearchStatus(boolean p_is_searched){
|
||||
mSearchEnabled = p_is_searched;
|
||||
}
|
||||
|
||||
private void clearMessageItem(ImageButton clearButton, int index)
|
||||
{
|
||||
clearButton.setOnClickListener(v ->
|
||||
{
|
||||
if(!isClosing){
|
||||
isClosing = true;
|
||||
int size = mModelList.size();
|
||||
|
||||
event.invokeObserver(Collections.singletonList(mModelList.get(temp_model_list.get(index).getmId()).getmId()),enums.etype.remove_from_database);
|
||||
event.invokeObserver(Collections.singletonList(temp_model_list.get(index).getmId()),enums.etype.url_clear);
|
||||
invokeFilter(false);
|
||||
event.invokeObserver(Collections.singletonList(index),enums.etype.is_empty);
|
||||
|
||||
if(size>1){
|
||||
new Thread(){
|
||||
public void run(){
|
||||
try
|
||||
{
|
||||
sleep(500);
|
||||
isClosing = false;
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}.start();
|
||||
public void onSelectView(View pItem, View pItemView, String pUrl, View pMenuItem, ImageView pLogoImage, boolean pIsForced, int pId, Date pDate){
|
||||
if(!mSearchEnabled){
|
||||
try {
|
||||
mPopupWindow = (PopupWindow) mHistroyAdapterView.onTrigger(bookmarkEnums.eBookmarkViewAdapterCommands.M_SELECT_VIEW, Arrays.asList(pItemView, pMenuItem, pLogoImage, pIsForced, true));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if(!pIsForced){
|
||||
if(mLongSelectedID.size()==0){
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
mLongSelectedDate.add(pDate);
|
||||
mLongSelectedIndex.add(pUrl);
|
||||
mLongSelectedID.add(pId);
|
||||
mLongPressedViewHolders.add(pItem);
|
||||
|
||||
}
|
||||
onVerifyLongSelectedURL();
|
||||
}
|
||||
}
|
||||
|
||||
public void onVerifyLongSelectedURL(){
|
||||
if(mLongSelectedIndex.size()>0){
|
||||
mEvent.invokeObserver(Collections.singletonList(false),enums.etype.on_verify_selected_url_menu);
|
||||
}else {
|
||||
mEvent.invokeObserver(Collections.singletonList(true),enums.etype.on_verify_selected_url_menu);
|
||||
}
|
||||
}
|
||||
|
||||
public void onClearHighlight(View pItem, View pItemView, String pUrl, View pMenuItem, ImageView pLogoImage, boolean pIsForced, int pId, Date pDate)
|
||||
{
|
||||
try {
|
||||
mPopupWindow = (PopupWindow) mHistroyAdapterView.onTrigger(bookmarkEnums.eBookmarkViewAdapterCommands.M_CLEAR_HIGHLIGHT, Arrays.asList(pItemView, pMenuItem, pLogoImage, pIsForced));
|
||||
mLongSelectedDate.remove(pDate);
|
||||
mLongSelectedIndex.remove(pUrl);
|
||||
mLongSelectedID.remove((Integer) pId);
|
||||
mLongPressedViewHolders.remove(pItem);
|
||||
if(mLongSelectedID.size()==0){
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
onVerifyLongSelectedURL();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private float mPointerPosition = 0;
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
public void onSwipe(View pItem, View pItemView, int pPosition, String pUrl, View pMenuItem, ImageView pLogoImage, int pId, Date pDate){
|
||||
|
||||
Handler handler = new Handler();
|
||||
|
||||
Runnable mLongPressed = () -> {
|
||||
if(!mDisableCallable && Math.abs(mRecyclerPositionX1-mPointerPosition) <= 20){
|
||||
if(!mLongSelectedIndex.contains(pUrl) || !mLongSelectedID.contains(pId)) {
|
||||
mLongPressedMenuActive = true;
|
||||
onSelectView(pItem, pItemView, pUrl,pMenuItem, pLogoImage, false, pId, pDate);
|
||||
}else {
|
||||
onClearHighlight(pItem, pItemView, pUrl,pMenuItem, pLogoImage, false, pId, pDate);
|
||||
mLongPressedMenuActive = true;
|
||||
}
|
||||
}else {
|
||||
pItemView.setPressed(false);
|
||||
pItemView.clearFocus();
|
||||
}
|
||||
};
|
||||
|
||||
pItemView.setOnTouchListener((v, event) -> {
|
||||
|
||||
if (mRecyclerPositionX1!=0 && Math.abs(event.getX() - mRecyclerPositionX1) > 400 && !mLongPressedMenuActive) {
|
||||
v.setPressed(false);
|
||||
pItemView.clearFocus();
|
||||
handler.removeCallbacks(mLongPressed);
|
||||
pItemView.setOnTouchListener(null);
|
||||
pItemView.clearFocus();
|
||||
if(mPassedList.size()<=1){
|
||||
mPassedList.clear();
|
||||
initializeModelWithDate(false);
|
||||
notifyItemRemoved(0);
|
||||
notifyItemRangeChanged(0, 1);
|
||||
mEvent.invokeObserver(Collections.singletonList(0),enums.etype.is_empty);
|
||||
}else {
|
||||
bookmarkAdapter.this.onClose(pPosition);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
mPointerPosition = event.getX();
|
||||
if (event.getAction() == MotionEvent.ACTION_UP) {
|
||||
mRecyclerPositionX2 = event.getX();
|
||||
float deltaX = mRecyclerPositionX2 - mRecyclerPositionX1;
|
||||
|
||||
if (mLongSelectedIndex.size() > 0) {
|
||||
if (Math.abs(deltaX) <= 20 && !mLongPressedMenuActive) {
|
||||
if (mLongSelectedIndex.contains(pUrl) && mLongSelectedID.contains(pId)) {
|
||||
handler.removeCallbacks(mLongPressed);
|
||||
bookmarkAdapter.this.onClearHighlight(pItem, pItemView, pUrl, pMenuItem, pLogoImage, false, pId, pDate);
|
||||
} else{
|
||||
handler.removeCallbacks(mLongPressed);
|
||||
bookmarkAdapter.this.onSelectView(pItem, pItemView, pUrl, pMenuItem, pLogoImage, false, pId, pDate);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Math.abs(deltaX) > 100) {
|
||||
v.setPressed(false);
|
||||
handler.removeCallbacks(mLongPressed);
|
||||
bookmarkAdapter.this.onClose(pPosition);
|
||||
} else {
|
||||
v.setPressed(false);
|
||||
handler.removeCallbacks(mLongPressed);
|
||||
mEvent.invokeObserver(Collections.singletonList(pUrl), enums.etype.url_triggered);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
} else if (event.getAction() == MotionEvent.ACTION_DOWN) {
|
||||
mDisableCallable = false;
|
||||
mLongPressedMenuActive = false;
|
||||
v.setPressed(true);
|
||||
mRecyclerPositionX1 = event.getX();
|
||||
Log.i("1WOW : ","WOW : " + event.getX() + " -- " + mRecyclerPositionX1);
|
||||
handler.postDelayed(mLongPressed, ViewConfiguration.getLongPressTimeout());
|
||||
return true;
|
||||
} else if (event.getAction() == MotionEvent.ACTION_CANCEL) {
|
||||
handler.removeCallbacks(mLongPressed);
|
||||
mDisableCallable = true;
|
||||
if (!mLongSelectedIndex.contains(pUrl) || !mLongSelectedID.contains(pId)) {
|
||||
v.setPressed(false);
|
||||
}
|
||||
handler.removeCallbacks(mLongPressed);
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
void onOpenMenu(View pView, String pUrl, int pPosition, String pTitle){
|
||||
LayoutInflater layoutInflater = (LayoutInflater) pView.getContext().getSystemService(LAYOUT_INFLATER_SERVICE);
|
||||
@SuppressLint("InflateParams") final View mPopupView = layoutInflater.inflate(R.layout.recyclerview__row_menu, null);
|
||||
mPopupWindow = (PopupWindow) mHistroyAdapterView.onTrigger(bookmarkEnums.eBookmarkViewAdapterCommands.M_OPEN_MENU, Arrays.asList(mPopupWindow, pView, mPopupView));
|
||||
|
||||
setPopupWindowEvents(mPopupView.findViewById(R.id.pMenuCopy), pUrl, pPosition, pTitle);
|
||||
setPopupWindowEvents(mPopupView.findViewById(R.id.pMenuShare), pUrl, pPosition, pTitle);
|
||||
setPopupWindowEvents(mPopupView.findViewById(R.id.pMenuOpenCurrentTab), pUrl, pPosition, pTitle);
|
||||
setPopupWindowEvents(mPopupView.findViewById(R.id.pMenuOpenNewTab), pUrl, pPosition, pTitle);
|
||||
setPopupWindowEvents(mPopupView.findViewById(R.id.pMenuDelete), pUrl, pPosition, pTitle);
|
||||
}
|
||||
|
||||
public void setPopupWindowEvents(View pView, String pUrl, int pPosition, String pTitle){
|
||||
pView.setOnClickListener(v -> {
|
||||
if(v.getId() == R.id.pMenuCopy){
|
||||
helperMethod.copyURL(pUrl, mListHolderContext);
|
||||
mPopupWindow.dismiss();
|
||||
}
|
||||
else if(v.getId() == R.id.pMenuShare){
|
||||
helperMethod.shareApp((AppCompatActivity)mListHolderContext, pUrl, pTitle);
|
||||
mPopupWindow.dismiss();
|
||||
}
|
||||
else if(v.getId() == R.id.pMenuOpenCurrentTab){
|
||||
mEvent.invokeObserver(Collections.singletonList(pUrl),enums.etype.url_triggered);
|
||||
mPopupWindow.dismiss();
|
||||
}
|
||||
else if(v.getId() == R.id.pMenuOpenNewTab){
|
||||
mEvent.invokeObserver(Collections.singletonList(pUrl),enums.etype.url_triggered_new_tab);
|
||||
mPopupWindow.dismiss();
|
||||
}
|
||||
else if(v.getId() == R.id.pMenuDelete){
|
||||
onClose(pPosition);
|
||||
mPopupWindow.dismiss();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setItemViewOnClickListener(View pItem, View pItemView, View pItemMenu, String pUrl, int pPosition, String pTitle, View pMenuItem, ImageView pLogoImage, int pId, Date pDate)
|
||||
{
|
||||
pItemMenu.setOnClickListener((View v) -> onOpenMenu(v, pUrl, pPosition, pTitle));
|
||||
onSwipe(pItem, pItemView, pPosition, pUrl,pMenuItem, pLogoImage, pId, pDate);
|
||||
}
|
||||
|
||||
private void onClose(int pIndex){
|
||||
mEvent.invokeObserver(Collections.singletonList(mRealIndex.get(pIndex)),enums.etype.url_clear);
|
||||
mEvent.invokeObserver(Collections.singletonList(mRealID.get(pIndex)),enums.etype.url_clear_at);
|
||||
invokeFilter(false);
|
||||
mEvent.invokeObserver(Collections.singletonList(mRealID.get(pIndex)),enums.etype.is_empty);
|
||||
boolean mDateVerify = false;
|
||||
if(mPassedList.size()>0){
|
||||
if(mCurrentList.size()>0 && mCurrentList.get(pIndex-1).getHeader()==null && (mCurrentList.size()>pIndex+1 && mCurrentList.get(pIndex+1).getHeader()==null || mCurrentList.size()==pIndex+1)){
|
||||
mDateVerify = true;
|
||||
}
|
||||
}else {
|
||||
mCurrentList.clear();
|
||||
notifyDataSetChanged();
|
||||
return;
|
||||
}
|
||||
int size = mCurrentList.size();
|
||||
|
||||
if(mDateVerify){
|
||||
notifyItemRemoved(pIndex-1);
|
||||
mCurrentList.remove(pIndex-1);
|
||||
notifyItemRemoved(pIndex-1);
|
||||
mCurrentList.remove(pIndex-1);
|
||||
notifyItemRangeChanged(pIndex-1, mCurrentList.size());
|
||||
}else {
|
||||
notifyItemRemoved(pIndex);
|
||||
mCurrentList.remove(pIndex);
|
||||
notifyItemRangeChanged(pIndex, mCurrentList.size());
|
||||
}
|
||||
|
||||
if(size>1){
|
||||
new Thread(){
|
||||
public void run(){
|
||||
try
|
||||
{
|
||||
sleep(500);
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}.start();
|
||||
}
|
||||
}
|
||||
|
||||
/*View Holder Extensions*/
|
||||
|
||||
class listViewHolder extends RecyclerView.ViewHolder
|
||||
{
|
||||
TextView heaaderText;
|
||||
TextView descriptionText;
|
||||
ImageButton messageButton;
|
||||
ImageView empty_message;
|
||||
LinearLayout itemContainer;
|
||||
TextView mHeader;
|
||||
TextView mDescription;
|
||||
TextView mDate;
|
||||
TextView mWebLogo;
|
||||
ImageButton mRowMenu;
|
||||
ImageView mLogoImage;
|
||||
LinearLayout mRowContainer;
|
||||
LinearLayout mDateContainer;
|
||||
LinearLayout mLoadingContainer;
|
||||
|
||||
listViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
}
|
||||
|
||||
void bindListView(bookmarkRowModel model) {
|
||||
void bindListView(bookmarkRowModel model, int p_position) {
|
||||
mDateContainer = itemView.findViewById(R.id.pDateContainer);
|
||||
mHeader = itemView.findViewById(R.id.pHeader);
|
||||
mDescription = itemView.findViewById(R.id.pDescription);
|
||||
mRowContainer = itemView.findViewById(R.id.pRowContainer);
|
||||
mRowMenu = itemView.findViewById(R.id.pRowMenu);
|
||||
mDate = itemView.findViewById(R.id.pDate);
|
||||
mLogoImage = itemView.findViewById(R.id.pLogoImage);
|
||||
mWebLogo = itemView.findViewById(R.id.pWebLogo);
|
||||
mLoadingContainer = itemView.findViewById(R.id.pLoadingContainer);
|
||||
|
||||
heaaderText = itemView.findViewById(R.id.p_header);
|
||||
descriptionText = itemView.findViewById(R.id.p_description);
|
||||
itemContainer = itemView.findViewById(R.id.p_item_container);
|
||||
|
||||
String header = model.getmHeader();
|
||||
if(model.getID() == -1){
|
||||
mDate.setText(model.getDescription());
|
||||
mDateContainer.setVisibility(View.VISIBLE);
|
||||
mRowContainer.setVisibility(View.GONE);
|
||||
mRowMenu.setVisibility(View.GONE);
|
||||
mWebLogo.setVisibility(View.GONE);
|
||||
mLoadingContainer.setVisibility(View.GONE);
|
||||
}
|
||||
else if(model.getID() == -2){
|
||||
mDate.setText(model.getDescription());
|
||||
mDateContainer.setVisibility(View.GONE);
|
||||
mRowContainer.setVisibility(View.GONE);
|
||||
mRowMenu.setVisibility(View.GONE);
|
||||
mWebLogo.setVisibility(View.GONE);
|
||||
mLoadingContainer.setVisibility(View.VISIBLE);
|
||||
}
|
||||
else {
|
||||
mDateContainer.setVisibility(View.GONE);
|
||||
mLoadingContainer.setVisibility(View.GONE);
|
||||
mRowContainer.setVisibility(View.VISIBLE);
|
||||
mRowMenu.setVisibility(View.VISIBLE);
|
||||
mWebLogo.setVisibility(View.VISIBLE);
|
||||
|
||||
descriptionText.setText(model.getmHeader());
|
||||
heaaderText.setText(model.getmDescription());
|
||||
// messageButton = itemView.findViewById(R.id.message_button);
|
||||
empty_message = itemView.findViewById(R.id.p_empty_list);
|
||||
|
||||
setItemViewOnClickListener(itemContainer,header);
|
||||
mWebLogo.setText((helperMethod.getDomainName(model.getDescription()).toUpperCase().charAt(0)+""));
|
||||
String header = model.getHeader();
|
||||
mDescription.setText((model.getDescription()));
|
||||
mHeader.setText(model.getHeader());
|
||||
|
||||
setItemViewOnClickListener(itemView, mRowContainer, mRowMenu, mDescription.getText().toString(), p_position, header, mRowMenu, mLogoImage, model.getID(), model.getDate());
|
||||
}
|
||||
|
||||
if(mLongSelectedID.size()>0){
|
||||
mRowMenu.setVisibility(View.GONE);
|
||||
}else {
|
||||
mRowMenu.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
if(mLongSelectedIndex.contains(model.getDescription()) && mLongSelectedID.contains(model.getID())){
|
||||
mPopupWindow = (PopupWindow) mHistroyAdapterView.onTrigger(bookmarkEnums.eBookmarkViewAdapterCommands.M_SELECT_VIEW, Arrays.asList(mRowContainer, mRowMenu, mLogoImage, true, false));
|
||||
}else if(mLogoImage.getAlpha()>0){
|
||||
mPopupWindow = (PopupWindow) mHistroyAdapterView.onTrigger(bookmarkEnums.eBookmarkViewAdapterCommands.M_CLEAR_HIGHLIGHT, Arrays.asList(mRowContainer, mRowMenu, mLogoImage, true, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void setFilter(String filter){
|
||||
this.filter = filter;
|
||||
void setFilter(String pFilter){
|
||||
this.mFilter = pFilter.toLowerCase();
|
||||
}
|
||||
|
||||
void invokeFilter(boolean notify){
|
||||
temp_model_list.clear();
|
||||
for(int counter = 0; counter< mModelList.size(); counter++){
|
||||
if(mModelList.get(counter).getmHeader().contains(filter) || mModelList.get(counter).getmDescription().contains(filter)){
|
||||
bookmarkRowModel model = mModelList.get(counter);
|
||||
temp_model_list.add(new bookmarkRowModel(model.getmHeader(),model.getmDescription(),counter));
|
||||
}
|
||||
}
|
||||
|
||||
if(notify){
|
||||
if(mFilter.length()>0){
|
||||
initializeModelWithDate(true);
|
||||
}else {
|
||||
initializeModelWithDate(false);
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isLongPressMenuActive(){
|
||||
return mLongSelectedIndex.size()>0;
|
||||
}
|
||||
|
||||
public Object onTrigger(bookmarkEnums.eBookmarkAdapterCommands pCommands, List<Object> pData){
|
||||
if(pCommands == bookmarkEnums.eBookmarkAdapterCommands.GET_SELECTED_URL){
|
||||
return getSelectedURL();
|
||||
}
|
||||
else if(pCommands == bookmarkEnums.eBookmarkAdapterCommands.M_ON_LOADING){
|
||||
onLoading();
|
||||
}
|
||||
else if(pCommands == bookmarkEnums.eBookmarkAdapterCommands.M_LOADING_CLEAR){
|
||||
onLoadingClear();
|
||||
}
|
||||
else if(pCommands == bookmarkEnums.eBookmarkAdapterCommands.M_CLEAR_LONG_SELECTED_URL){
|
||||
clearLongSelectedURL();
|
||||
}
|
||||
else if(pCommands == bookmarkEnums.eBookmarkAdapterCommands.GET_LONG_SELECTED_URL){
|
||||
return getLongSelectedURL();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,122 @@
|
|||
package com.darkweb.genesissearchengine.appManager.bookmarkManager;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.view.View;
|
||||
import android.widget.ActionMenuView;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.PopupWindow;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.darkweb.genesissearchengine.appManager.historyManager.bookmarkEnums;
|
||||
import com.darkweb.genesissearchengine.helperManager.helperMethod;
|
||||
import com.example.myapplication.R;
|
||||
import java.util.List;
|
||||
|
||||
public class bookmarkAdapterView
|
||||
{
|
||||
/*Private Variables*/
|
||||
private AppCompatActivity mContext;
|
||||
|
||||
bookmarkAdapterView(AppCompatActivity pContext)
|
||||
{
|
||||
this.mContext = pContext;
|
||||
}
|
||||
|
||||
public Object openMenu(PopupWindow pPopupWindow, View pView, View popupView){
|
||||
|
||||
if(pPopupWindow !=null){
|
||||
pPopupWindow.dismiss();
|
||||
}
|
||||
|
||||
pPopupWindow = new PopupWindow(
|
||||
popupView,
|
||||
ActionMenuView.LayoutParams.WRAP_CONTENT,
|
||||
ActionMenuView.LayoutParams.WRAP_CONTENT, true);
|
||||
|
||||
pView.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
|
||||
int xOffset = -(pView.getMeasuredWidth() - pView.getWidth());
|
||||
|
||||
int[] location = new int[2];
|
||||
pView.getLocationOnScreen(location);
|
||||
int y = location[1];
|
||||
int height = helperMethod.getScreenHeight(mContext);
|
||||
int m_offset_height = 0;
|
||||
if(y + helperMethod.pxFromDp(300) >height){
|
||||
m_offset_height = helperMethod.pxFromDp(203);
|
||||
}
|
||||
else{
|
||||
m_offset_height = 0;
|
||||
}
|
||||
|
||||
pPopupWindow.setOutsideTouchable(true);
|
||||
pPopupWindow.setFocusable(true);
|
||||
pPopupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
pPopupWindow.setAnimationStyle(R.style.popup_window_animation);
|
||||
pPopupWindow.setElevation(7);
|
||||
pPopupWindow.showAsDropDown(pView,xOffset - 90, -m_offset_height-helperMethod.pxFromDp(50));
|
||||
return pPopupWindow;
|
||||
}
|
||||
|
||||
private void clearLongSelectedURL(ImageButton pPopupMenu, ImageView pLogoImage, View mItemView){
|
||||
mItemView.setPressed(false);
|
||||
pPopupMenu.setVisibility(View.VISIBLE);
|
||||
pPopupMenu.animate().setDuration(150).alpha(1);
|
||||
pPopupMenu.setClickable(true);
|
||||
pLogoImage.setAlpha(1f);
|
||||
pLogoImage.animate().cancel();
|
||||
pLogoImage.animate().setDuration(150).alpha(0).withEndAction(() -> pLogoImage.setVisibility(View.GONE));
|
||||
}
|
||||
|
||||
public void onSelectView(View pItemView, View pMenuItem, ImageView pLogoImage, boolean pIsForced, boolean pVibrate){
|
||||
pItemView.setPressed(false);
|
||||
int speed = 150;
|
||||
if(pIsForced){
|
||||
speed=0;
|
||||
}
|
||||
if(pVibrate){
|
||||
helperMethod.vibrate(mContext);
|
||||
}
|
||||
|
||||
pLogoImage.setAlpha(0.5f);
|
||||
pLogoImage.setVisibility(View.VISIBLE);
|
||||
pLogoImage.animate().cancel();
|
||||
pLogoImage.animate().setDuration(speed).alpha(1);
|
||||
}
|
||||
|
||||
public void onClearHighlight( View pItemView, View pMenuItem, ImageView pLogoImage, boolean pIsForced)
|
||||
{
|
||||
try {
|
||||
if(pLogoImage.getAlpha()>0){
|
||||
pItemView.setPressed(false);
|
||||
int speed = 150;
|
||||
if(pIsForced){
|
||||
speed = 0;
|
||||
}
|
||||
pLogoImage.setAlpha(1f);
|
||||
pLogoImage.animate().cancel();
|
||||
pLogoImage.animate().setDuration(speed).alpha(0).withEndAction(() -> pLogoImage.setVisibility(View.GONE));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public Object onTrigger(bookmarkEnums.eBookmarkViewAdapterCommands pCommands, List<Object> pData){
|
||||
if(pCommands == bookmarkEnums.eBookmarkViewAdapterCommands.M_OPEN_MENU){
|
||||
return openMenu((PopupWindow) pData.get(0), (View) pData.get(1), (View) pData.get(2));
|
||||
}
|
||||
if(pCommands == bookmarkEnums.eBookmarkViewAdapterCommands.M_CLEAR_LONG_SELECTED_VIEW){
|
||||
clearLongSelectedURL((ImageButton)pData.get(0), (ImageView)pData.get(1), (View)pData.get(2));
|
||||
}
|
||||
if(pCommands == bookmarkEnums.eBookmarkViewAdapterCommands.M_SELECT_VIEW){
|
||||
onSelectView((View)pData.get(0), (View)pData.get(1), (ImageView)pData.get(2), (Boolean) pData.get(3), (Boolean) pData.get(4));
|
||||
}
|
||||
if(pCommands == bookmarkEnums.eBookmarkViewAdapterCommands.M_CLEAR_HIGHLIGHT){
|
||||
onClearHighlight((View)pData.get(0), (View)pData.get(1), (ImageView)pData.get(2), (Boolean) pData.get(3));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,21 +1,28 @@
|
|||
package com.darkweb.genesissearchengine.appManager.bookmarkManager;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.darkweb.genesissearchengine.appManager.activityContextManager;
|
||||
import com.darkweb.genesissearchengine.appManager.databaseManager.databaseController;
|
||||
import com.darkweb.genesissearchengine.appManager.historyManager.bookmarkEnums;
|
||||
import com.darkweb.genesissearchengine.appManager.homeManager.homeController;
|
||||
import com.darkweb.genesissearchengine.constants.enums;
|
||||
import com.darkweb.genesissearchengine.constants.keys;
|
||||
import com.darkweb.genesissearchengine.constants.sql;
|
||||
import com.darkweb.genesissearchengine.constants.status;
|
||||
import com.darkweb.genesissearchengine.constants.strings;
|
||||
import com.darkweb.genesissearchengine.dataManager.dataController;
|
||||
|
@ -24,26 +31,36 @@ import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
|||
import com.darkweb.genesissearchengine.helperManager.helperMethod;
|
||||
import com.darkweb.genesissearchengine.pluginManager.pluginController;
|
||||
import com.example.myapplication.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import static com.darkweb.genesissearchengine.appManager.historyManager.bookmarkEnums.eBookmarkViewCommands.M_VERTIFY_SELECTION_MENU;
|
||||
|
||||
|
||||
public class bookmarkController extends AppCompatActivity
|
||||
{
|
||||
/*Private Variables*/
|
||||
|
||||
private bookmarkModel mListModel;
|
||||
private bookmarkModel mbookmarkModel;
|
||||
private homeController mHomeController;
|
||||
private activityContextManager mContextManager;
|
||||
private bookmarkAdapter mbookmarkAdapter;
|
||||
|
||||
private ImageView mEmptyListNotifier;
|
||||
private EditText mSearchBar;
|
||||
private RecyclerView mListView;
|
||||
/*Private Views*/
|
||||
|
||||
private ImageView mEmptyListNotification;
|
||||
private EditText mSearchInput;
|
||||
private RecyclerView mRecycleView;
|
||||
private Button mClearButton;
|
||||
private ImageButton mMenuButton;
|
||||
private ImageButton mSearchButton;
|
||||
|
||||
private bookmarkViewController mBookmarkViewController;
|
||||
private bookmarkViewController mbookmarkViewController;
|
||||
private boolean isUpdatingRecyclerView = false;
|
||||
private boolean mIsScrollingUp;
|
||||
|
||||
/*Initializations*/
|
||||
|
||||
|
@ -55,38 +72,49 @@ public class bookmarkController extends AppCompatActivity
|
|||
initializeListModel();
|
||||
initializeViews();
|
||||
initializeList();
|
||||
onEditorInvoked();
|
||||
initCustomListeners();
|
||||
}
|
||||
|
||||
public void initializeListModel(){
|
||||
mListModel = new bookmarkModel();
|
||||
mListModel.setList(dataController.getInstance().getBookmark());
|
||||
mbookmarkModel = new bookmarkModel();
|
||||
mContextManager = activityContextManager.getInstance();
|
||||
mHomeController = activityContextManager.getInstance().getHomeController();
|
||||
mContextManager.setBookmarkController(this);
|
||||
pluginController.getInstance().logEvent(strings.BOOKMARK_OPENED);
|
||||
pluginController.getInstance().logEvent(strings.EVENT_BOOKMARK_OPENED);
|
||||
}
|
||||
public void initializeViews(){
|
||||
mEmptyListNotifier = findViewById(R.id.p_empty_list);
|
||||
mSearchBar = findViewById(R.id.p_search);
|
||||
mListView = findViewById(R.id.p_listview);
|
||||
mClearButton = findViewById(R.id.p_clearButton);
|
||||
mBookmarkViewController = new bookmarkViewController(mEmptyListNotifier, mSearchBar, mListView, mClearButton,this);
|
||||
mClearButton.setText(R.string.tab_view_clear_bookmark);
|
||||
mEmptyListNotification = findViewById(R.id.pEmptyListNotification);
|
||||
mSearchInput = findViewById(R.id.pSearchInput);
|
||||
mRecycleView = findViewById(R.id.pRecycleView);
|
||||
mClearButton = findViewById(R.id.pClearButton);
|
||||
mMenuButton = findViewById(R.id.pMenuButton);
|
||||
mSearchButton = findViewById(R.id.pSearchButton);
|
||||
|
||||
mbookmarkViewController = new bookmarkViewController(mEmptyListNotification, mSearchInput, mRecycleView, mClearButton,this, mMenuButton, mSearchButton);
|
||||
}
|
||||
public void initializeList(){
|
||||
bookmarkAdapter adapter = new bookmarkAdapter(mListModel.getList(),new adapterCallback());
|
||||
ArrayList<bookmarkRowModel> model = (ArrayList<bookmarkRowModel>) dataController.getInstance().invokeBookmark(dataEnums.eBookmarkCommands.M_GET_BOOKMARK ,null);
|
||||
mbookmarkModel.setList(model);
|
||||
bookmarkAdapter adapter = new bookmarkAdapter(mbookmarkModel.getList(),new adapterCallback(), this);
|
||||
mbookmarkAdapter = adapter;
|
||||
adapter.invokeFilter(false);
|
||||
mListView.setAdapter(adapter);
|
||||
mListView.setLayoutManager(new LinearLayoutManager(this));
|
||||
mBookmarkViewController.updateIfListEmpty(mListModel.getList().size(),0);
|
||||
mRecycleView.setNestedScrollingEnabled(false);
|
||||
mRecycleView.setHasFixedSize(true);
|
||||
|
||||
mRecycleView.setAdapter(adapter);
|
||||
mRecycleView.setItemViewCacheSize(100);
|
||||
mRecycleView.setDrawingCacheEnabled(true);
|
||||
mRecycleView.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_HIGH);
|
||||
|
||||
mRecycleView.setLayoutManager(new LinearLayoutManager(this));
|
||||
mbookmarkViewController.onTrigger(bookmarkEnums.eBookmarkViewCommands.M_UPDATE_LIST_IF_EMPTY, Arrays.asList(mbookmarkModel.getList().size(),0));
|
||||
}
|
||||
|
||||
/*View Handlers*/
|
||||
public void initCustomListeners(){
|
||||
mClearButton.requestFocusFromTouch();
|
||||
mClearButton.setOnClickListener(v -> pluginController.getInstance().MessageManagerHandler(activityContextManager.getInstance().getBookmarkController(), Collections.singletonList(strings.GENERIC_EMPTY_STR), enums.etype.clear_bookmark));
|
||||
|
||||
public void onEditorInvoked(){
|
||||
|
||||
mSearchBar.setOnEditorActionListener((v, actionId, event) ->{
|
||||
mSearchInput.setOnEditorActionListener((v, actionId, event) ->{
|
||||
if (actionId == EditorInfo.IME_ACTION_NEXT)
|
||||
{
|
||||
helperMethod.hideKeyboard(this);
|
||||
|
@ -95,7 +123,16 @@ public class bookmarkController extends AppCompatActivity
|
|||
return false;
|
||||
});
|
||||
|
||||
mSearchBar.addTextChangedListener(new TextWatcher() {
|
||||
mSearchInput.setOnFocusChangeListener((v, hasFocus) -> {
|
||||
if (!hasFocus) {
|
||||
mSearchInput.clearFocus();
|
||||
}else {
|
||||
((bookmarkAdapter) Objects.requireNonNull(mRecycleView.getAdapter())).setFilter(mSearchInput.getText().toString());
|
||||
((bookmarkAdapter) mRecycleView.getAdapter()).invokeFilter(true);
|
||||
}
|
||||
});
|
||||
|
||||
mSearchInput.addTextChangedListener(new TextWatcher() {
|
||||
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2){
|
||||
|
@ -110,31 +147,37 @@ public class bookmarkController extends AppCompatActivity
|
|||
@Override
|
||||
public void afterTextChanged(Editable editable)
|
||||
{
|
||||
((bookmarkAdapter) Objects.requireNonNull(mListView.getAdapter())).setFilter(mSearchBar.getText().toString());
|
||||
((bookmarkAdapter) mListView.getAdapter()).invokeFilter(true);
|
||||
((bookmarkAdapter) Objects.requireNonNull(mRecycleView.getAdapter())).setFilter(mSearchInput.getText().toString());
|
||||
((bookmarkAdapter) mRecycleView.getAdapter()).invokeFilter(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void onBackPressed(View view){
|
||||
this.finish();
|
||||
}
|
||||
public void onclearDataTrigger(View view){
|
||||
pluginController.getInstance().MessageManagerHandler(this, Collections.singletonList(strings.EMPTY_STR),enums.etype.clear_bookmark);
|
||||
}
|
||||
public void onclearData(){
|
||||
mListModel.clearList();
|
||||
((bookmarkAdapter) Objects.requireNonNull(mListView.getAdapter())).invokeFilter(true );
|
||||
mBookmarkViewController.clearList();
|
||||
databaseController.getInstance().execSQL("delete from bookmark where 1",null);
|
||||
/*View Custom Overrides*/
|
||||
|
||||
@Override
|
||||
public boolean dispatchTouchEvent(MotionEvent event) {
|
||||
if (event.getAction() == MotionEvent.ACTION_DOWN) {
|
||||
View v = getCurrentFocus();
|
||||
if ( v instanceof EditText) {
|
||||
Rect outRect = new Rect();
|
||||
v.getGlobalVisibleRect(outRect);
|
||||
if (!outRect.contains((int)event.getRawX(), (int)event.getRawY())) {
|
||||
v.clearFocus();
|
||||
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.dispatchTouchEvent(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTrimMemory(int level)
|
||||
{
|
||||
if(status.sIsAppPaused && (level==80 || level==15))
|
||||
if(status.sSettingIsAppPaused && (level==80 || level==15))
|
||||
{
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.LOW_MEMORY,true));
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.HOME_LOW_MEMORY,true));
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
@ -143,43 +186,115 @@ public class bookmarkController extends AppCompatActivity
|
|||
public void onResume()
|
||||
{
|
||||
activityContextManager.getInstance().setCurrentActivity(this);
|
||||
status.sIsAppPaused = false;
|
||||
status.sSettingIsAppPaused = false;
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause()
|
||||
{
|
||||
status.sIsAppPaused = true;
|
||||
status.sSettingIsAppPaused = true;
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if(mSearchInput.getVisibility() == View.VISIBLE){
|
||||
onHideSearch(null);
|
||||
}else if(mbookmarkAdapter.isLongPressMenuActive()){
|
||||
onClearMultipleSelection(null);
|
||||
}else {
|
||||
onBackPressed(null);
|
||||
}
|
||||
}
|
||||
|
||||
/*External XML Listeners*/
|
||||
|
||||
public void onBackPressed(View view){
|
||||
this.finish();
|
||||
}
|
||||
|
||||
public void onHideSearch(View view) {
|
||||
((bookmarkAdapter) mRecycleView.getAdapter()).onUpdateSearchStatus((boolean) mbookmarkViewController.onTrigger(bookmarkEnums.eBookmarkViewCommands.M_HIDE_SEARCH, null));
|
||||
}
|
||||
|
||||
public void onLongPressMenu(View view) {
|
||||
mbookmarkViewController.onTrigger(bookmarkEnums.eBookmarkViewCommands.M_LONG_PRESS_MENU, Collections.singletonList(view));
|
||||
}
|
||||
|
||||
public void onOpenMultipleTabs(View view) {
|
||||
ArrayList<String> m_long_selected_urk = (ArrayList<String>) mbookmarkAdapter.onTrigger(bookmarkEnums.eBookmarkAdapterCommands.GET_LONG_SELECTED_URL, null);
|
||||
for(int m_counter=0;m_counter<m_long_selected_urk.size();m_counter++){
|
||||
mHomeController.onOpenLinkNewTab(m_long_selected_urk.get(m_counter));
|
||||
}
|
||||
onBackPressed(null);
|
||||
mbookmarkAdapter.onTrigger(bookmarkEnums.eBookmarkAdapterCommands.M_CLEAR_LONG_SELECTED_URL,null);
|
||||
mbookmarkViewController.onTrigger(bookmarkEnums.eBookmarkViewCommands.M_CLOSE_MENU, null);
|
||||
}
|
||||
|
||||
public void onShareSelectedURL(View view) {
|
||||
String m_joined_url = (String) mbookmarkAdapter.onTrigger(bookmarkEnums.eBookmarkAdapterCommands.GET_SELECTED_URL, null);
|
||||
helperMethod.shareURL(this, m_joined_url);
|
||||
mbookmarkAdapter.onTrigger(bookmarkEnums.eBookmarkAdapterCommands.M_CLEAR_LONG_SELECTED_URL,null);
|
||||
mbookmarkViewController.onTrigger(bookmarkEnums.eBookmarkViewCommands.M_CLOSE_MENU, null);
|
||||
}
|
||||
|
||||
public void onClearMultipleSelection(View view) {
|
||||
mbookmarkAdapter.onTrigger(bookmarkEnums.eBookmarkAdapterCommands.M_CLEAR_LONG_SELECTED_URL, null);
|
||||
mbookmarkViewController.onTrigger(bookmarkEnums.eBookmarkViewCommands.M_CLOSE_MENU, null);
|
||||
mbookmarkViewController.onTrigger(M_VERTIFY_SELECTION_MENU,Collections.singletonList(true));
|
||||
}
|
||||
|
||||
public void onDeleteSelected(View view) {
|
||||
mbookmarkViewController.onTrigger(bookmarkEnums.eBookmarkViewCommands.M_CLOSE_MENU, null);
|
||||
mbookmarkAdapter.onDeleteSelected();
|
||||
}
|
||||
|
||||
/*Helper Methods*/
|
||||
|
||||
public void onclearData(){
|
||||
mbookmarkModel.clearList();
|
||||
((bookmarkAdapter) Objects.requireNonNull(mRecycleView.getAdapter())).invokeFilter(true );
|
||||
mbookmarkViewController.onTrigger(bookmarkEnums.eBookmarkViewCommands.M_CLEAR_LIST, null);
|
||||
databaseController.getInstance().execSQL(sql.SQL_CLEAR_BOOKMARK,null);
|
||||
finish();
|
||||
}
|
||||
|
||||
|
||||
/*Event Observer*/
|
||||
|
||||
public class adapterCallback implements eventObserver.eventListener{
|
||||
|
||||
@Override
|
||||
public Object invokeObserver(List<Object> data, enums.etype e_type)
|
||||
{
|
||||
if(e_type.equals(enums.etype.url_triggered)){
|
||||
String url_temp = helperMethod.completeURL(data.get(0).toString());
|
||||
pluginController.getInstance().logEvent(strings.BOOKMARK_TRIGGERED);
|
||||
pluginController.getInstance().logEvent(strings.EVENT_BOOKMARK_TRIGGERED);
|
||||
mHomeController.onLoadURL(url_temp);
|
||||
finish();
|
||||
}
|
||||
else if(e_type.equals(enums.etype.url_triggered_new_tab)){
|
||||
String url_temp = helperMethod.completeURL(data.get(0).toString());
|
||||
pluginController.getInstance().logEvent(strings.EVENT_BOOKMARK_TRIGGERED);
|
||||
mHomeController.onOpenLinkNewTab(url_temp);
|
||||
finish();
|
||||
}
|
||||
else if(e_type.equals(enums.etype.url_clear)){
|
||||
mListModel.onManualClear((int)data.get(0));
|
||||
mbookmarkModel.onManualClear((int)data.get(0));
|
||||
}
|
||||
else if(e_type.equals(enums.etype.url_clear_at)){
|
||||
dataController.getInstance().invokeBookmark(dataEnums.eBookmarkCommands.M_DELETE_BOOKMARK ,data);
|
||||
}
|
||||
else if(e_type.equals(enums.etype.is_empty)){
|
||||
mBookmarkViewController.removeFromList((int)data.get(0));
|
||||
mBookmarkViewController.updateIfListEmpty(mListModel.getList().size(),300);
|
||||
mbookmarkViewController.onTrigger(bookmarkEnums.eBookmarkViewCommands.M_UPDATE_LIST_IF_EMPTY, Arrays.asList(mbookmarkModel.getList().size(),300));
|
||||
}
|
||||
else if(e_type.equals(enums.etype.remove_from_database)){
|
||||
databaseController.getInstance().deleteFromList((int)data.get(0),"bookmark");
|
||||
databaseController.getInstance().deleteFromList((int)data.get(0),strings.HISTORY_TITLE);
|
||||
}
|
||||
else if(e_type.equals(enums.etype.on_verify_selected_url_menu)){
|
||||
mbookmarkViewController.onTrigger(M_VERTIFY_SELECTION_MENU, data);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
package com.darkweb.genesissearchengine.appManager.historyManager;
|
||||
|
||||
public class bookmarkEnums
|
||||
{
|
||||
/*History Manager*/
|
||||
public enum eBookmarkViewCommands {
|
||||
M_UPDATE_LIST_IF_EMPTY, M_UPDATE_LIST, M_REMOVE_FROM_LIST, M_CLEAR_LIST,M_VERTIFY_SELECTION_MENU, M_CLOSE_MENU, M_HIDE_SEARCH, M_LONG_PRESS_MENU
|
||||
}
|
||||
|
||||
public enum eBookmarkAdapterCommands {
|
||||
M_ON_LOADING, M_LOADING_CLEAR, M_CLEAR_LONG_SELECTED_URL, GET_SELECTED_URL, GET_LONG_SELECTED_URL
|
||||
}
|
||||
|
||||
public enum eBookmarkViewAdapterCommands {
|
||||
M_OPEN_MENU, M_CLEAR_LONG_SELECTED_VIEW, M_SELECT_VIEW, M_CLEAR_HIGHLIGHT
|
||||
}
|
||||
|
||||
}
|
|
@ -8,16 +8,13 @@ class bookmarkModel
|
|||
|
||||
private ArrayList<bookmarkRowModel> mModelList = new ArrayList<>();
|
||||
|
||||
/*Initializations*/
|
||||
/*Helper Methods*/
|
||||
|
||||
void setList(ArrayList<bookmarkRowModel> model)
|
||||
{
|
||||
mModelList = model;
|
||||
}
|
||||
ArrayList<bookmarkRowModel> getList()
|
||||
{
|
||||
return mModelList;
|
||||
}
|
||||
|
||||
private void removeFromMainList(int index)
|
||||
{
|
||||
mModelList.remove(index);
|
||||
|
@ -31,6 +28,9 @@ class bookmarkModel
|
|||
mModelList.clear();
|
||||
}
|
||||
|
||||
|
||||
ArrayList<bookmarkRowModel> getList()
|
||||
{
|
||||
return mModelList;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,30 +1,58 @@
|
|||
package com.darkweb.genesissearchengine.appManager.bookmarkManager;
|
||||
|
||||
import android.widget.ImageView;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
public class bookmarkRowModel
|
||||
{
|
||||
/*Private Variables*/
|
||||
|
||||
private int mId;
|
||||
private String mHeader;
|
||||
private String mDescription;
|
||||
private int m_id;
|
||||
private String m_header;
|
||||
private String m_description;
|
||||
private Date m_date;
|
||||
private ImageView m_logo;
|
||||
|
||||
/*Initializations*/
|
||||
|
||||
public bookmarkRowModel(String mHeader, String mDescription, int mId) {
|
||||
this.mId = mId;
|
||||
this.mHeader = mHeader;
|
||||
this.mDescription = mDescription;
|
||||
public bookmarkRowModel(String p_header, String p_description,int p_id) {
|
||||
this.m_id = p_id;
|
||||
this.m_header = p_header;
|
||||
this.m_description = p_description;
|
||||
m_date = Calendar.getInstance().getTime();
|
||||
}
|
||||
|
||||
/*Variable Setters*/
|
||||
|
||||
public void setHeader(String p_header){
|
||||
this.m_header = p_header;
|
||||
}
|
||||
public void setURL(String p_url){
|
||||
this.m_description = p_url;
|
||||
}
|
||||
public void setLogo(ImageView p_logo){
|
||||
this.m_logo = p_logo;
|
||||
}
|
||||
public void setDate(Date p_date) {
|
||||
m_date = p_date;
|
||||
}
|
||||
|
||||
/*Variable Getters*/
|
||||
|
||||
String getmHeader() {
|
||||
return mHeader;
|
||||
public String getHeader() {
|
||||
return m_header;
|
||||
}
|
||||
String getmDescription() {
|
||||
return mDescription;
|
||||
public String getDescription() {
|
||||
return m_description;
|
||||
}
|
||||
public int getmId() {
|
||||
return mId;
|
||||
public int getID() {
|
||||
return m_id;
|
||||
}
|
||||
public ImageView getLogo() {
|
||||
return m_logo;
|
||||
}
|
||||
public Date getDate() {
|
||||
return m_date;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,20 +1,25 @@
|
|||
package com.darkweb.genesissearchengine.appManager.bookmarkManager;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import android.widget.PopupWindow;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.darkweb.genesissearchengine.appManager.historyManager.bookmarkEnums;
|
||||
import com.darkweb.genesissearchengine.constants.strings;
|
||||
import com.darkweb.genesissearchengine.helperManager.helperMethod;
|
||||
import com.example.myapplication.R;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
class bookmarkViewController
|
||||
|
@ -22,20 +27,26 @@ class bookmarkViewController
|
|||
/*Private Variables*/
|
||||
private AppCompatActivity mContext;
|
||||
|
||||
private ImageView mEmptyListNotifier;
|
||||
private EditText mSearchBar;
|
||||
private RecyclerView mListView;
|
||||
private ImageView mEmptyListNotification;
|
||||
private EditText mSearchInput;
|
||||
private RecyclerView mRecycleView;
|
||||
private Button mClearButton;
|
||||
private ImageButton mMenuButton;
|
||||
private ImageButton mSearchButton;
|
||||
|
||||
private PopupWindow mPopupWindow = null;
|
||||
|
||||
/*Initializations*/
|
||||
|
||||
bookmarkViewController(ImageView mEmptyListNotifier, EditText mSearchBar, RecyclerView mListView, Button mClearButton,AppCompatActivity mContext)
|
||||
bookmarkViewController(ImageView pEmptyListNotification, EditText pSearchInput, RecyclerView pRecycleView, Button pClearButton,AppCompatActivity pContext,ImageButton pMenuButton,ImageButton pSearchButton)
|
||||
{
|
||||
this.mContext = mContext;
|
||||
this.mEmptyListNotifier = mEmptyListNotifier;
|
||||
this.mSearchBar = mSearchBar;
|
||||
this.mListView = mListView;
|
||||
this.mClearButton = mClearButton;
|
||||
this.mEmptyListNotification = pEmptyListNotification;
|
||||
this.mSearchInput = pSearchInput;
|
||||
this.mRecycleView = pRecycleView;
|
||||
this.mClearButton = pClearButton;
|
||||
this.mContext = pContext;
|
||||
this.mMenuButton = pMenuButton;
|
||||
this.mSearchButton = pSearchButton;
|
||||
|
||||
initPostUI();
|
||||
}
|
||||
|
@ -55,24 +66,142 @@ class bookmarkViewController
|
|||
}
|
||||
}
|
||||
|
||||
void updateIfListEmpty(int size,int duration){
|
||||
if(size>0){
|
||||
mEmptyListNotifier.animate().setDuration(duration).alpha(0f);
|
||||
mClearButton.animate().setDuration(duration).alpha(1f);
|
||||
private void updateIfListEmpty(int pSize,int pDuration){
|
||||
if(pSize>0){
|
||||
mClearButton.setTextColor(mContext.getApplication().getResources().getColor(R.color.blue));
|
||||
mEmptyListNotification.animate().setDuration(pDuration).alpha(0f);
|
||||
mClearButton.setText(strings.BOOKMARK_CLEAR_BOOKMARK);
|
||||
mClearButton.setClickable(true);
|
||||
}
|
||||
else {
|
||||
mClearButton.setTextColor(mContext.getApplication().getResources().getColor(R.color.holo_dark_gray_alpha));
|
||||
mEmptyListNotification.animate().setDuration(pDuration).alpha(1f);
|
||||
|
||||
mClearButton.animate().setDuration(pDuration).alpha(0.4f);
|
||||
mSearchButton.animate().setDuration(pDuration).alpha(0f);
|
||||
mMenuButton.animate().setDuration(pDuration).alpha(0f);
|
||||
|
||||
mClearButton.setEnabled(false);
|
||||
mClearButton.setClickable(false);
|
||||
mSearchButton.setClickable(false);
|
||||
mMenuButton.setClickable(false);
|
||||
|
||||
mClearButton.setText(strings.BOOKMARK_NO_BOOKMARK_FOUND);
|
||||
mClearButton.setClickable(false);
|
||||
}
|
||||
}
|
||||
|
||||
void removeFromList(int index)
|
||||
{
|
||||
Objects.requireNonNull(mListView.getAdapter()).notifyItemRemoved(index);
|
||||
mListView.getAdapter().notifyItemRangeChanged(index, mListView.getAdapter().getItemCount());
|
||||
private void onCloseMenu(){
|
||||
if(mPopupWindow !=null && mPopupWindow.isShowing()){
|
||||
mPopupWindow.dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
void clearList(){
|
||||
Objects.requireNonNull(mListView.getAdapter()).notifyDataSetChanged();
|
||||
updateIfListEmpty(mListView.getAdapter().getItemCount(),300);
|
||||
mSearchBar.clearFocus();
|
||||
mSearchBar.setText(strings.EMPTY_STR);
|
||||
private void onSelectionMenu(boolean pStatus){
|
||||
if(!pStatus){
|
||||
mClearButton.setClickable(false);
|
||||
mClearButton.animate().cancel();
|
||||
mClearButton.setTextColor(mContext.getApplication().getResources().getColor(R.color.holo_dark_gray_alpha));
|
||||
mClearButton.animate().setDuration(150).alpha(0.4f);
|
||||
mMenuButton.setVisibility(View.VISIBLE);
|
||||
mSearchButton.setVisibility(View.GONE);
|
||||
if (mSearchInput.getVisibility() == View.VISIBLE){
|
||||
onHideSearch();
|
||||
}
|
||||
}else {
|
||||
if (mSearchInput.getVisibility() != View.VISIBLE) {
|
||||
mClearButton.setClickable(true);
|
||||
mClearButton.setTextColor(mContext.getApplication().getResources().getColor(R.color.blue));
|
||||
mClearButton.animate().cancel();
|
||||
mClearButton.animate().setDuration(150).alpha(1);
|
||||
}
|
||||
mMenuButton.setVisibility(View.GONE);
|
||||
mSearchButton.setVisibility(View.VISIBLE);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void updateList(){
|
||||
int index = Objects.requireNonNull(mRecycleView.getAdapter()).getItemCount()-1;
|
||||
mRecycleView.getAdapter().notifyDataSetChanged();
|
||||
}
|
||||
|
||||
private void removeFromList(int pIndex)
|
||||
{
|
||||
Objects.requireNonNull(mRecycleView.getAdapter()).notifyItemRemoved(pIndex);
|
||||
mRecycleView.getAdapter().notifyItemRangeChanged(pIndex, mRecycleView.getAdapter().getItemCount());
|
||||
}
|
||||
|
||||
private void clearList(){
|
||||
Objects.requireNonNull(mRecycleView.getAdapter()).notifyDataSetChanged();
|
||||
updateIfListEmpty(mRecycleView.getAdapter().getItemCount(),300);
|
||||
mSearchInput.clearFocus();
|
||||
mSearchInput.setText(strings.GENERIC_EMPTY_STR);
|
||||
}
|
||||
|
||||
private boolean onHideSearch() {
|
||||
if(mSearchInput.getVisibility() == View.VISIBLE){
|
||||
mSearchInput.animate().cancel();
|
||||
mSearchInput.animate().alpha(0).setDuration(150).withEndAction(() -> {
|
||||
mSearchInput.getText().clear();
|
||||
mSearchInput.setVisibility(View.GONE);
|
||||
mSearchInput.setText(strings.GENERIC_EMPTY_STR);
|
||||
});
|
||||
mSearchInput.setText(strings.GENERIC_EMPTY_STR);
|
||||
mSearchInput.setClickable(false);
|
||||
mClearButton.setClickable(true);
|
||||
mClearButton.setTextColor(mContext.getApplication().getResources().getColor(R.color.blue));
|
||||
mClearButton.animate().cancel();
|
||||
mClearButton.animate().setDuration(150).alpha(1f);
|
||||
return false;
|
||||
}else {
|
||||
mSearchInput.animate().cancel();
|
||||
mSearchInput.setAlpha(0f);
|
||||
mSearchInput.animate().setDuration(150).alpha(1);
|
||||
mSearchInput.setVisibility(View.VISIBLE);
|
||||
mSearchInput.setClickable(true);
|
||||
mClearButton.setClickable(false);
|
||||
mSearchInput.requestFocus();
|
||||
mClearButton.setTextColor(mContext.getApplication().getResources().getColor(R.color.holo_dark_gray_alpha));
|
||||
mClearButton.animate().cancel();
|
||||
mClearButton.animate().setDuration(150).alpha(0.4f);
|
||||
InputMethodManager imm = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,0);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private void onLongPressMenu(View pView) {
|
||||
mPopupWindow = helperMethod.onCreateMenu(pView, R.layout.recyclerview__menu);
|
||||
}
|
||||
|
||||
public Object onTrigger(bookmarkEnums.eBookmarkViewCommands pCommands, List<Object> pData){
|
||||
if(pCommands == bookmarkEnums.eBookmarkViewCommands.M_UPDATE_LIST_IF_EMPTY){
|
||||
updateIfListEmpty((int)pData.get(0), (int)pData.get(1));
|
||||
}
|
||||
else if(pCommands == bookmarkEnums.eBookmarkViewCommands.M_UPDATE_LIST){
|
||||
updateList();
|
||||
}
|
||||
else if(pCommands == bookmarkEnums.eBookmarkViewCommands.M_REMOVE_FROM_LIST){
|
||||
removeFromList((int)pData.get(0));
|
||||
}
|
||||
else if(pCommands == bookmarkEnums.eBookmarkViewCommands.M_CLEAR_LIST){
|
||||
clearList();
|
||||
}
|
||||
else if(pCommands == bookmarkEnums.eBookmarkViewCommands.M_VERTIFY_SELECTION_MENU){
|
||||
onSelectionMenu((boolean)pData.get(0));
|
||||
}
|
||||
else if(pCommands == bookmarkEnums.eBookmarkViewCommands.M_HIDE_SEARCH){
|
||||
return onHideSearch();
|
||||
}
|
||||
else if(pCommands == bookmarkEnums.eBookmarkViewCommands.M_CLOSE_MENU){
|
||||
onCloseMenu();
|
||||
}
|
||||
else if(pCommands == bookmarkEnums.eBookmarkViewCommands.M_LONG_PRESS_MENU){
|
||||
onLongPressMenu((View) pData.get(0));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -27,13 +27,14 @@ public class bridgeController extends AppCompatActivity {
|
|||
|
||||
/*Private Variables*/
|
||||
|
||||
private bridgeViewController m_bridge_view_controller;
|
||||
private RadioButton m_bridge_obfs;
|
||||
private RadioButton m_bridge_china;
|
||||
private RadioButton m_bridge_custom;
|
||||
private EditText m_custom_port;
|
||||
private Button m_bridge_button;
|
||||
private ImageView m_custom_bridge_blocker;
|
||||
private bridgeViewController mBridgeViewController;
|
||||
private RadioButton mBridgeObfs;
|
||||
private RadioButton mBridgeChina;
|
||||
private RadioButton mBridgeCustom;
|
||||
private EditText mCustomPort;
|
||||
private Button mBridgeButton;
|
||||
private ImageView mCustomBridgeBlocker;
|
||||
|
||||
/*Initializations*/
|
||||
|
||||
@Override
|
||||
|
@ -49,25 +50,25 @@ public class bridgeController extends AppCompatActivity {
|
|||
|
||||
public void initializeAppModel()
|
||||
{
|
||||
m_bridge_view_controller = new bridgeViewController();
|
||||
mBridgeViewController = new bridgeViewController();
|
||||
}
|
||||
|
||||
public void initializeConnections()
|
||||
{
|
||||
m_bridge_obfs = findViewById(R.id.p_bridge_obfs);
|
||||
m_bridge_china = findViewById(R.id.p_bridge_china);
|
||||
m_custom_port = findViewById(R.id.p_port_1);
|
||||
m_bridge_button = findViewById(R.id.p_bridge_button);
|
||||
m_bridge_custom = findViewById(R.id.p_custom_bridge);
|
||||
m_custom_bridge_blocker = findViewById(R.id.p_custom_bridge_blocker);
|
||||
mBridgeObfs = findViewById(R.id.pBridgeObfs);
|
||||
mBridgeChina = findViewById(R.id.pBridgeChina);
|
||||
mCustomPort = findViewById(R.id.pCustomPort);
|
||||
mBridgeButton = findViewById(R.id.pBridgeButton);
|
||||
mBridgeCustom = findViewById(R.id.pBridgeCustom);
|
||||
mCustomBridgeBlocker = findViewById(R.id.pCustomBridgeBlocker);
|
||||
|
||||
m_bridge_view_controller.initialization(m_custom_port, m_bridge_button,this, m_bridge_obfs, m_bridge_china, m_bridge_custom, m_custom_bridge_blocker);
|
||||
m_bridge_view_controller.onTrigger(bridgeEnums.eBridgeViewCommands.M_INIT_VIEWS, Arrays.asList(status.sCustomBridge,0));
|
||||
mBridgeViewController.initialization(mCustomPort, mBridgeButton,this, mBridgeObfs, mBridgeChina, mBridgeCustom, mCustomBridgeBlocker);
|
||||
mBridgeViewController.onTrigger(bridgeEnums.eBridgeViewCommands.S_INIT_VIEWS, Arrays.asList(status.sBridgeCustomBridge,0));
|
||||
}
|
||||
|
||||
private void initializeLocalEventHandlers()
|
||||
{
|
||||
m_custom_port.addTextChangedListener(new TextWatcher() {
|
||||
mCustomPort.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2)
|
||||
{
|
||||
|
@ -80,7 +81,7 @@ public class bridgeController extends AppCompatActivity {
|
|||
|
||||
@Override
|
||||
public void afterTextChanged(Editable editable) {
|
||||
status.sCustomBridge= m_custom_port.getText().toString();
|
||||
status.sBridgeCustomBridge = mCustomPort.getText().toString();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -90,9 +91,9 @@ public class bridgeController extends AppCompatActivity {
|
|||
{
|
||||
super.onPause();
|
||||
if(dataController.getInstance()!=null){
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.CUSTOM_BRIDGE_1,status.sCustomBridge));
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.GATEWAY_AUTO,status.sGatewayAuto));
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.GATEWAY_MANUAL,status.sGatewayManual));
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_BRIDGE_1,status.sBridgeCustomBridge));
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_GATEWAY_AUTO,status.sBridgeGatewayAuto));
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_GATEWAY_MANUAL,status.sBridgeGatewayManual));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -115,23 +116,23 @@ public class bridgeController extends AppCompatActivity {
|
|||
/*Helper Method*/
|
||||
|
||||
public void requestBridges(View view){
|
||||
pluginController.getInstance().MessageManagerHandler(this, Collections.singletonList(constants.BACKEND_GOOGLE_URL), enums.etype.on_bridge_mail);
|
||||
pluginController.getInstance().MessageManagerHandler(this, Collections.singletonList(constants.CONST_BACKEND_GOOGLE_URL), enums.etype.on_bridge_mail);
|
||||
}
|
||||
|
||||
public void onCustomChecked(View view){
|
||||
status.sCustomBridge = strings.CUSTOM_BRIDGE_CUSTOM;
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.CUSTOM_BRIDGE_1,status.sCustomBridge));
|
||||
m_bridge_view_controller.onTrigger(bridgeEnums.eBridgeViewCommands.M_INIT_VIEWS, Arrays.asList(status.sCustomBridge,250));
|
||||
status.sBridgeCustomBridge = strings.BRIDGE_CUSTOM_BRIDGE_CUSTOM;
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_BRIDGE_1,status.sBridgeCustomBridge));
|
||||
mBridgeViewController.onTrigger(bridgeEnums.eBridgeViewCommands.S_INIT_VIEWS, Arrays.asList(status.sBridgeCustomBridge,250));
|
||||
|
||||
}
|
||||
public void onMeekChecked(View view){
|
||||
status.sCustomBridge = strings.CUSTOM_BRIDGE_OBFS4;
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.CUSTOM_BRIDGE_1,status.sCustomBridge));
|
||||
m_bridge_view_controller.onTrigger(bridgeEnums.eBridgeViewCommands.M_INIT_VIEWS, Arrays.asList(status.sCustomBridge,250));
|
||||
status.sBridgeCustomBridge = strings.BRIDGE_CUSTOM_BRIDGE_OBFS4;
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_BRIDGE_1,status.sBridgeCustomBridge));
|
||||
mBridgeViewController.onTrigger(bridgeEnums.eBridgeViewCommands.S_INIT_VIEWS, Arrays.asList(status.sBridgeCustomBridge,250));
|
||||
}
|
||||
public void onObfsChecked(View view){
|
||||
status.sCustomBridge = strings.CUSTOM_BRIDGE_MEEK;
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.CUSTOM_BRIDGE_1,status.sCustomBridge));
|
||||
m_bridge_view_controller.onTrigger(bridgeEnums.eBridgeViewCommands.M_INIT_VIEWS, Arrays.asList(status.sCustomBridge,250));
|
||||
status.sBridgeCustomBridge = strings.BRIDGE_CUSTOM_BRIDGE_MEEK;
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_BRIDGE_1,status.sBridgeCustomBridge));
|
||||
mBridgeViewController.onTrigger(bridgeEnums.eBridgeViewCommands.S_INIT_VIEWS, Arrays.asList(status.sBridgeCustomBridge,250));
|
||||
}
|
||||
}
|
|
@ -4,6 +4,6 @@ public class bridgeEnums
|
|||
{
|
||||
/*Settings Manager*/
|
||||
public enum eBridgeViewCommands {
|
||||
M_INIT_VIEWS
|
||||
S_INIT_VIEWS
|
||||
}
|
||||
}
|
|
@ -24,40 +24,40 @@ import java.util.List;
|
|||
class bridgeViewController
|
||||
{
|
||||
/*Private Variables*/
|
||||
private RadioButton m_bridge_obfs;
|
||||
private RadioButton m_bridge_china;
|
||||
private RadioButton m_bridge_custom;
|
||||
private Button m_bridge_button;
|
||||
private EditText m_custom_port;
|
||||
private ImageView m_custom_bridge_blocker;
|
||||
private RadioButton mBridgeObfs;
|
||||
private RadioButton mBridgeChina;
|
||||
private RadioButton mBridgeCustom;
|
||||
private Button mBridgeButton;
|
||||
private EditText mCustomPort;
|
||||
private ImageView mCustomBridgeBlocker;
|
||||
|
||||
/*ViewControllers*/
|
||||
private AppCompatActivity m_context;
|
||||
private AppCompatActivity mContext;
|
||||
|
||||
/*Initializations*/
|
||||
void initialization(EditText p_custom_port, Button p_bridge_button, AppCompatActivity p_context,RadioButton p_bridge_obfs,RadioButton p_bridge_china,RadioButton p_bridge_custom, ImageView p_custom_bridge_blocker){
|
||||
this.m_context = p_context;
|
||||
this.m_bridge_obfs = p_bridge_obfs;
|
||||
this.m_bridge_china = p_bridge_china;
|
||||
this.m_bridge_custom = p_bridge_custom;
|
||||
this.m_bridge_button = p_bridge_button;
|
||||
this.m_custom_port = p_custom_port;
|
||||
this.m_custom_bridge_blocker = p_custom_bridge_blocker;
|
||||
void initialization(EditText pCustomPort, Button pBridgeButton, AppCompatActivity pContext,RadioButton pBridgeObfs,RadioButton pBridgeChina,RadioButton pBridgeCustom, ImageView pCustomBridgeBlocker){
|
||||
this.mContext = pContext;
|
||||
this.mBridgeObfs = pBridgeObfs;
|
||||
this.mBridgeChina = pBridgeChina;
|
||||
this.mBridgeCustom = pBridgeCustom;
|
||||
this.mBridgeButton = pBridgeButton;
|
||||
this.mCustomPort = pCustomPort;
|
||||
this.mCustomBridgeBlocker = pCustomBridgeBlocker;
|
||||
|
||||
initPostUI();
|
||||
}
|
||||
|
||||
private void initPostUI(){
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
Window window = m_context.getWindow();
|
||||
Window window = mContext.getWindow();
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
||||
|
||||
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
|
||||
window.setStatusBarColor(m_context.getResources().getColor(R.color.blue_dark));
|
||||
window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark));
|
||||
}
|
||||
else {
|
||||
m_context.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);// set status text dark
|
||||
m_context.getWindow().setStatusBarColor(ContextCompat.getColor(m_context, R.color.white));
|
||||
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);// set status text dark
|
||||
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.white));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -70,56 +70,56 @@ class bridgeViewController
|
|||
}
|
||||
|
||||
private void resetRadioButtons(int p_duration){
|
||||
animateColor(m_bridge_obfs, m_bridge_obfs.getCurrentTextColor(), m_context.getResources().getColor(R.color.float_white), "textColor", p_duration);
|
||||
animateColor(m_bridge_custom, m_bridge_custom.getCurrentTextColor(), m_context.getResources().getColor(R.color.float_white), "textColor", p_duration);
|
||||
animateColor(m_bridge_china, m_bridge_china.getCurrentTextColor(), m_context.getResources().getColor(R.color.float_white), "textColor", p_duration);
|
||||
animateColor(mBridgeObfs, mBridgeObfs.getCurrentTextColor(), mContext.getResources().getColor(R.color.float_white), "textColor", p_duration);
|
||||
animateColor(mBridgeCustom, mBridgeCustom.getCurrentTextColor(), mContext.getResources().getColor(R.color.float_white), "textColor", p_duration);
|
||||
animateColor(mBridgeChina, mBridgeChina.getCurrentTextColor(), mContext.getResources().getColor(R.color.float_white), "textColor", p_duration);
|
||||
|
||||
m_bridge_obfs.setHighlightColor(m_context.getResources().getColor(R.color.float_white));
|
||||
m_bridge_custom.setHighlightColor(m_context.getResources().getColor(R.color.float_white));
|
||||
m_bridge_china.setHighlightColor(m_context.getResources().getColor(R.color.float_white));
|
||||
mBridgeObfs.setHighlightColor(mContext.getResources().getColor(R.color.float_white));
|
||||
mBridgeCustom.setHighlightColor(mContext.getResources().getColor(R.color.float_white));
|
||||
mBridgeChina.setHighlightColor(mContext.getResources().getColor(R.color.float_white));
|
||||
|
||||
m_bridge_obfs.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(m_context, R.color.float_white)));
|
||||
m_bridge_custom.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(m_context, R.color.float_white)));
|
||||
m_bridge_china.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(m_context, R.color.float_white)));
|
||||
mBridgeObfs.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.float_white)));
|
||||
mBridgeCustom.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.float_white)));
|
||||
mBridgeChina.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.float_white)));
|
||||
|
||||
helperMethod.hideKeyboard(m_context);
|
||||
m_custom_port.clearFocus();
|
||||
m_custom_port.animate().setDuration(p_duration).alpha(0.2f);
|
||||
m_bridge_button.animate().setDuration(p_duration).alpha(0.2f);
|
||||
m_custom_bridge_blocker.setVisibility(View.VISIBLE);
|
||||
helperMethod.hideKeyboard(mContext);
|
||||
mCustomPort.clearFocus();
|
||||
mCustomPort.animate().setDuration(p_duration).alpha(0.2f);
|
||||
mBridgeButton.animate().setDuration(p_duration).alpha(0.2f);
|
||||
mCustomBridgeBlocker.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
private void initViews(String p_bridge, int p_duration){
|
||||
resetRadioButtons(p_duration);
|
||||
switch (p_bridge) {
|
||||
case strings.CUSTOM_BRIDGE_OBFS4:
|
||||
case strings.BRIDGE_CUSTOM_BRIDGE_OBFS4:
|
||||
|
||||
animateColor(m_bridge_china, m_bridge_china.getCurrentTextColor(), m_context.getResources().getColor(R.color.black), "textColor", p_duration);
|
||||
m_bridge_china.setHighlightColor(Color.BLACK);
|
||||
m_bridge_china.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(m_context, R.color.cursor_blue)));
|
||||
m_bridge_china.setChecked(true);
|
||||
animateColor(mBridgeChina, mBridgeChina.getCurrentTextColor(), mContext.getResources().getColor(R.color.black), "textColor", p_duration);
|
||||
mBridgeChina.setHighlightColor(Color.BLACK);
|
||||
mBridgeChina.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.cursor_blue)));
|
||||
mBridgeChina.setChecked(true);
|
||||
break;
|
||||
case strings.CUSTOM_BRIDGE_MEEK:
|
||||
animateColor(m_bridge_obfs, m_bridge_obfs.getCurrentTextColor(), m_context.getResources().getColor(R.color.black), "textColor", p_duration);
|
||||
m_bridge_obfs.setHighlightColor(Color.BLACK);
|
||||
m_bridge_obfs.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(m_context, R.color.cursor_blue)));
|
||||
m_bridge_obfs.setChecked(true);
|
||||
case strings.BRIDGE_CUSTOM_BRIDGE_MEEK:
|
||||
animateColor(mBridgeObfs, mBridgeObfs.getCurrentTextColor(), mContext.getResources().getColor(R.color.black), "textColor", p_duration);
|
||||
mBridgeObfs.setHighlightColor(Color.BLACK);
|
||||
mBridgeObfs.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.cursor_blue)));
|
||||
mBridgeObfs.setChecked(true);
|
||||
break;
|
||||
case strings.CUSTOM_BRIDGE_CUSTOM:
|
||||
animateColor(m_bridge_custom, m_bridge_custom.getCurrentTextColor(), m_context.getResources().getColor(R.color.black), "textColor", p_duration);
|
||||
m_bridge_custom.setHighlightColor(Color.BLACK);
|
||||
m_bridge_custom.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(m_context, R.color.cursor_blue)));
|
||||
m_bridge_custom.setChecked(true);
|
||||
case strings.BRIDGE_CUSTOM_BRIDGE_CUSTOM:
|
||||
animateColor(mBridgeCustom, mBridgeCustom.getCurrentTextColor(), mContext.getResources().getColor(R.color.black), "textColor", p_duration);
|
||||
mBridgeCustom.setHighlightColor(Color.BLACK);
|
||||
mBridgeCustom.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.cursor_blue)));
|
||||
mBridgeCustom.setChecked(true);
|
||||
|
||||
m_custom_port.animate().setDuration(p_duration).alpha(1f);
|
||||
m_bridge_button.animate().setDuration(p_duration).alpha(1f);
|
||||
m_custom_bridge_blocker.setVisibility(View.GONE);
|
||||
mCustomPort.animate().setDuration(p_duration).alpha(1f);
|
||||
mBridgeButton.animate().setDuration(p_duration).alpha(1f);
|
||||
mCustomBridgeBlocker.setVisibility(View.GONE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void onTrigger(bridgeEnums.eBridgeViewCommands p_commands, List<Object> p_data){
|
||||
if(p_commands == bridgeEnums.eBridgeViewCommands.M_INIT_VIEWS){
|
||||
if(p_commands == bridgeEnums.eBridgeViewCommands.S_INIT_VIEWS){
|
||||
initViews((String) p_data.get(0), (int)p_data.get(1));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import android.database.Cursor;
|
|||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteException;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkRowModel;
|
||||
import com.darkweb.genesissearchengine.appManager.historyManager.historyRowModel;
|
||||
import com.darkweb.genesissearchengine.constants.constants;
|
||||
|
@ -38,7 +39,7 @@ public class databaseController
|
|||
{
|
||||
try
|
||||
{
|
||||
mDatabaseInstance = app_context.openOrCreateDatabase(constants.DATABASE_NAME, MODE_PRIVATE, null);
|
||||
mDatabaseInstance = app_context.openOrCreateDatabase(constants.CONST_DATABASE_NAME, MODE_PRIVATE, null);
|
||||
|
||||
mDatabaseInstance.execSQL("CREATE TABLE IF NOT EXISTS " + "history" + " (id INT(4) PRIMARY KEY,date DATETIME,url VARCHAR,title VARCHAR);");
|
||||
try {
|
||||
|
@ -118,7 +119,7 @@ public class databaseController
|
|||
|
||||
if (c.moveToFirst()){
|
||||
do {
|
||||
tempmodel.add(new bookmarkRowModel(c.getString(2), c.getString(1),Integer.parseInt(c.getString(0))));
|
||||
tempmodel.add(new bookmarkRowModel(c.getString(1), c.getString(2),Integer.parseInt(c.getString(0))));
|
||||
} while(c.moveToNext());
|
||||
}
|
||||
c.close();
|
||||
|
|
|
@ -2,9 +2,8 @@ package com.darkweb.genesissearchengine.appManager.historyManager;
|
|||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Handler;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
|
@ -14,14 +13,19 @@ import android.widget.*;
|
|||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.darkweb.genesissearchengine.constants.enums;
|
||||
import com.darkweb.genesissearchengine.constants.strings;
|
||||
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
||||
import com.darkweb.genesissearchengine.helperManager.helperMethod;
|
||||
import com.example.myapplication.R;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import static android.content.Context.LAYOUT_INFLATER_SERVICE;
|
||||
|
||||
public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listViewHolder>
|
||||
|
@ -29,49 +33,55 @@ public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listView
|
|||
/*Private Variables*/
|
||||
|
||||
private ArrayList<historyRowModel> mModelList = new ArrayList<>();
|
||||
private ArrayList<historyRowModel> tempModelList;
|
||||
private ArrayList<historyRowModel> passedModelList;
|
||||
private ArrayList<Integer> m_real_id = new ArrayList<>();
|
||||
private ArrayList<Integer> m_real_index = new ArrayList<>();
|
||||
private ArrayList<String> m_long_selected = new ArrayList<>();
|
||||
private ArrayList<Integer> m_long_selected_id = new ArrayList<>();
|
||||
private PopupWindow popupWindow = null;
|
||||
private ArrayList<historyRowModel> mCurrentList;
|
||||
private ArrayList<historyRowModel> mPassedList;
|
||||
private ArrayList<Integer> mRealID = new ArrayList<>();
|
||||
private ArrayList<Integer> mRealIndex = new ArrayList<>();
|
||||
private ArrayList<Date> mLongSelectedDate = new ArrayList<>();
|
||||
private ArrayList<String> mLongSelectedIndex = new ArrayList<>();
|
||||
private ArrayList<Integer> mLongSelectedID = new ArrayList<>();
|
||||
private ArrayList<View> mLongPressedViewHolders = new ArrayList<>();
|
||||
|
||||
private AppCompatActivity mContext;
|
||||
private historyAdapterView mHistroyAdapterView;
|
||||
private Context mListHolderContext;
|
||||
private PopupWindow mPopupWindow = null;
|
||||
private eventObserver.eventListener mEvent;
|
||||
private AppCompatActivity m_main_context;
|
||||
private ArrayList<View> m_long_pressed_list_view_holder = new ArrayList<>();
|
||||
boolean mLongPressedMenuActive = false;
|
||||
private String mFilter = strings.GENERIC_EMPTY_STR;
|
||||
|
||||
/*Local Variables*/
|
||||
|
||||
private float x1,x2;
|
||||
private String filter = strings.EMPTY_STR;
|
||||
static final int MIN_DISTANCE = 150;
|
||||
private boolean isClosing = false;
|
||||
boolean m_was_long_pressed = false;
|
||||
private float mRecyclerPositionX1, mRecyclerPositionX2;
|
||||
private boolean mDisableCallable = false;
|
||||
private boolean mSearchEnabled = false;
|
||||
|
||||
historyAdapter(ArrayList<historyRowModel> p_model_list, eventObserver.eventListener mEvent, AppCompatActivity p_main_context) {
|
||||
historyAdapter(ArrayList<historyRowModel> pModelList, eventObserver.eventListener mEvent, AppCompatActivity pMainContext) {
|
||||
this.mEvent = mEvent;
|
||||
tempModelList = new ArrayList<>();
|
||||
passedModelList = p_model_list;
|
||||
m_main_context = p_main_context;
|
||||
this.mCurrentList = new ArrayList<>();
|
||||
this.mPassedList = pModelList;
|
||||
this.mContext = pMainContext;
|
||||
this.mHistroyAdapterView = new historyAdapterView(mContext);
|
||||
|
||||
initializeModelWithDate(false);
|
||||
}
|
||||
|
||||
|
||||
public void onLoading(){
|
||||
m_main_context.runOnUiThread(() -> {
|
||||
tempModelList.add(new historyRowModel("loading",null,-2));
|
||||
notifyItemInserted(tempModelList.size());
|
||||
private void onLoading(){
|
||||
mContext.runOnUiThread(() -> {
|
||||
mCurrentList.add(new historyRowModel("loading",null,-2));
|
||||
notifyItemInserted(mCurrentList.size());
|
||||
});
|
||||
}
|
||||
|
||||
public void onLoadingClear(){
|
||||
private void onLoadingClear(){
|
||||
|
||||
for(int m_counter=0;m_counter<tempModelList.size();m_counter++){
|
||||
if(tempModelList.get(m_counter).getHeader().equals("loading")){
|
||||
int finalM_counter = m_counter;
|
||||
m_main_context.runOnUiThread(() -> {
|
||||
tempModelList.remove(finalM_counter);
|
||||
notifyItemRemoved(finalM_counter +1);
|
||||
for(int mCounter = 0; mCounter< mCurrentList.size(); mCounter++){
|
||||
if(mCurrentList.get(mCounter).getHeader().equals("loading")){
|
||||
int finalM_counter = mCounter;
|
||||
mContext.runOnUiThread(() -> {
|
||||
mCurrentList.remove(finalM_counter);
|
||||
notifyItemRemoved(finalM_counter);
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
@ -79,22 +89,22 @@ public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listView
|
|||
}
|
||||
|
||||
|
||||
public void initializeModelWithDate(boolean p_filter_enabled){
|
||||
private void initializeModelWithDate(boolean pFilterEnabled){
|
||||
int m_real_counter=0;
|
||||
|
||||
m_real_id.clear();
|
||||
m_real_index.clear();
|
||||
tempModelList.clear();
|
||||
mRealID.clear();
|
||||
mRealIndex.clear();
|
||||
mCurrentList.clear();
|
||||
this.mModelList.clear();
|
||||
onVerifyLongSelectedURL();
|
||||
|
||||
ArrayList<historyRowModel> p_model_list = passedModelList;
|
||||
ArrayList<historyRowModel> p_model_list = mPassedList;
|
||||
int m_date_state = -1;
|
||||
int m_last_day = -1;
|
||||
for(int counter = 0; counter< p_model_list.size(); counter++){
|
||||
|
||||
if(p_filter_enabled){
|
||||
if(!p_model_list.get(counter).getHeader().toLowerCase().contains(this.filter.toLowerCase()) && !p_model_list.get(counter).getDescription().toLowerCase().contains(this.filter)){
|
||||
if(pFilterEnabled){
|
||||
if(!p_model_list.get(counter).getHeader().toLowerCase().contains(this.mFilter.toLowerCase()) && !p_model_list.get(counter).getDescription().toLowerCase().contains(this.mFilter)){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -107,154 +117,149 @@ public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listView
|
|||
int m_date_2 = cal.get(Calendar.DAY_OF_YEAR);
|
||||
|
||||
float diff = m_date_2-m_date_1;
|
||||
float days = diff / (24 * 60 * 60 * 1000);
|
||||
|
||||
if(diff==0){
|
||||
if(m_date_state!=1){
|
||||
this.mModelList.add(new historyRowModel("Today ",null,-1));
|
||||
mRealID.add(m_real_counter);
|
||||
mRealIndex.add(m_real_counter);
|
||||
m_date_state = 1;
|
||||
}
|
||||
m_real_id.add(m_real_counter);
|
||||
m_real_index.add(m_real_counter);
|
||||
m_date_state = 1;
|
||||
}else if (diff>=1){
|
||||
|
||||
if(m_date_state!=2 || m_last_day!=(int)(Math.ceil(days/7)*7)){
|
||||
m_last_day = (int)(Math.ceil(days/7)*7);
|
||||
if(m_date_state!=2 || m_last_day!=(int)(Math.ceil(diff/7)*7)){
|
||||
m_last_day = (int)(Math.ceil(diff/7)*7);
|
||||
this.mModelList.add(new historyRowModel("Last " + m_last_day + " Days",null,-1));
|
||||
mRealID.add(m_real_counter);
|
||||
mRealIndex.add(m_real_counter);
|
||||
m_date_state = 2;
|
||||
}
|
||||
m_real_id.add(m_real_counter);
|
||||
m_real_index.add(m_real_counter);
|
||||
m_date_state = 2;
|
||||
}else {
|
||||
if(m_date_state!=3){
|
||||
this.mModelList.add(new historyRowModel("Older ",null,-1));
|
||||
mRealID.add(m_real_counter);
|
||||
mRealIndex.add(m_real_counter);
|
||||
m_date_state = 3;
|
||||
}
|
||||
m_real_id.add(m_real_counter);
|
||||
m_real_index.add(m_real_counter);
|
||||
m_date_state = 3;
|
||||
}
|
||||
|
||||
m_real_id.add(p_model_list.get(counter).getID());
|
||||
m_real_index.add(m_real_counter);
|
||||
mRealID.add(p_model_list.get(counter).getID());
|
||||
mRealIndex.add(m_real_counter);
|
||||
this.mModelList.add(p_model_list.get(counter));
|
||||
m_real_counter+=1;
|
||||
}
|
||||
tempModelList.addAll(this.mModelList);
|
||||
mCurrentList.addAll(this.mModelList);
|
||||
}
|
||||
|
||||
/*Initializations*/
|
||||
|
||||
public ArrayList<String> getLongSelectedleURL(){
|
||||
return m_long_selected;
|
||||
private ArrayList<String> getLongSelectedleURL(){
|
||||
return mLongSelectedIndex;
|
||||
}
|
||||
|
||||
public void onDeleteSelected(){
|
||||
for(int m_counter=0;m_counter<m_long_selected.size();m_counter++){
|
||||
for(int m_counter_inner=0;m_counter_inner<passedModelList.size();m_counter_inner++){
|
||||
if(m_long_selected.get(m_counter).equals("https://"+passedModelList.get(m_counter_inner).getDescription())){
|
||||
mEvent.invokeObserver(Collections.singletonList(m_counter_inner),enums.etype.url_clear);
|
||||
mEvent.invokeObserver(Collections.singletonList(m_counter_inner),enums.etype.url_clear_at);
|
||||
for(int m_counter = 0; m_counter< mLongSelectedIndex.size(); m_counter++){
|
||||
for(int m_counter_inner = 0; m_counter_inner< mCurrentList.size(); m_counter_inner++){
|
||||
if(mCurrentList.get(m_counter_inner).getDate() == mLongSelectedDate.get(m_counter) && mLongSelectedIndex.get(m_counter).equals("https://"+ mCurrentList.get(m_counter_inner).getDescription())){
|
||||
mEvent.invokeObserver(Collections.singletonList(mRealIndex.get(m_counter_inner)),enums.etype.url_clear);
|
||||
mEvent.invokeObserver(Collections.singletonList(mLongSelectedID.get(m_counter)),enums.etype.url_clear_at);
|
||||
invokeFilter(false);
|
||||
mEvent.invokeObserver(Collections.singletonList(m_counter_inner),enums.etype.is_empty);
|
||||
|
||||
initializeModelWithDate(false);
|
||||
boolean mDateVerify = false;
|
||||
if(mCurrentList.size()>0 && mCurrentList.get(m_counter_inner-1).getDescription()==null && (mCurrentList.size()>m_counter_inner+1 && mCurrentList.get(m_counter_inner+1).getDescription()==null || mCurrentList.size()==m_counter_inner+1)){
|
||||
mDateVerify = true;
|
||||
}
|
||||
|
||||
if(m_counter_inner==0){
|
||||
notifyDataSetChanged();
|
||||
}else {
|
||||
notifyItemRemoved(m_counter_inner+1);
|
||||
notifyItemRangeChanged(m_counter_inner+1, passedModelList.size());
|
||||
|
||||
if(mDateVerify){
|
||||
notifyItemRemoved(m_counter_inner-1);
|
||||
mCurrentList.remove(m_counter_inner-1);
|
||||
notifyItemRemoved(m_counter_inner-1);
|
||||
mCurrentList.remove(m_counter_inner-1);
|
||||
notifyItemRangeChanged(m_counter_inner-1, mCurrentList.size());
|
||||
}else {
|
||||
notifyItemRemoved(m_counter_inner);
|
||||
mCurrentList.remove(m_counter_inner);
|
||||
notifyItemRangeChanged(m_counter_inner, mCurrentList.size());
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
clearLongSelectedURL();
|
||||
}
|
||||
|
||||
public void clearLongSelectedURL(){
|
||||
private void clearLongSelectedURL(){
|
||||
|
||||
for(int m_counter=0;m_counter<m_long_selected.size();m_counter++){
|
||||
for(int m_counter = 0; m_counter< mLongSelectedIndex.size(); m_counter++){
|
||||
|
||||
View m_item_view = m_long_pressed_list_view_holder.get(m_counter);
|
||||
ImageButton m_popup_menu = m_item_view.findViewById(R.id.p_popup_menu);
|
||||
ImageView p_logo_image = m_item_view.findViewById(R.id.p_logo_image);
|
||||
|
||||
m_item_view.setPressed(false);
|
||||
m_popup_menu.setVisibility(View.VISIBLE);
|
||||
m_popup_menu.animate().setDuration(150).alpha(1);
|
||||
m_popup_menu.setClickable(true);
|
||||
p_logo_image.setAlpha(1f);
|
||||
p_logo_image.animate().cancel();
|
||||
p_logo_image.animate().setDuration(150).alpha(0).withEndAction(() -> p_logo_image.setVisibility(View.GONE));
|
||||
View m_item_view = mLongPressedViewHolders.get(m_counter);
|
||||
ImageButton m_popup_menu = m_item_view.findViewById(R.id.pRowMenu);
|
||||
ImageView p_logo_image = m_item_view.findViewById(R.id.pLogoImage);
|
||||
mPopupWindow = (PopupWindow) mHistroyAdapterView.onTrigger(historyEnums.eHistoryViewAdapterCommands.M_CLEAR_LONG_SELECTED_VIEW, Arrays.asList(m_popup_menu, p_logo_image, m_item_view));
|
||||
}
|
||||
m_long_selected.clear();
|
||||
m_long_selected_id.clear();
|
||||
m_long_pressed_list_view_holder.clear();
|
||||
mLongSelectedDate.clear();
|
||||
mLongSelectedIndex.clear();
|
||||
mLongSelectedID.clear();
|
||||
mLongPressedViewHolders.clear();
|
||||
}
|
||||
|
||||
public String getSelectedURL(){
|
||||
private String getSelectedURL(){
|
||||
String m_joined_url = "\n";
|
||||
for(int m_counter=0;m_counter<m_long_selected.size();m_counter++){
|
||||
m_joined_url = m_joined_url.concat("\n"+m_long_selected.get(m_counter));
|
||||
for(int m_counter = 0; m_counter< mLongSelectedIndex.size(); m_counter++){
|
||||
m_joined_url = m_joined_url.concat("\n"+ mLongSelectedIndex.get(m_counter));
|
||||
}
|
||||
return m_joined_url;
|
||||
}
|
||||
|
||||
Context m_context;
|
||||
@NonNull
|
||||
@Override
|
||||
public listViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
m_context = parent.getContext();
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_row_view, parent, false);
|
||||
mListHolderContext = parent.getContext();
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.recyclerview_row, parent, false);
|
||||
return new listViewHolder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull historyAdapter.listViewHolder holder, int position)
|
||||
{
|
||||
holder.bindListView(tempModelList.get(position), position);
|
||||
holder.bindListView(mCurrentList.get(position), position);
|
||||
}
|
||||
|
||||
public int getItem(){
|
||||
return tempModelList.size();
|
||||
return mCurrentList.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return tempModelList.size();
|
||||
return mCurrentList.size();
|
||||
}
|
||||
|
||||
/*Listeners*/
|
||||
boolean m_is_searched = false;
|
||||
public void onUpdateSearchStatus(boolean p_is_searched){
|
||||
m_is_searched = !p_is_searched;
|
||||
mSearchEnabled = p_is_searched;
|
||||
}
|
||||
|
||||
public void onSelectView(View p_item, View itemView, int p_poisition, String p_url, View p_menu_item, TextView p_logo_text, ImageView p_logo_image, boolean p_is_forced, int p_id){
|
||||
if(!m_is_searched){
|
||||
public void onSelectView(View pItem, View pItemView, String pUrl, View pMenuItem, ImageView pLogoImage, boolean pIsForced, int pId, Date pDate){
|
||||
if(!mSearchEnabled){
|
||||
try {
|
||||
itemView.setPressed(false);
|
||||
int speed = 150;
|
||||
if(p_is_forced){
|
||||
speed=0;
|
||||
}
|
||||
p_menu_item.animate().setDuration(speed).alpha(0).withEndAction(() -> {
|
||||
p_menu_item.setVisibility(View.INVISIBLE);
|
||||
p_menu_item.setClickable(false);
|
||||
});
|
||||
|
||||
p_logo_image.setAlpha(0.5f);
|
||||
p_logo_image.setVisibility(View.VISIBLE);
|
||||
p_logo_image.animate().cancel();
|
||||
p_logo_image.animate().setDuration(speed).alpha(1);
|
||||
mPopupWindow = (PopupWindow) mHistroyAdapterView.onTrigger(historyEnums.eHistoryViewAdapterCommands.M_SELECT_VIEW, Arrays.asList(pItemView, pMenuItem, pLogoImage, pIsForced, true));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if(!p_is_forced){
|
||||
m_long_selected.add(p_url);
|
||||
m_long_selected_id.add(p_id);
|
||||
m_long_pressed_list_view_holder.add(p_item);
|
||||
if(!pIsForced){
|
||||
if(mLongSelectedID.size()==0){
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
mLongSelectedDate.add(pDate);
|
||||
mLongSelectedIndex.add(pUrl);
|
||||
mLongSelectedID.add(pId);
|
||||
mLongPressedViewHolders.add(pItem);
|
||||
|
||||
}
|
||||
onVerifyLongSelectedURL();
|
||||
|
@ -262,217 +267,205 @@ public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listView
|
|||
}
|
||||
|
||||
public void onVerifyLongSelectedURL(){
|
||||
if(m_long_selected.size()>0){
|
||||
if(mLongSelectedIndex.size()>0){
|
||||
mEvent.invokeObserver(Collections.singletonList(false),enums.etype.on_verify_selected_url_menu);
|
||||
}else {
|
||||
mEvent.invokeObserver(Collections.singletonList(true),enums.etype.on_verify_selected_url_menu);
|
||||
}
|
||||
}
|
||||
|
||||
public void onClearHighlight(View p_item, View itemView, int p_poisition, String p_url, View p_menu_item,TextView p_logo_text,ImageView p_logo_image,boolean p_is_forced, int p_id)
|
||||
public void onClearHighlight(View pItem, View pItemView, String pUrl, View pMenuItem, ImageView pLogoImage, boolean pIsForced, int pId, Date pDate)
|
||||
{
|
||||
try {
|
||||
itemView.setPressed(false);
|
||||
p_menu_item.setVisibility(View.VISIBLE);
|
||||
int speed = 150;
|
||||
if(p_is_forced){
|
||||
speed = 0;
|
||||
mPopupWindow = (PopupWindow) mHistroyAdapterView.onTrigger(historyEnums.eHistoryViewAdapterCommands.M_CLEAR_HIGHLIGHT, Arrays.asList(pItemView, pMenuItem, pLogoImage, pIsForced));
|
||||
mLongSelectedDate.remove(pDate);
|
||||
mLongSelectedIndex.remove(pUrl);
|
||||
mLongSelectedID.remove((Integer) pId);
|
||||
mLongPressedViewHolders.remove(pItem);
|
||||
if(mLongSelectedID.size()==0){
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
p_menu_item.animate().setDuration(speed).alpha(1);
|
||||
p_menu_item.setClickable(true);
|
||||
p_logo_image.setAlpha(1f);
|
||||
p_logo_image.animate().cancel();
|
||||
p_logo_image.animate().setDuration(speed).alpha(0).withEndAction(() -> p_logo_image.setVisibility(View.GONE));
|
||||
|
||||
|
||||
m_long_selected.remove(p_url);
|
||||
m_long_selected_id.remove((Integer) p_id);
|
||||
m_long_pressed_list_view_holder.remove(p_item);
|
||||
onVerifyLongSelectedURL();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
int m_list_initial_size = 0;
|
||||
|
||||
private float mPointerPosition = 0;
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
public void onSwipe(View p_item, View p_item_view, int p_position, String p_url, View p_menu_item,TextView p_logo_text,ImageView p_logo_image, int p_id){
|
||||
public void onSwipe(View pItem, View pItemView, int pPosition, String pUrl, View pMenuItem, ImageView pLogoImage, int pId, Date pDate){
|
||||
|
||||
Handler handler = new Handler();
|
||||
|
||||
Runnable mLongPressed = () -> {
|
||||
if(!m_disable_callable){
|
||||
if(!m_long_selected.contains(p_url) || !m_long_selected_id.contains(p_id)) {
|
||||
m_was_long_pressed = true;
|
||||
onSelectView(p_item, p_item_view, p_position, p_url,p_menu_item, p_logo_text, p_logo_image, false, p_id);
|
||||
if(!mDisableCallable && Math.abs(mRecyclerPositionX1-mPointerPosition) <= 20){
|
||||
if(!mLongSelectedIndex.contains(pUrl) || !mLongSelectedID.contains(pId)) {
|
||||
mLongPressedMenuActive = true;
|
||||
onSelectView(pItem, pItemView, pUrl,pMenuItem, pLogoImage, false, pId, pDate);
|
||||
}else {
|
||||
onClearHighlight(p_item, p_item_view, p_position, p_url,p_menu_item, p_logo_text, p_logo_image, false, p_id);
|
||||
m_was_long_pressed = true;
|
||||
Log.i("I AM HERE 22","I AM HERE");
|
||||
onClearHighlight(pItem, pItemView, pUrl,pMenuItem, pLogoImage, false, pId, pDate);
|
||||
mLongPressedMenuActive = true;
|
||||
}
|
||||
}else {
|
||||
pItemView.setPressed(false);
|
||||
pItemView.clearFocus();
|
||||
}
|
||||
};
|
||||
|
||||
p_item_view.setOnTouchListener((v, event) -> {
|
||||
if (event.getAction() == MotionEvent.ACTION_UP) {
|
||||
if(m_long_selected.size()>0){
|
||||
if(m_long_selected.contains(p_url) && m_long_selected_id.contains(p_id)){
|
||||
handler.removeCallbacks(mLongPressed);
|
||||
if(!m_was_long_pressed){
|
||||
onClearHighlight(p_item, p_item_view, p_position, p_url,p_menu_item, p_logo_text, p_logo_image,false, p_id);
|
||||
}
|
||||
return false;
|
||||
}else if(!m_was_long_pressed){
|
||||
handler.removeCallbacks(mLongPressed);
|
||||
onSelectView(p_item, p_item_view, p_position, p_url,p_menu_item, p_logo_text, p_logo_image,false, p_id);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else if(m_list_initial_size>0){
|
||||
return false;
|
||||
}
|
||||
pItemView.setOnTouchListener((v, event) -> {
|
||||
|
||||
x2 = event.getX();
|
||||
float deltaX = x2 - x1;
|
||||
if (mRecyclerPositionX1!=0 && Math.abs(event.getX() - mRecyclerPositionX1) > 400 && !mLongPressedMenuActive) {
|
||||
v.setPressed(false);
|
||||
pItemView.clearFocus();
|
||||
handler.removeCallbacks(mLongPressed);
|
||||
pItemView.setOnTouchListener(null);
|
||||
pItemView.clearFocus();
|
||||
if(mPassedList.size()<=1){
|
||||
mPassedList.clear();
|
||||
initializeModelWithDate(false);
|
||||
notifyItemRemoved(0);
|
||||
notifyItemRangeChanged(0, 1);
|
||||
mEvent.invokeObserver(Collections.singletonList(0),enums.etype.is_empty);
|
||||
}else {
|
||||
initializeModelWithDate(false);
|
||||
historyAdapter.this.onClose(pPosition);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Math.abs(deltaX) > MIN_DISTANCE)
|
||||
{
|
||||
v.setPressed(false);
|
||||
onClose(p_position);
|
||||
}
|
||||
else
|
||||
{
|
||||
v.setPressed(false);
|
||||
mEvent.invokeObserver(Collections.singletonList(p_url),enums.etype.url_triggered);
|
||||
}
|
||||
mPointerPosition = event.getX();
|
||||
if (event.getAction() == MotionEvent.ACTION_UP) {
|
||||
mRecyclerPositionX2 = event.getX();
|
||||
float deltaX = mRecyclerPositionX2 - mRecyclerPositionX1;
|
||||
|
||||
return true;
|
||||
Log.i("FCK2","FCK2 : " + mLongSelectedIndex.size());
|
||||
if (mLongSelectedIndex.size() > 0) {
|
||||
if (Math.abs(deltaX) <= 20 && !mLongPressedMenuActive) {
|
||||
if (mLongSelectedIndex.contains(pUrl) && mLongSelectedID.contains(pId)) {
|
||||
handler.removeCallbacks(mLongPressed);
|
||||
historyAdapter.this.onClearHighlight(pItem, pItemView, pUrl, pMenuItem, pLogoImage, false, pId, pDate);
|
||||
} else{
|
||||
handler.removeCallbacks(mLongPressed);
|
||||
historyAdapter.this.onSelectView(pItem, pItemView, pUrl, pMenuItem, pLogoImage, false, pId, pDate);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
else if (event.getAction() == MotionEvent.ACTION_DOWN) {
|
||||
m_disable_callable = false;
|
||||
m_list_initial_size = m_long_selected.size();
|
||||
m_was_long_pressed = false;
|
||||
v.setPressed(true);
|
||||
x1 = event.getX();
|
||||
handler.postDelayed(mLongPressed, ViewConfiguration.getLongPressTimeout());
|
||||
return true;
|
||||
}
|
||||
else if(event.getAction() == MotionEvent.ACTION_CANCEL)
|
||||
{
|
||||
m_disable_callable = true;
|
||||
if(!m_long_selected.contains(p_url) || !m_long_selected_id.contains(p_id)) {
|
||||
v.setPressed(false);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
if (Math.abs(deltaX) > 100) {
|
||||
v.setPressed(false);
|
||||
handler.removeCallbacks(mLongPressed);
|
||||
historyAdapter.this.onClose(pPosition);
|
||||
} else {
|
||||
v.setPressed(false);
|
||||
handler.removeCallbacks(mLongPressed);
|
||||
mEvent.invokeObserver(Collections.singletonList(pUrl), enums.etype.url_triggered);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
} else if (event.getAction() == MotionEvent.ACTION_DOWN) {
|
||||
mDisableCallable = false;
|
||||
mLongPressedMenuActive = false;
|
||||
v.setPressed(true);
|
||||
mRecyclerPositionX1 = event.getX();
|
||||
Log.i("1WOW : ","WOW : " + event.getX() + " -- " + mRecyclerPositionX1);
|
||||
handler.postDelayed(mLongPressed, ViewConfiguration.getLongPressTimeout());
|
||||
return true;
|
||||
} else if (event.getAction() == MotionEvent.ACTION_CANCEL) {
|
||||
handler.removeCallbacks(mLongPressed);
|
||||
mDisableCallable = true;
|
||||
if (!mLongSelectedIndex.contains(pUrl) || !mLongSelectedID.contains(pId)) {
|
||||
v.setPressed(false);
|
||||
}
|
||||
handler.removeCallbacks(mLongPressed);
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
void onOpenMenu(View view, String p_url, int p_position, String p_title){
|
||||
void onOpenMenu(View pView, String pUrl, int pPosition, String pTitle){
|
||||
LayoutInflater layoutInflater = (LayoutInflater) pView.getContext().getSystemService(LAYOUT_INFLATER_SERVICE);
|
||||
@SuppressLint("InflateParams") final View mPopupView = layoutInflater.inflate(R.layout.recyclerview__row_menu, null);
|
||||
mPopupWindow = (PopupWindow) mHistroyAdapterView.onTrigger(historyEnums.eHistoryViewAdapterCommands.M_OPEN_MENU, Arrays.asList(mPopupWindow, pView, mPopupView));
|
||||
|
||||
if(popupWindow!=null){
|
||||
popupWindow.dismiss();
|
||||
}
|
||||
|
||||
LayoutInflater layoutInflater
|
||||
= (LayoutInflater) view.getContext()
|
||||
.getSystemService(LAYOUT_INFLATER_SERVICE);
|
||||
final View popupView = layoutInflater.inflate(R.layout.history_popup_menu, null);
|
||||
|
||||
|
||||
this.popupWindow = new PopupWindow(
|
||||
popupView,
|
||||
ActionMenuView.LayoutParams.WRAP_CONTENT,
|
||||
ActionMenuView.LayoutParams.WRAP_CONTENT, true);
|
||||
|
||||
view.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
|
||||
int xOffset = -(view.getMeasuredWidth() - view.getWidth());
|
||||
|
||||
int[] location = new int[2];
|
||||
view.getLocationOnScreen(location);
|
||||
int y = location[1] + 600;
|
||||
int height = helperMethod.getScreenHeight(m_main_context);
|
||||
int m_offset_height = 0;
|
||||
if(y + 400 >height){
|
||||
m_offset_height = y-height;
|
||||
}
|
||||
else if(y - 1200 < 0){
|
||||
m_offset_height = y - 1200;
|
||||
}
|
||||
|
||||
popupWindow.setOutsideTouchable(true);
|
||||
popupWindow.setFocusable(true);
|
||||
popupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
popupWindow.setAnimationStyle(R.style.popup_window_animation);
|
||||
popupWindow.setElevation(7);
|
||||
popupWindow.showAsDropDown(view,xOffset - 90,-330 - m_offset_height);
|
||||
|
||||
setPopupWindowEvents(popupView.findViewById(R.id.menu1), p_url, p_position, p_title);
|
||||
setPopupWindowEvents(popupView.findViewById(R.id.menu2), p_url, p_position, p_title);
|
||||
setPopupWindowEvents(popupView.findViewById(R.id.menu3), p_url, p_position, p_title);
|
||||
setPopupWindowEvents(popupView.findViewById(R.id.menu4), p_url, p_position, p_title);
|
||||
setPopupWindowEvents(popupView.findViewById(R.id.menu5), p_url, p_position, p_title);
|
||||
setPopupWindowEvents(mPopupView.findViewById(R.id.pMenuCopy), pUrl, pPosition, pTitle);
|
||||
setPopupWindowEvents(mPopupView.findViewById(R.id.pMenuShare), pUrl, pPosition, pTitle);
|
||||
setPopupWindowEvents(mPopupView.findViewById(R.id.pMenuOpenCurrentTab), pUrl, pPosition, pTitle);
|
||||
setPopupWindowEvents(mPopupView.findViewById(R.id.pMenuOpenNewTab), pUrl, pPosition, pTitle);
|
||||
setPopupWindowEvents(mPopupView.findViewById(R.id.pMenuDelete), pUrl, pPosition, pTitle);
|
||||
}
|
||||
|
||||
public void setPopupWindowEvents(View p_view, String p_url, int p_position, String p_title){
|
||||
p_view.setOnClickListener(v -> {
|
||||
if(v.getId() == R.id.menu1){
|
||||
helperMethod.copyURL(p_url, m_context);
|
||||
popupWindow.dismiss();
|
||||
public void setPopupWindowEvents(View pView, String pUrl, int pPosition, String pTitle){
|
||||
pView.setOnClickListener(v -> {
|
||||
if(v.getId() == R.id.pMenuCopy){
|
||||
helperMethod.copyURL(pUrl, mListHolderContext);
|
||||
mPopupWindow.dismiss();
|
||||
}
|
||||
else if(v.getId() == R.id.menu2){
|
||||
helperMethod.shareApp((AppCompatActivity)m_context, p_url, p_title);
|
||||
popupWindow.dismiss();
|
||||
else if(v.getId() == R.id.pMenuShare){
|
||||
helperMethod.shareApp((AppCompatActivity)mListHolderContext, pUrl, pTitle);
|
||||
mPopupWindow.dismiss();
|
||||
}
|
||||
else if(v.getId() == R.id.menu3){
|
||||
mEvent.invokeObserver(Collections.singletonList(p_url),enums.etype.url_triggered);
|
||||
popupWindow.dismiss();
|
||||
else if(v.getId() == R.id.pMenuOpenCurrentTab){
|
||||
mEvent.invokeObserver(Collections.singletonList(pUrl),enums.etype.url_triggered);
|
||||
mPopupWindow.dismiss();
|
||||
}
|
||||
else if(v.getId() == R.id.menu4){
|
||||
mEvent.invokeObserver(Collections.singletonList(p_url),enums.etype.url_triggered_new_tab);
|
||||
popupWindow.dismiss();
|
||||
else if(v.getId() == R.id.pMenuOpenNewTab){
|
||||
mEvent.invokeObserver(Collections.singletonList(pUrl),enums.etype.url_triggered_new_tab);
|
||||
mPopupWindow.dismiss();
|
||||
}
|
||||
else if(v.getId() == R.id.menu5){
|
||||
onClose(p_position);
|
||||
popupWindow.dismiss();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setItemViewOnClickListener(View p_item, View p_item_view, View p_item_menu , String p_url, int p_position, String p_title,View p_menu_item,TextView p_logo_text,ImageView p_logo_image, int p_id)
|
||||
{
|
||||
p_item_menu.setOnClickListener((View v) -> onOpenMenu(v, p_url, p_position, p_title));
|
||||
onSwipe(p_item, p_item_view, p_position, p_url,p_menu_item, p_logo_text, p_logo_image, p_id);
|
||||
}
|
||||
|
||||
boolean m_disable_callable = false;
|
||||
|
||||
public void onClose(int index){
|
||||
if(!isClosing){
|
||||
isClosing = true;
|
||||
mEvent.invokeObserver(Collections.singletonList(m_real_index.get(index)),enums.etype.url_clear);
|
||||
mEvent.invokeObserver(Collections.singletonList(m_real_id.get(index)),enums.etype.url_clear_at);
|
||||
invokeFilter(false);
|
||||
mEvent.invokeObserver(Collections.singletonList(m_real_id.get(index)),enums.etype.is_empty);
|
||||
if(passedModelList.size()>0){
|
||||
else if(v.getId() == R.id.pMenuDelete){
|
||||
initializeModelWithDate(false);
|
||||
}else {
|
||||
tempModelList.clear();
|
||||
index=0;
|
||||
onClose(pPosition);
|
||||
mPopupWindow.dismiss();
|
||||
}
|
||||
int size = tempModelList.size();
|
||||
notifyItemRemoved(index);
|
||||
notifyItemRangeChanged(index, size);
|
||||
});
|
||||
}
|
||||
|
||||
private void setItemViewOnClickListener(View pItem, View pItemView, View pItemMenu, String pUrl, int pPosition, String pTitle, View pMenuItem, ImageView pLogoImage, int pId, Date pDate)
|
||||
{
|
||||
pItemMenu.setOnClickListener((View v) -> onOpenMenu(v, pUrl, pPosition, pTitle));
|
||||
onSwipe(pItem, pItemView, pPosition, pUrl,pMenuItem, pLogoImage, pId, pDate);
|
||||
}
|
||||
|
||||
private void onClose(int pIndex){
|
||||
mEvent.invokeObserver(Collections.singletonList(mRealIndex.get(pIndex)),enums.etype.url_clear);
|
||||
mEvent.invokeObserver(Collections.singletonList(mRealID.get(pIndex)),enums.etype.url_clear_at);
|
||||
invokeFilter(false);
|
||||
mEvent.invokeObserver(Collections.singletonList(mRealID.get(pIndex)),enums.etype.is_empty);
|
||||
boolean mDateVerify = false;
|
||||
if(mPassedList.size()>0){
|
||||
if(mCurrentList.size()>0 && mCurrentList.get(pIndex-1).getDescription()==null && (mCurrentList.size()>pIndex+1 && mCurrentList.get(pIndex+1).getDescription()==null || mCurrentList.size()==pIndex+1)){
|
||||
mDateVerify = true;
|
||||
}
|
||||
}else {
|
||||
mCurrentList.clear();
|
||||
notifyDataSetChanged();
|
||||
return;
|
||||
}
|
||||
int size = mCurrentList.size();
|
||||
|
||||
if(mDateVerify){
|
||||
notifyItemRemoved(pIndex-1);
|
||||
mCurrentList.remove(pIndex-1);
|
||||
notifyItemRemoved(pIndex-1);
|
||||
mCurrentList.remove(pIndex-1);
|
||||
notifyItemRangeChanged(pIndex-1, mCurrentList.size());
|
||||
}else {
|
||||
notifyItemRemoved(pIndex);
|
||||
mCurrentList.remove(pIndex);
|
||||
notifyItemRangeChanged(pIndex, mCurrentList.size());
|
||||
}
|
||||
|
||||
if(size>1){
|
||||
new Thread(){
|
||||
public void run(){
|
||||
try
|
||||
{
|
||||
sleep(500);
|
||||
isClosing = false;
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
{
|
||||
|
@ -481,84 +474,89 @@ public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listView
|
|||
}
|
||||
}.start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*View Holder Extensions*/
|
||||
class listViewHolder extends RecyclerView.ViewHolder
|
||||
{
|
||||
TextView m_header;
|
||||
TextView m_description;
|
||||
TextView m_date;
|
||||
TextView m_logo_default;
|
||||
ImageButton m_popup_menu;
|
||||
ImageView p_logo_image;
|
||||
LinearLayout m_item_container;
|
||||
LinearLayout m_date_container;
|
||||
LinearLayout m_loading;
|
||||
TextView mHeader;
|
||||
TextView mDescription;
|
||||
TextView mDate;
|
||||
TextView mWebLogo;
|
||||
ImageButton mRowMenu;
|
||||
ImageView mLogoImage;
|
||||
LinearLayout mRowContainer;
|
||||
LinearLayout mDateContainer;
|
||||
LinearLayout mLoadingContainer;
|
||||
|
||||
listViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
}
|
||||
|
||||
void bindListView(historyRowModel model, int p_position) {
|
||||
m_date_container = itemView.findViewById(R.id.p_date_container);
|
||||
m_header = itemView.findViewById(R.id.p_header);
|
||||
m_description = itemView.findViewById(R.id.p_description);
|
||||
m_item_container = itemView.findViewById(R.id.p_item_container);
|
||||
m_popup_menu = itemView.findViewById(R.id.p_popup_menu);
|
||||
m_date = itemView.findViewById(R.id.p_date);
|
||||
p_logo_image = itemView.findViewById(R.id.p_logo_image);
|
||||
m_logo_default = itemView.findViewById(R.id.p_logo_default);
|
||||
m_loading = itemView.findViewById(R.id.p_loading);
|
||||
mDateContainer = itemView.findViewById(R.id.pDateContainer);
|
||||
mHeader = itemView.findViewById(R.id.pHeader);
|
||||
mDescription = itemView.findViewById(R.id.pDescription);
|
||||
mRowContainer = itemView.findViewById(R.id.pRowContainer);
|
||||
mRowMenu = itemView.findViewById(R.id.pRowMenu);
|
||||
mDate = itemView.findViewById(R.id.pDate);
|
||||
mLogoImage = itemView.findViewById(R.id.pLogoImage);
|
||||
mWebLogo = itemView.findViewById(R.id.pWebLogo);
|
||||
mLoadingContainer = itemView.findViewById(R.id.pLoadingContainer);
|
||||
|
||||
|
||||
if(model.getID() == -1){
|
||||
m_date.setText(model.getHeader());
|
||||
m_date_container.setVisibility(View.VISIBLE);
|
||||
m_item_container.setVisibility(View.GONE);
|
||||
m_popup_menu.setVisibility(View.GONE);
|
||||
m_logo_default.setVisibility(View.GONE);
|
||||
m_loading.setVisibility(View.GONE);
|
||||
mDate.setText(model.getHeader());
|
||||
mDateContainer.setVisibility(View.VISIBLE);
|
||||
mRowContainer.setVisibility(View.GONE);
|
||||
mRowMenu.setVisibility(View.GONE);
|
||||
mWebLogo.setVisibility(View.GONE);
|
||||
mLoadingContainer.setVisibility(View.GONE);
|
||||
}
|
||||
else if(model.getID() == -2){
|
||||
m_date.setText(model.getHeader());
|
||||
m_date_container.setVisibility(View.GONE);
|
||||
m_item_container.setVisibility(View.GONE);
|
||||
m_popup_menu.setVisibility(View.GONE);
|
||||
m_logo_default.setVisibility(View.GONE);
|
||||
m_loading.setVisibility(View.VISIBLE);
|
||||
mDate.setText(model.getHeader());
|
||||
mDateContainer.setVisibility(View.GONE);
|
||||
mRowContainer.setVisibility(View.GONE);
|
||||
mRowMenu.setVisibility(View.GONE);
|
||||
mWebLogo.setVisibility(View.GONE);
|
||||
mLoadingContainer.setVisibility(View.VISIBLE);
|
||||
}
|
||||
else {
|
||||
m_date_container.setVisibility(View.GONE);
|
||||
m_loading.setVisibility(View.GONE);
|
||||
m_item_container.setVisibility(View.VISIBLE);
|
||||
m_popup_menu.setVisibility(View.VISIBLE);
|
||||
m_logo_default.setVisibility(View.VISIBLE);
|
||||
mDateContainer.setVisibility(View.GONE);
|
||||
mLoadingContainer.setVisibility(View.GONE);
|
||||
mRowContainer.setVisibility(View.VISIBLE);
|
||||
mRowMenu.setVisibility(View.VISIBLE);
|
||||
mWebLogo.setVisibility(View.VISIBLE);
|
||||
|
||||
m_logo_default.setText((model.getHeader().toUpperCase().charAt(0)+""));
|
||||
mWebLogo.setText((helperMethod.getDomainName(model.getHeader()).toUpperCase().charAt(0)+""));
|
||||
String header = model.getHeader();
|
||||
m_description.setText(("https://"+model.getDescription()));
|
||||
m_header.setText(model.getHeader());
|
||||
mDescription.setText(("https://"+model.getDescription()));
|
||||
mHeader.setText(model.getHeader());
|
||||
|
||||
setItemViewOnClickListener(itemView, m_item_container, m_popup_menu, m_description.getText().toString(), p_position, header, m_popup_menu, m_logo_default, p_logo_image, model.getID());
|
||||
setItemViewOnClickListener(itemView, mRowContainer, mRowMenu, mDescription.getText().toString(), p_position, header, mRowMenu, mLogoImage, model.getID(), model.getDate());
|
||||
}
|
||||
|
||||
if(m_long_selected.contains("https://" + model.getDescription()) && m_long_selected_id.contains(model.getID())){
|
||||
onSelectView(itemView, m_item_container, p_position, model.getDescription(), m_popup_menu, m_logo_default, p_logo_image,true, model.getID());
|
||||
}else if(m_popup_menu.isClickable()){
|
||||
onClearHighlight(itemView, m_item_container, p_position, model.getDescription(), m_popup_menu, m_logo_default, p_logo_image,true, model.getID());
|
||||
if(mLongSelectedID.size()>0){
|
||||
mRowMenu.setVisibility(View.GONE);
|
||||
}else {
|
||||
mRowMenu.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
if(mLongSelectedIndex.contains("https://" + model.getDescription()) && mLongSelectedID.contains(model.getID())){
|
||||
mPopupWindow = (PopupWindow) mHistroyAdapterView.onTrigger(historyEnums.eHistoryViewAdapterCommands.M_SELECT_VIEW, Arrays.asList(mRowContainer, mRowMenu, mLogoImage, true, false));
|
||||
}else if(mLogoImage.getAlpha()>0){
|
||||
mPopupWindow = (PopupWindow) mHistroyAdapterView.onTrigger(historyEnums.eHistoryViewAdapterCommands.M_CLEAR_HIGHLIGHT, Arrays.asList(mRowContainer, mRowMenu, mLogoImage, true, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void setFilter(String filter){
|
||||
this.filter = filter.toLowerCase();
|
||||
void setFilter(String pFilter){
|
||||
this.mFilter = pFilter.toLowerCase();
|
||||
}
|
||||
|
||||
void invokeFilter(boolean notify){
|
||||
if(notify){
|
||||
if(filter.length()>0){
|
||||
if(mFilter.length()>0){
|
||||
initializeModelWithDate(true);
|
||||
}else {
|
||||
initializeModelWithDate(false);
|
||||
|
@ -566,4 +564,28 @@ public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listView
|
|||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isLongPressMenuActive(){
|
||||
return mLongSelectedIndex.size()>0;
|
||||
}
|
||||
|
||||
public Object onTrigger(historyEnums.eHistoryAdapterCommands pCommands, List<Object> pData){
|
||||
if(pCommands == historyEnums.eHistoryAdapterCommands.GET_SELECTED_URL){
|
||||
return getSelectedURL();
|
||||
}
|
||||
else if(pCommands == historyEnums.eHistoryAdapterCommands.M_ON_LOADING){
|
||||
onLoading();
|
||||
}
|
||||
else if(pCommands == historyEnums.eHistoryAdapterCommands.M_LOADING_CLEAR){
|
||||
onLoadingClear();
|
||||
}
|
||||
else if(pCommands == historyEnums.eHistoryAdapterCommands.M_CLEAR_LONG_SELECTED_URL){
|
||||
clearLongSelectedURL();
|
||||
}
|
||||
else if(pCommands == historyEnums.eHistoryAdapterCommands.GET_LONG_SELECTED_URL){
|
||||
return getLongSelectedleURL();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,120 @@
|
|||
package com.darkweb.genesissearchengine.appManager.historyManager;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.view.View;
|
||||
import android.widget.ActionMenuView;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.PopupWindow;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import com.darkweb.genesissearchengine.helperManager.helperMethod;
|
||||
import com.example.myapplication.R;
|
||||
import java.util.List;
|
||||
|
||||
public class historyAdapterView
|
||||
{
|
||||
/*Private Variables*/
|
||||
private AppCompatActivity mContext;
|
||||
|
||||
historyAdapterView(AppCompatActivity pContext)
|
||||
{
|
||||
this.mContext = pContext;
|
||||
}
|
||||
|
||||
public Object openMenu(PopupWindow pPopupWindow, View pView, View popupView){
|
||||
|
||||
if(pPopupWindow !=null){
|
||||
pPopupWindow.dismiss();
|
||||
}
|
||||
|
||||
pPopupWindow = new PopupWindow(
|
||||
popupView,
|
||||
ActionMenuView.LayoutParams.WRAP_CONTENT,
|
||||
ActionMenuView.LayoutParams.WRAP_CONTENT, true);
|
||||
|
||||
pView.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
|
||||
int xOffset = -(pView.getMeasuredWidth() - pView.getWidth());
|
||||
|
||||
int[] location = new int[2];
|
||||
pView.getLocationOnScreen(location);
|
||||
int y = location[1];
|
||||
int height = helperMethod.getScreenHeight(mContext);
|
||||
int m_offset_height = 0;
|
||||
if(y + helperMethod.pxFromDp(300) >height){
|
||||
m_offset_height = helperMethod.pxFromDp(203);
|
||||
}
|
||||
else{
|
||||
m_offset_height = 0;
|
||||
}
|
||||
|
||||
pPopupWindow.setOutsideTouchable(true);
|
||||
pPopupWindow.setFocusable(true);
|
||||
pPopupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
pPopupWindow.setAnimationStyle(R.style.popup_window_animation);
|
||||
pPopupWindow.setElevation(7);
|
||||
pPopupWindow.showAsDropDown(pView,xOffset - 90, -m_offset_height-helperMethod.pxFromDp(50));
|
||||
return pPopupWindow;
|
||||
}
|
||||
|
||||
private void clearLongSelectedURL(ImageButton pPopupMenu, ImageView pLogoImage, View mItemView){
|
||||
mItemView.setPressed(false);
|
||||
pPopupMenu.setVisibility(View.VISIBLE);
|
||||
pPopupMenu.animate().setDuration(150).alpha(1);
|
||||
pPopupMenu.setClickable(true);
|
||||
pLogoImage.setAlpha(1f);
|
||||
pLogoImage.animate().cancel();
|
||||
pLogoImage.animate().setDuration(150).alpha(0).withEndAction(() -> pLogoImage.setVisibility(View.GONE));
|
||||
}
|
||||
|
||||
public void onSelectView(View pItemView, View pMenuItem, ImageView pLogoImage, boolean pIsForced, boolean pVibrate){
|
||||
pItemView.setPressed(false);
|
||||
int speed = 150;
|
||||
if(pIsForced){
|
||||
speed=0;
|
||||
}
|
||||
if(pVibrate){
|
||||
helperMethod.vibrate(mContext);
|
||||
}
|
||||
|
||||
pLogoImage.setAlpha(0.5f);
|
||||
pLogoImage.setVisibility(View.VISIBLE);
|
||||
pLogoImage.animate().cancel();
|
||||
pLogoImage.animate().setDuration(speed).alpha(1);
|
||||
}
|
||||
|
||||
public void onClearHighlight( View pItemView, View pMenuItem, ImageView pLogoImage, boolean pIsForced)
|
||||
{
|
||||
try {
|
||||
if(pLogoImage.getAlpha()>0){
|
||||
pItemView.setPressed(false);
|
||||
int speed = 150;
|
||||
if(pIsForced){
|
||||
speed = 0;
|
||||
}
|
||||
pLogoImage.setAlpha(1f);
|
||||
pLogoImage.animate().cancel();
|
||||
pLogoImage.animate().setDuration(speed).alpha(0).withEndAction(() -> pLogoImage.setVisibility(View.GONE));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public Object onTrigger(historyEnums.eHistoryViewAdapterCommands pCommands, List<Object> pData){
|
||||
if(pCommands == historyEnums.eHistoryViewAdapterCommands.M_OPEN_MENU){
|
||||
return openMenu((PopupWindow) pData.get(0), (View) pData.get(1), (View) pData.get(2));
|
||||
}
|
||||
if(pCommands == historyEnums.eHistoryViewAdapterCommands.M_CLEAR_LONG_SELECTED_VIEW){
|
||||
clearLongSelectedURL((ImageButton)pData.get(0), (ImageView)pData.get(1), (View)pData.get(2));
|
||||
}
|
||||
if(pCommands == historyEnums.eHistoryViewAdapterCommands.M_SELECT_VIEW){
|
||||
onSelectView((View)pData.get(0), (View)pData.get(1), (ImageView)pData.get(2), (Boolean) pData.get(3), (Boolean) pData.get(4));
|
||||
}
|
||||
if(pCommands == historyEnums.eHistoryViewAdapterCommands.M_CLEAR_HIGHLIGHT){
|
||||
onClearHighlight((View)pData.get(0), (View)pData.get(1), (ImageView)pData.get(2), (Boolean) pData.get(3));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -43,20 +43,23 @@ public class historyController extends AppCompatActivity
|
|||
{
|
||||
/*Private Variables*/
|
||||
|
||||
private historyModel m_list_model;
|
||||
private homeController m_home_controller;
|
||||
private activityContextManager m_context_manager;
|
||||
private historyModel mHistoryModel;
|
||||
private homeController mHomeController;
|
||||
private activityContextManager mContextManager;
|
||||
private historyAdapter mHistoryAdapter;
|
||||
|
||||
/*Private Views*/
|
||||
|
||||
private ImageView m_empty_list;
|
||||
private EditText m_search;
|
||||
private RecyclerView m_listview;
|
||||
private Button m_clearButton;
|
||||
private ImageButton m_menu_button;
|
||||
private ImageButton m_search_button;
|
||||
private ImageView mEmptyListNotification;
|
||||
private EditText mSearchInput;
|
||||
private RecyclerView mRecycleView;
|
||||
private Button mClearButton;
|
||||
private ImageButton mMenuButton;
|
||||
private ImageButton mSearchButton;
|
||||
|
||||
private historyViewController m_history_view_controller;
|
||||
private historyViewController mHistoryViewController;
|
||||
private boolean isUpdatingRecyclerView = false;
|
||||
private boolean mIsScrollingUp;
|
||||
|
||||
/*Initializations*/
|
||||
|
||||
|
@ -68,37 +71,114 @@ public class historyController extends AppCompatActivity
|
|||
initializeListModel();
|
||||
initializeViews();
|
||||
initializeList();
|
||||
onEditorInvoked();
|
||||
initCustomListeners();
|
||||
}
|
||||
|
||||
public void initializeListModel(){
|
||||
m_list_model = new historyModel();
|
||||
m_context_manager = activityContextManager.getInstance();
|
||||
m_home_controller = activityContextManager.getInstance().getHomeController();
|
||||
m_context_manager.setHistoryController(this);
|
||||
mHistoryModel = new historyModel();
|
||||
mContextManager = activityContextManager.getInstance();
|
||||
mHomeController = activityContextManager.getInstance().getHomeController();
|
||||
mContextManager.setHistoryController(this);
|
||||
activityContextManager.getInstance().setHistoryController(this);
|
||||
pluginController.getInstance().logEvent(strings.HISTORY_OPENED);
|
||||
pluginController.getInstance().logEvent(strings.EVENT_HISTORY_OPENED);
|
||||
}
|
||||
public void initializeViews(){
|
||||
m_empty_list = findViewById(R.id.p_empty_list);
|
||||
m_search = findViewById(R.id.p_search);
|
||||
m_listview = findViewById(R.id.p_listview);
|
||||
m_clearButton = findViewById(R.id.p_clearButton);
|
||||
m_menu_button = findViewById(R.id.p_menu_button);
|
||||
m_search_button = findViewById(R.id.p_search_button);
|
||||
m_history_view_controller = new historyViewController(m_empty_list, m_search, m_listview, m_clearButton,this, m_menu_button, m_search_button);
|
||||
mEmptyListNotification = findViewById(R.id.pEmptyListNotification);
|
||||
mSearchInput = findViewById(R.id.pSearchInput);
|
||||
mRecycleView = findViewById(R.id.pRecycleView);
|
||||
mClearButton = findViewById(R.id.pClearButton);
|
||||
mMenuButton = findViewById(R.id.pMenuButton);
|
||||
mSearchButton = findViewById(R.id.pSearchButton);
|
||||
|
||||
mHistoryViewController = new historyViewController(mEmptyListNotification, mSearchInput, mRecycleView, mClearButton,this, mMenuButton, mSearchButton);
|
||||
}
|
||||
public void initializeList(){
|
||||
ArrayList<historyRowModel> model = (ArrayList<historyRowModel>) dataController.getInstance().invokeHistory(dataEnums.eHistoryCommands.M_GET_HISTORY ,null);
|
||||
m_list_model.setList(model);
|
||||
historyAdapter adapter = new historyAdapter(m_list_model.getList(),new adapterCallback(), this);
|
||||
mHistoryModel.setList(model);
|
||||
historyAdapter adapter = new historyAdapter(mHistoryModel.getList(),new adapterCallback(), this);
|
||||
mHistoryAdapter = adapter;
|
||||
adapter.invokeFilter(false);
|
||||
m_listview.setAdapter(adapter);
|
||||
m_listview.setLayoutManager(new LinearLayoutManager(this));
|
||||
m_history_view_controller.onTrigger(historyEnums.eHistoryViewCommands.M_UPDATE_LIST_IF_EMPTY, Arrays.asList(m_list_model.getList().size(),0));
|
||||
mRecycleView.setNestedScrollingEnabled(false);
|
||||
mRecycleView.setHasFixedSize(true);
|
||||
|
||||
mRecycleView.setAdapter(adapter);
|
||||
mRecycleView.setItemViewCacheSize(100);
|
||||
mRecycleView.setDrawingCacheEnabled(true);
|
||||
mRecycleView.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_HIGH);
|
||||
|
||||
mRecycleView.setLayoutManager(new LinearLayoutManager(this));
|
||||
mHistoryViewController.onTrigger(historyEnums.eHistoryViewCommands.M_UPDATE_LIST_IF_EMPTY, Arrays.asList(mHistoryModel.getList().size(),0));
|
||||
}
|
||||
|
||||
/*View Handlers*/
|
||||
public void initCustomListeners(){
|
||||
mRecycleView.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||
@Override
|
||||
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
|
||||
super.onScrollStateChanged(recyclerView, newState);
|
||||
if (!recyclerView.canScrollVertically(1)) {
|
||||
if(mSearchInput.getVisibility()==View.GONE){
|
||||
LinearLayoutManager layoutManager= (LinearLayoutManager) recyclerView.getLayoutManager();
|
||||
int totalItemCount = layoutManager.getItemCount();
|
||||
int lastVisible = layoutManager.findLastVisibleItemPosition();
|
||||
|
||||
boolean endHasBeenReached = lastVisible + 1 >= totalItemCount;
|
||||
|
||||
if (totalItemCount > 0 && endHasBeenReached) {
|
||||
mRecycleView.computeVerticalScrollOffset();
|
||||
onLoadMoreHistory(mRecycleView.computeVerticalScrollOffset()>0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
||||
}
|
||||
});
|
||||
|
||||
mClearButton.requestFocusFromTouch();
|
||||
mClearButton.setOnClickListener(v -> pluginController.getInstance().MessageManagerHandler(activityContextManager.getInstance().getHistoryController(), Collections.singletonList(strings.GENERIC_EMPTY_STR), enums.etype.clear_history));
|
||||
|
||||
mSearchInput.setOnEditorActionListener((v, actionId, event) ->{
|
||||
if (actionId == EditorInfo.IME_ACTION_NEXT)
|
||||
{
|
||||
helperMethod.hideKeyboard(this);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
mSearchInput.setOnFocusChangeListener((v, hasFocus) -> {
|
||||
if (!hasFocus) {
|
||||
mSearchInput.clearFocus();
|
||||
}else {
|
||||
((historyAdapter) Objects.requireNonNull(mRecycleView.getAdapter())).setFilter(mSearchInput.getText().toString());
|
||||
((historyAdapter) mRecycleView.getAdapter()).invokeFilter(true);
|
||||
}
|
||||
});
|
||||
|
||||
mSearchInput.addTextChangedListener(new TextWatcher() {
|
||||
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2){
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2){
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable editable)
|
||||
{
|
||||
((historyAdapter) Objects.requireNonNull(mRecycleView.getAdapter())).setFilter(mSearchInput.getText().toString());
|
||||
((historyAdapter) mRecycleView.getAdapter()).invokeFilter(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/*View Custom Overrides*/
|
||||
|
||||
@Override
|
||||
public boolean dispatchTouchEvent(MotionEvent event) {
|
||||
|
@ -117,161 +197,12 @@ public class historyController extends AppCompatActivity
|
|||
return super.dispatchTouchEvent(event);
|
||||
}
|
||||
|
||||
boolean m_is_recyclerview_loading = false;
|
||||
public void onEditorInvoked(){
|
||||
|
||||
m_listview.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||
@Override
|
||||
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
|
||||
super.onScrollStateChanged(recyclerView, newState);
|
||||
if (!recyclerView.canScrollVertically(1)) {
|
||||
if(m_search.getVisibility()==View.GONE){
|
||||
LinearLayoutManager layoutManager=LinearLayoutManager.class.cast(recyclerView.getLayoutManager());
|
||||
int totalItemCount = layoutManager.getItemCount();
|
||||
int lastVisible = layoutManager.findLastVisibleItemPosition();
|
||||
|
||||
boolean endHasBeenReached = lastVisible + 2 >= totalItemCount;
|
||||
if (totalItemCount > 0 && endHasBeenReached && !m_is_recyclerview_loading) {
|
||||
loadMore();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
|
||||
}
|
||||
});
|
||||
|
||||
m_clearButton.requestFocusFromTouch();
|
||||
m_clearButton.setOnClickListener(v -> pluginController.getInstance().MessageManagerHandler(activityContextManager.getInstance().getHistoryController(), Collections.singletonList(strings.EMPTY_STR), enums.etype.clear_history));
|
||||
|
||||
m_search.setOnEditorActionListener((v, actionId, event) ->{
|
||||
if (actionId == EditorInfo.IME_ACTION_NEXT)
|
||||
{
|
||||
helperMethod.hideKeyboard(this);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
m_search.setOnFocusChangeListener((v, hasFocus) -> {
|
||||
if (!hasFocus) {
|
||||
m_search.clearFocus();
|
||||
}else {
|
||||
((historyAdapter) Objects.requireNonNull(m_listview.getAdapter())).setFilter(m_search.getText().toString());
|
||||
((historyAdapter) m_listview.getAdapter()).invokeFilter(true);
|
||||
}
|
||||
});
|
||||
|
||||
m_search.addTextChangedListener(new TextWatcher() {
|
||||
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2){
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2){
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable editable)
|
||||
{
|
||||
((historyAdapter) Objects.requireNonNull(m_listview.getAdapter())).setFilter(m_search.getText().toString());
|
||||
((historyAdapter) m_listview.getAdapter()).invokeFilter(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if(m_search.getVisibility() == View.VISIBLE){
|
||||
((historyAdapter)m_listview.getAdapter()).onUpdateSearchStatus(m_history_view_controller.onHideSearch());
|
||||
}
|
||||
else if(m_menu_button.getVisibility() == View.VISIBLE){
|
||||
onClearMultipleSelection(null);
|
||||
}
|
||||
else {
|
||||
this.finish();
|
||||
}
|
||||
}
|
||||
|
||||
public void onBackPressed(View view){
|
||||
if(m_search.getVisibility() == View.VISIBLE){
|
||||
((historyAdapter)m_listview.getAdapter()).onUpdateSearchStatus(m_history_view_controller.onHideSearch());
|
||||
}
|
||||
else if(m_menu_button.getVisibility() == View.VISIBLE){
|
||||
onClearMultipleSelection(null);
|
||||
}
|
||||
else {
|
||||
this.finish();
|
||||
}
|
||||
}
|
||||
|
||||
public void onclearDataTrigger(View view){
|
||||
}
|
||||
|
||||
public void onclearData(){
|
||||
m_list_model.clearList();
|
||||
((historyAdapter) Objects.requireNonNull(m_listview.getAdapter())).invokeFilter(true );
|
||||
m_history_view_controller.onTrigger(historyEnums.eHistoryViewCommands.M_CLEAR_LIST, null);
|
||||
databaseController.getInstance().execSQL(sql.H_CLEAR_DATA,null);
|
||||
finish();
|
||||
}
|
||||
|
||||
boolean isLoadingMore = false;
|
||||
boolean is_page_loading = true;
|
||||
private boolean loadMore() {
|
||||
if(!isLoadingMore){
|
||||
if(is_page_loading){
|
||||
is_page_loading = false;
|
||||
return false;
|
||||
}
|
||||
isLoadingMore = true;
|
||||
new Thread(){
|
||||
public void run(){
|
||||
if(!m_is_recyclerview_loading){
|
||||
int m_size = m_list_model.getList().size();
|
||||
m_is_recyclerview_loading = true;
|
||||
((historyAdapter) Objects.requireNonNull(m_listview.getAdapter())).onLoading();
|
||||
boolean m_history = (boolean)dataController.getInstance().invokeHistory(dataEnums.eHistoryCommands.M_LOAD_MORE_HISTORY ,null);
|
||||
try {
|
||||
sleep(500);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
activityContextManager.getInstance().getHistoryController().runOnUiThread(() -> new Thread(){
|
||||
public void run(){
|
||||
((historyAdapter) Objects.requireNonNull(m_listview.getAdapter())).onLoadingClear();
|
||||
isLoadingMore = false;
|
||||
new Thread(){
|
||||
public void run(){
|
||||
try {
|
||||
sleep(200);
|
||||
m_is_recyclerview_loading = false;
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}.start();
|
||||
|
||||
}
|
||||
}.start());
|
||||
}
|
||||
}
|
||||
}.start();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTrimMemory(int level)
|
||||
{
|
||||
if(status.sIsAppPaused && (level==80 || level==15))
|
||||
if(status.sSettingIsAppPaused && (level==80 || level==15))
|
||||
{
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.LOW_MEMORY,true));
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.HOME_LOW_MEMORY,true));
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
@ -280,50 +211,102 @@ public class historyController extends AppCompatActivity
|
|||
public void onResume()
|
||||
{
|
||||
activityContextManager.getInstance().setCurrentActivity(this);
|
||||
status.sIsAppPaused = false;
|
||||
status.sSettingIsAppPaused = false;
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause()
|
||||
{
|
||||
status.sIsAppPaused = true;
|
||||
status.sSettingIsAppPaused = true;
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if(mSearchInput.getVisibility() == View.VISIBLE){
|
||||
onHideSearch(null);
|
||||
}else if(mHistoryAdapter.isLongPressMenuActive()){
|
||||
onClearMultipleSelection(null);
|
||||
}else {
|
||||
onBackPressed(null);
|
||||
}
|
||||
}
|
||||
|
||||
/*External XML Listeners*/
|
||||
|
||||
public void onBackPressed(View view){
|
||||
this.finish();
|
||||
}
|
||||
|
||||
public void onHideSearch(View view) {
|
||||
((historyAdapter)m_listview.getAdapter()).onUpdateSearchStatus(m_history_view_controller.onHideSearch());
|
||||
((historyAdapter) mRecycleView.getAdapter()).onUpdateSearchStatus((boolean) mHistoryViewController.onTrigger(historyEnums.eHistoryViewCommands.M_HIDE_SEARCH, null));
|
||||
}
|
||||
|
||||
public void onLongPressMenu(View view) {
|
||||
m_history_view_controller.onLongPressMenu(view);
|
||||
mHistoryViewController.onTrigger(historyEnums.eHistoryViewCommands.M_LONG_PRESS_MENU, Collections.singletonList(view));
|
||||
}
|
||||
|
||||
public void onOpenMultipleTabs(View view) {
|
||||
ArrayList<String> m_long_selected_urk = ((historyAdapter)m_listview.getAdapter()).getLongSelectedleURL();
|
||||
ArrayList<String> m_long_selected_urk = (ArrayList<String>) mHistoryAdapter.onTrigger(historyEnums.eHistoryAdapterCommands.GET_LONG_SELECTED_URL, null);
|
||||
for(int m_counter=0;m_counter<m_long_selected_urk.size();m_counter++){
|
||||
m_home_controller.onOpenLinkNewTab(m_long_selected_urk.get(m_counter));
|
||||
mHomeController.onOpenLinkNewTab(m_long_selected_urk.get(m_counter));
|
||||
}
|
||||
onBackPressed(null);
|
||||
((historyAdapter)m_listview.getAdapter()).clearLongSelectedURL();
|
||||
m_history_view_controller.onCloseMenu();
|
||||
mHistoryAdapter.onTrigger(historyEnums.eHistoryAdapterCommands.M_CLEAR_LONG_SELECTED_URL,null);
|
||||
mHistoryViewController.onTrigger(historyEnums.eHistoryViewCommands.M_CLOSE_MENU, null);
|
||||
}
|
||||
|
||||
public void onShareSelectedURL(View view) {
|
||||
String m_joined_url = ((historyAdapter)m_listview.getAdapter()).getSelectedURL();
|
||||
String m_joined_url = (String) mHistoryAdapter.onTrigger(historyEnums.eHistoryAdapterCommands.GET_SELECTED_URL, null);
|
||||
helperMethod.shareURL(this, m_joined_url);
|
||||
((historyAdapter)m_listview.getAdapter()).clearLongSelectedURL();
|
||||
m_history_view_controller.onCloseMenu();
|
||||
mHistoryAdapter.onTrigger(historyEnums.eHistoryAdapterCommands.M_CLEAR_LONG_SELECTED_URL,null);
|
||||
mHistoryViewController.onTrigger(historyEnums.eHistoryViewCommands.M_CLOSE_MENU, null);
|
||||
}
|
||||
|
||||
public void onClearMultipleSelection(View view) {
|
||||
((historyAdapter)m_listview.getAdapter()).clearLongSelectedURL();
|
||||
m_history_view_controller.onCloseMenu();
|
||||
mHistoryAdapter.onTrigger(historyEnums.eHistoryAdapterCommands.M_CLEAR_LONG_SELECTED_URL, null);
|
||||
mHistoryViewController.onTrigger(historyEnums.eHistoryViewCommands.M_CLOSE_MENU, null);
|
||||
mHistoryViewController.onTrigger(M_VERTIFY_SELECTION_MENU,Collections.singletonList(true));
|
||||
}
|
||||
|
||||
public void onDeleteSelected(View view) {
|
||||
m_history_view_controller.onCloseMenu();
|
||||
((historyAdapter)m_listview.getAdapter()).onDeleteSelected();
|
||||
mHistoryViewController.onTrigger(historyEnums.eHistoryViewCommands.M_CLOSE_MENU, null);
|
||||
mHistoryAdapter.onDeleteSelected();
|
||||
}
|
||||
|
||||
/*Helper Methods*/
|
||||
|
||||
public void onclearData(){
|
||||
mHistoryModel.clearList();
|
||||
((historyAdapter) Objects.requireNonNull(mRecycleView.getAdapter())).invokeFilter(true );
|
||||
mHistoryViewController.onTrigger(historyEnums.eHistoryViewCommands.M_CLEAR_LIST, null);
|
||||
databaseController.getInstance().execSQL(sql.SQL_CLEAR_HISTORY,null);
|
||||
}
|
||||
|
||||
private void onLoadMoreHistory(boolean pLoadingEnabled) {
|
||||
if(!isUpdatingRecyclerView){
|
||||
isUpdatingRecyclerView = true;
|
||||
new Thread(){
|
||||
public void run(){
|
||||
if(pLoadingEnabled){
|
||||
mHistoryAdapter.onTrigger(historyEnums.eHistoryAdapterCommands.M_ON_LOADING, null);
|
||||
}
|
||||
dataController.getInstance().invokeHistory(dataEnums.eHistoryCommands.M_LOAD_MORE_HISTORY ,null);
|
||||
try {
|
||||
sleep(500);
|
||||
activityContextManager.getInstance().getHistoryController().runOnUiThread(() -> {
|
||||
mHistoryAdapter.onTrigger(historyEnums.eHistoryAdapterCommands.M_LOADING_CLEAR, null);
|
||||
});
|
||||
sleep(1000);
|
||||
isUpdatingRecyclerView = false;
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
isUpdatingRecyclerView = false;
|
||||
}
|
||||
}
|
||||
}.start();
|
||||
}
|
||||
}
|
||||
|
||||
/*Event Observer*/
|
||||
|
@ -334,30 +317,30 @@ public class historyController extends AppCompatActivity
|
|||
{
|
||||
if(e_type.equals(enums.etype.url_triggered)){
|
||||
String url_temp = helperMethod.completeURL(data.get(0).toString());
|
||||
pluginController.getInstance().logEvent(strings.HISTORY_TRIGGERED);
|
||||
m_home_controller.onLoadURL(url_temp);
|
||||
pluginController.getInstance().logEvent(strings.EVENT_HISTORY_TRIGGERED);
|
||||
mHomeController.onLoadURL(url_temp);
|
||||
finish();
|
||||
}
|
||||
else if(e_type.equals(enums.etype.url_triggered_new_tab)){
|
||||
String url_temp = helperMethod.completeURL(data.get(0).toString());
|
||||
pluginController.getInstance().logEvent(strings.HISTORY_TRIGGERED);
|
||||
m_home_controller.onOpenLinkNewTab(url_temp);
|
||||
pluginController.getInstance().logEvent(strings.EVENT_HISTORY_TRIGGERED);
|
||||
mHomeController.onOpenLinkNewTab(url_temp);
|
||||
finish();
|
||||
}
|
||||
else if(e_type.equals(enums.etype.url_clear)){
|
||||
m_list_model.onManualClear((int)data.get(0));
|
||||
mHistoryModel.onManualClear((int)data.get(0));
|
||||
}
|
||||
else if(e_type.equals(enums.etype.url_clear_at)){
|
||||
dataController.getInstance().invokeHistory(dataEnums.eHistoryCommands.M_REMOVE_HISTORY ,data);
|
||||
}
|
||||
else if(e_type.equals(enums.etype.is_empty)){
|
||||
m_history_view_controller.onTrigger(historyEnums.eHistoryViewCommands.M_UPDATE_LIST_IF_EMPTY, Arrays.asList(m_list_model.getList().size(),300));
|
||||
mHistoryViewController.onTrigger(historyEnums.eHistoryViewCommands.M_UPDATE_LIST_IF_EMPTY, Arrays.asList(mHistoryModel.getList().size(),300));
|
||||
}
|
||||
else if(e_type.equals(enums.etype.remove_from_database)){
|
||||
databaseController.getInstance().deleteFromList((int)data.get(0),strings.H_HISTORY_TITLE);
|
||||
databaseController.getInstance().deleteFromList((int)data.get(0),strings.HISTORY_TITLE);
|
||||
}
|
||||
else if(e_type.equals(enums.etype.on_verify_selected_url_menu)){
|
||||
m_history_view_controller.onTrigger(M_VERTIFY_SELECTION_MENU, data);
|
||||
mHistoryViewController.onTrigger(M_VERTIFY_SELECTION_MENU, data);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -2,8 +2,17 @@ package com.darkweb.genesissearchengine.appManager.historyManager;
|
|||
|
||||
public class historyEnums
|
||||
{
|
||||
/*Settings Manager*/
|
||||
/*History Manager*/
|
||||
public enum eHistoryViewCommands {
|
||||
M_UPDATE_LIST_IF_EMPTY, M_UPDATE_LIST, M_REMOVE_FROM_LIST, M_CLEAR_LIST,M_VERTIFY_SELECTION_MENU
|
||||
M_UPDATE_LIST_IF_EMPTY, M_UPDATE_LIST, M_REMOVE_FROM_LIST, M_CLEAR_LIST,M_VERTIFY_SELECTION_MENU, M_CLOSE_MENU, M_HIDE_SEARCH, M_LONG_PRESS_MENU
|
||||
}
|
||||
|
||||
public enum eHistoryAdapterCommands {
|
||||
M_ON_LOADING, M_LOADING_CLEAR, M_CLEAR_LONG_SELECTED_URL, GET_SELECTED_URL, GET_LONG_SELECTED_URL
|
||||
}
|
||||
|
||||
public enum eHistoryViewAdapterCommands {
|
||||
M_OPEN_MENU, M_CLEAR_LONG_SELECTED_VIEW, M_SELECT_VIEW, M_CLEAR_HIGHLIGHT
|
||||
}
|
||||
|
||||
}
|
|
@ -1,16 +1,11 @@
|
|||
package com.darkweb.genesissearchengine.appManager.historyManager;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Build;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.ActionMenuView;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageButton;
|
||||
|
@ -20,187 +15,190 @@ import androidx.appcompat.app.AppCompatActivity;
|
|||
import androidx.core.content.ContextCompat;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.darkweb.genesissearchengine.constants.strings;
|
||||
import com.darkweb.genesissearchengine.helperManager.helperMethod;
|
||||
import com.example.myapplication.R;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import static android.content.Context.LAYOUT_INFLATER_SERVICE;
|
||||
|
||||
class historyViewController
|
||||
{
|
||||
/*Private Variables*/
|
||||
private AppCompatActivity m_context;
|
||||
private AppCompatActivity mContext;
|
||||
|
||||
private ImageView m_empty_list;
|
||||
private EditText m_search;
|
||||
private RecyclerView m_listview;
|
||||
private Button m_clearButton;
|
||||
private ImageButton m_menu_button;
|
||||
private ImageButton m_search_button;
|
||||
private ImageView mEmptyListNotification;
|
||||
private EditText mSearchInput;
|
||||
private RecyclerView mRecycleView;
|
||||
private Button mClearButton;
|
||||
private ImageButton mMenuButton;
|
||||
private ImageButton mSearchButton;
|
||||
|
||||
private PopupWindow mPopupWindow = null;
|
||||
|
||||
/*Initializations*/
|
||||
|
||||
historyViewController(ImageView p_empty_list, EditText p_search, RecyclerView p_listview, Button p_clearButton,AppCompatActivity p_context,ImageButton p_menu_button,ImageButton p_search_button)
|
||||
historyViewController(ImageView pEmptyListNotification, EditText pSearchInput, RecyclerView pRecycleView, Button pClearButton,AppCompatActivity pContext,ImageButton pMenuButton,ImageButton pSearchButton)
|
||||
{
|
||||
this.m_empty_list = p_empty_list;
|
||||
this.m_search = p_search;
|
||||
this.m_listview = p_listview;
|
||||
this.m_clearButton = p_clearButton;
|
||||
this.m_context = p_context;
|
||||
this.m_menu_button = p_menu_button;
|
||||
this.m_search_button = p_search_button;
|
||||
this.mEmptyListNotification = pEmptyListNotification;
|
||||
this.mSearchInput = pSearchInput;
|
||||
this.mRecycleView = pRecycleView;
|
||||
this.mClearButton = pClearButton;
|
||||
this.mContext = pContext;
|
||||
this.mMenuButton = pMenuButton;
|
||||
this.mSearchButton = pSearchButton;
|
||||
|
||||
initPostUI();
|
||||
}
|
||||
|
||||
private void initPostUI(){
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
Window window = m_context.getWindow();
|
||||
Window window = mContext.getWindow();
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
||||
|
||||
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
|
||||
window.setStatusBarColor(m_context.getResources().getColor(R.color.blue_dark));
|
||||
window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark));
|
||||
}
|
||||
else {
|
||||
m_context.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);// set status text dark
|
||||
m_context.getWindow().setStatusBarColor(ContextCompat.getColor(m_context, R.color.white));
|
||||
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);// set status text dark
|
||||
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.white));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updateIfListEmpty(int size,int duration){
|
||||
if(size>0){
|
||||
m_empty_list.animate().setDuration(duration).alpha(0f);
|
||||
// m_clearButton.animate().setDuration(duration).alpha(1f);
|
||||
m_clearButton.setText("CLEAR HISTORY");
|
||||
m_clearButton.setClickable(true);
|
||||
private void updateIfListEmpty(int pSize,int pDuration){
|
||||
if(pSize>0){
|
||||
mClearButton.setTextColor(mContext.getApplication().getResources().getColor(R.color.blue));
|
||||
mEmptyListNotification.animate().setDuration(pDuration).alpha(0f);
|
||||
mClearButton.setText(strings.HISTORY_CLEAR_HISTORY);
|
||||
mClearButton.setClickable(true);
|
||||
}
|
||||
else {
|
||||
m_empty_list.animate().setDuration(duration).alpha(1f);
|
||||
// m_clearButton.animate().setDuration(duration).alpha(0f);
|
||||
m_clearButton.setText("NO HISTORY FOUND");
|
||||
m_clearButton.setClickable(false);
|
||||
mClearButton.setTextColor(mContext.getApplication().getResources().getColor(R.color.holo_dark_gray_alpha));
|
||||
mEmptyListNotification.animate().setDuration(pDuration).alpha(1f);
|
||||
|
||||
mClearButton.animate().setDuration(pDuration).alpha(0.4f);
|
||||
mSearchButton.animate().setDuration(pDuration).alpha(0f);
|
||||
mMenuButton.animate().setDuration(pDuration).alpha(0f);
|
||||
|
||||
mClearButton.setEnabled(false);
|
||||
mSearchButton.setClickable(false);
|
||||
mMenuButton.setClickable(false);
|
||||
|
||||
mClearButton.setText(strings.HISTORY_NO_HISTORY_FOUND);
|
||||
mClearButton.setClickable(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void onCloseMenu(){
|
||||
if(popupWindow!=null && popupWindow.isShowing()){
|
||||
popupWindow.dismiss();
|
||||
private void onCloseMenu(){
|
||||
if(mPopupWindow !=null && mPopupWindow.isShowing()){
|
||||
mPopupWindow.dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
private void onSelectionMenu(boolean p_status){
|
||||
if(!p_status){
|
||||
m_clearButton.setClickable(false);
|
||||
m_clearButton.setTextColor(m_context.getApplication().getResources().getColor(R.color.float_white));
|
||||
m_menu_button.setVisibility(View.VISIBLE);
|
||||
m_search_button.setVisibility(View.GONE);
|
||||
if (m_search.getVisibility() == View.VISIBLE){
|
||||
m_search.animate().cancel();
|
||||
m_search.animate().alpha(0).setDuration(150).withEndAction(() -> {
|
||||
m_search.getText().clear();
|
||||
m_search.setVisibility(View.GONE);
|
||||
});
|
||||
m_search.setClickable(false);
|
||||
private void onSelectionMenu(boolean pStatus){
|
||||
if(!pStatus){
|
||||
mClearButton.setClickable(false);
|
||||
mClearButton.animate().cancel();
|
||||
mClearButton.setTextColor(mContext.getApplication().getResources().getColor(R.color.holo_dark_gray_alpha));
|
||||
mClearButton.animate().setDuration(150).alpha(0.4f);
|
||||
mMenuButton.setVisibility(View.VISIBLE);
|
||||
mSearchButton.setVisibility(View.GONE);
|
||||
if (mSearchInput.getVisibility() == View.VISIBLE){
|
||||
onHideSearch();
|
||||
}
|
||||
}else {
|
||||
if (m_search.getVisibility() != View.VISIBLE) {
|
||||
m_clearButton.setClickable(true);
|
||||
m_clearButton.setTextColor(m_context.getApplication().getResources().getColor(R.color.blue));
|
||||
if (mSearchInput.getVisibility() != View.VISIBLE) {
|
||||
mClearButton.setClickable(true);
|
||||
mClearButton.setTextColor(mContext.getApplication().getResources().getColor(R.color.blue));
|
||||
mClearButton.animate().cancel();
|
||||
mClearButton.animate().setDuration(150).alpha(1);
|
||||
}
|
||||
m_menu_button.setVisibility(View.GONE);
|
||||
m_search_button.setVisibility(View.VISIBLE);
|
||||
mMenuButton.setVisibility(View.GONE);
|
||||
mSearchButton.setVisibility(View.VISIBLE);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void updateList(){
|
||||
int index = Objects.requireNonNull(m_listview.getAdapter()).getItemCount()-1;
|
||||
m_listview.getAdapter().notifyDataSetChanged();
|
||||
m_listview.scrollToPosition(index);
|
||||
int index = Objects.requireNonNull(mRecycleView.getAdapter()).getItemCount()-1;
|
||||
mRecycleView.getAdapter().notifyDataSetChanged();
|
||||
}
|
||||
|
||||
private void removeFromList(int index)
|
||||
private void removeFromList(int pIndex)
|
||||
{
|
||||
Objects.requireNonNull(m_listview.getAdapter()).notifyItemRemoved(index);
|
||||
m_listview.getAdapter().notifyItemRangeChanged(index, m_listview.getAdapter().getItemCount());
|
||||
Objects.requireNonNull(mRecycleView.getAdapter()).notifyItemRemoved(pIndex);
|
||||
mRecycleView.getAdapter().notifyItemRangeChanged(pIndex, mRecycleView.getAdapter().getItemCount());
|
||||
}
|
||||
|
||||
private void clearList(){
|
||||
Objects.requireNonNull(m_listview.getAdapter()).notifyDataSetChanged();
|
||||
updateIfListEmpty(m_listview.getAdapter().getItemCount(),300);
|
||||
m_search.clearFocus();
|
||||
m_search.setText(strings.EMPTY_STR);
|
||||
Objects.requireNonNull(mRecycleView.getAdapter()).notifyDataSetChanged();
|
||||
updateIfListEmpty(mRecycleView.getAdapter().getItemCount(),300);
|
||||
mSearchInput.clearFocus();
|
||||
mSearchInput.setText(strings.GENERIC_EMPTY_STR);
|
||||
}
|
||||
|
||||
public void onTrigger(historyEnums.eHistoryViewCommands p_commands, List<Object> p_data){
|
||||
if(p_commands == historyEnums.eHistoryViewCommands.M_UPDATE_LIST_IF_EMPTY){
|
||||
updateIfListEmpty((int)p_data.get(0), (int)p_data.get(1));
|
||||
}
|
||||
else if(p_commands == historyEnums.eHistoryViewCommands.M_UPDATE_LIST){
|
||||
updateList();
|
||||
}
|
||||
else if(p_commands == historyEnums.eHistoryViewCommands.M_REMOVE_FROM_LIST){
|
||||
removeFromList((int)p_data.get(0));
|
||||
}
|
||||
else if(p_commands == historyEnums.eHistoryViewCommands.M_CLEAR_LIST){
|
||||
clearList();
|
||||
}
|
||||
else if(p_commands == historyEnums.eHistoryViewCommands.M_VERTIFY_SELECTION_MENU){
|
||||
onSelectionMenu((boolean)p_data.get(0));
|
||||
}
|
||||
}
|
||||
|
||||
public boolean onHideSearch() {
|
||||
if(m_search.getVisibility() == View.VISIBLE){
|
||||
m_search.animate().cancel();
|
||||
m_search.animate().alpha(0).setDuration(150).withEndAction(() -> {
|
||||
m_search.setVisibility(View.GONE);
|
||||
m_search.setText(strings.EMPTY_STR);
|
||||
private boolean onHideSearch() {
|
||||
if(mSearchInput.getVisibility() == View.VISIBLE){
|
||||
mSearchInput.animate().cancel();
|
||||
mSearchInput.animate().alpha(0).setDuration(150).withEndAction(() -> {
|
||||
mSearchInput.getText().clear();
|
||||
mSearchInput.setVisibility(View.GONE);
|
||||
mSearchInput.setText(strings.GENERIC_EMPTY_STR);
|
||||
});
|
||||
m_search.setText(strings.EMPTY_STR);
|
||||
m_search.setClickable(false);
|
||||
m_clearButton.setClickable(true);
|
||||
m_clearButton.setTextColor(m_context.getApplication().getResources().getColor(R.color.blue));
|
||||
mSearchInput.setText(strings.GENERIC_EMPTY_STR);
|
||||
mSearchInput.setClickable(false);
|
||||
mClearButton.setClickable(true);
|
||||
mClearButton.setTextColor(mContext.getApplication().getResources().getColor(R.color.blue));
|
||||
mClearButton.animate().cancel();
|
||||
mClearButton.animate().setDuration(150).alpha(1f);
|
||||
return false;
|
||||
}else {
|
||||
m_search.animate().cancel();
|
||||
m_search.setAlpha(0f);
|
||||
m_search.animate().setDuration(150).alpha(1);
|
||||
m_search.setVisibility(View.VISIBLE);
|
||||
m_search.setClickable(true);
|
||||
m_clearButton.setClickable(false);
|
||||
m_clearButton.setTextColor(m_context.getApplication().getResources().getColor(R.color.float_white));
|
||||
m_search.requestFocus();
|
||||
InputMethodManager imm = (InputMethodManager) m_context.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
mSearchInput.animate().cancel();
|
||||
mSearchInput.setAlpha(0f);
|
||||
mSearchInput.animate().setDuration(150).alpha(1);
|
||||
mSearchInput.setVisibility(View.VISIBLE);
|
||||
mSearchInput.setClickable(true);
|
||||
mClearButton.setClickable(false);
|
||||
mSearchInput.requestFocus();
|
||||
mClearButton.setTextColor(mContext.getApplication().getResources().getColor(R.color.holo_dark_gray_alpha));
|
||||
mClearButton.animate().cancel();
|
||||
mClearButton.animate().setDuration(150).alpha(0.4f);
|
||||
InputMethodManager imm = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,0);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private PopupWindow popupWindow = null;
|
||||
public void onLongPressMenu(View view) {
|
||||
|
||||
if(popupWindow!=null){
|
||||
popupWindow.dismiss();
|
||||
}
|
||||
|
||||
LayoutInflater layoutInflater
|
||||
= (LayoutInflater) view.getContext()
|
||||
.getSystemService(LAYOUT_INFLATER_SERVICE);
|
||||
final View popupView = layoutInflater.inflate(R.layout.history_choose_popup_menu, null);
|
||||
|
||||
|
||||
popupWindow = new PopupWindow(
|
||||
popupView,
|
||||
ActionMenuView.LayoutParams.WRAP_CONTENT,
|
||||
ActionMenuView.LayoutParams.WRAP_CONTENT, true);
|
||||
|
||||
popupWindow.setOutsideTouchable(true);
|
||||
popupWindow.setFocusable(true);
|
||||
popupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
popupWindow.setAnimationStyle(R.style.popup_window_animation);
|
||||
popupWindow.showAtLocation(view, Gravity.TOP|Gravity.END,0,0);
|
||||
popupWindow.setElevation(7);
|
||||
private void onLongPressMenu(View pView) {
|
||||
mPopupWindow = helperMethod.onCreateMenu(pView, R.layout.recyclerview__menu);
|
||||
}
|
||||
|
||||
public Object onTrigger(historyEnums.eHistoryViewCommands pCommands, List<Object> pData){
|
||||
if(pCommands == historyEnums.eHistoryViewCommands.M_UPDATE_LIST_IF_EMPTY){
|
||||
updateIfListEmpty((int)pData.get(0), (int)pData.get(1));
|
||||
}
|
||||
else if(pCommands == historyEnums.eHistoryViewCommands.M_UPDATE_LIST){
|
||||
updateList();
|
||||
}
|
||||
else if(pCommands == historyEnums.eHistoryViewCommands.M_REMOVE_FROM_LIST){
|
||||
removeFromList((int)pData.get(0));
|
||||
}
|
||||
else if(pCommands == historyEnums.eHistoryViewCommands.M_CLEAR_LIST){
|
||||
clearList();
|
||||
}
|
||||
else if(pCommands == historyEnums.eHistoryViewCommands.M_VERTIFY_SELECTION_MENU){
|
||||
onSelectionMenu((boolean)pData.get(0));
|
||||
}
|
||||
else if(pCommands == historyEnums.eHistoryViewCommands.M_HIDE_SEARCH){
|
||||
return onHideSearch();
|
||||
}
|
||||
else if(pCommands == historyEnums.eHistoryViewCommands.M_CLOSE_MENU){
|
||||
onCloseMenu();
|
||||
}
|
||||
else if(pCommands == historyEnums.eHistoryViewCommands.M_LONG_PRESS_MENU){
|
||||
onLongPressMenu((View) pData.get(0));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,9 +19,6 @@ import org.mozilla.geckoview.GeckoRuntime;
|
|||
import org.mozilla.geckoview.GeckoSession;
|
||||
import org.mozilla.geckoview.GeckoView;
|
||||
|
||||
import mozilla.components.browser.engine.gecko.GeckoEngine;
|
||||
import mozilla.components.browser.icons.*;
|
||||
|
||||
|
||||
class geckoClients
|
||||
{
|
||||
|
@ -54,7 +51,7 @@ class geckoClients
|
|||
mSession.getSettings().setUseTrackingProtection(true);
|
||||
mSession.getSettings().setFullAccessibilityTree(true);
|
||||
mSession.getSettings().setUserAgentMode(USER_AGENT_MODE_MOBILE );
|
||||
mSession.getSettings().setAllowJavascript(status.sJavaStatus);
|
||||
mSession.getSettings().setAllowJavascript(status.sSettingJavaStatus);
|
||||
geckoView.releaseSession();
|
||||
geckoView.setSession(mSession);
|
||||
|
||||
|
@ -74,18 +71,18 @@ class geckoClients
|
|||
if(mRuntime==null){
|
||||
mRuntime = GeckoRuntime.getDefault(context);
|
||||
mRuntime.getSettings().getContentBlocking().setCookieBehavior(getCookiesBehaviour());
|
||||
mRuntime.getSettings().setAutomaticFontSizeAdjustment(status.sFontAdjustable);
|
||||
mRuntime.getSettings().setAutomaticFontSizeAdjustment(status.sSettingFontAdjustable);
|
||||
mRuntime.getSettings().getContentBlocking().setAntiTracking(ContentBlocking.AntiTracking.AD);
|
||||
mRuntime.getSettings().getContentBlocking().setAntiTracking(ContentBlocking.AntiTracking.FINGERPRINTING);
|
||||
}
|
||||
}
|
||||
|
||||
private int getCookiesBehaviour(){
|
||||
return status.sCookieStatus;
|
||||
return status.sSettingCookieStatus;
|
||||
}
|
||||
|
||||
void updateCookies(){
|
||||
mRuntime.getSettings().getContentBlocking().setCookieBehavior(status.sCookieStatus);
|
||||
mRuntime.getSettings().getContentBlocking().setCookieBehavior(status.sSettingCookieStatus);
|
||||
onReload();
|
||||
}
|
||||
|
||||
|
@ -102,8 +99,8 @@ class geckoClients
|
|||
}
|
||||
|
||||
void updateJavascript(){
|
||||
mSession.getSettings().setAllowJavascript(status.sJavaStatus);
|
||||
if(status.sJavaStatus){
|
||||
mSession.getSettings().setAllowJavascript(status.sSettingJavaStatus);
|
||||
if(status.sSettingJavaStatus){
|
||||
mSession.reload();
|
||||
}
|
||||
}
|
||||
|
@ -198,8 +195,8 @@ class geckoClients
|
|||
}
|
||||
|
||||
void onUpdateFont(){
|
||||
float font = (status.sFontSize -100)/4+100;
|
||||
mRuntime.getSettings().setAutomaticFontSizeAdjustment(status.sFontAdjustable);
|
||||
float font = (status.sSettingFontSize -100)/4+100;
|
||||
mRuntime.getSettings().setAutomaticFontSizeAdjustment(status.sSettingFontAdjustable);
|
||||
if(!mRuntime.getSettings().getAutomaticFontSizeAdjustment()){
|
||||
mRuntime.getSettings().setFontSizeFactor(font/100);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ import java.util.Arrays;
|
|||
class geckoDownloadManager
|
||||
{
|
||||
private Uri downloadURL;
|
||||
private String downloadFile = strings.EMPTY_STR;
|
||||
private String downloadFile = strings.GENERIC_EMPTY_STR;
|
||||
|
||||
geckoDownloadManager(){
|
||||
|
||||
|
|
|
@ -229,7 +229,7 @@ public class geckoSession extends GeckoSession implements GeckoSession.Permissio
|
|||
|
||||
@UiThread
|
||||
public void onTitleChange(@NonNull GeckoSession var1, @Nullable String var2) {
|
||||
if(var2!=null && !var2.equals(strings.EMPTY_STR) && var2.length()>2 && !var2.equals("about:blank")){
|
||||
if(var2!=null && !var2.equals(strings.GENERIC_EMPTY_STR) && var2.length()>2 && !var2.equals("about:blank")){
|
||||
mCurrentTitle = var2;
|
||||
m_current_url_id = (int)event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, m_current_url_id), enums.etype.on_update_history);
|
||||
}
|
||||
|
@ -243,7 +243,7 @@ public class geckoSession extends GeckoSession implements GeckoSession.Permissio
|
|||
|
||||
public void onContextMenu(@NonNull GeckoSession var1, int var2, int var3, @NonNull GeckoSession.ContentDelegate.ContextElement var4) {
|
||||
|
||||
String title = strings.EMPTY_STR;
|
||||
String title = strings.GENERIC_EMPTY_STR;
|
||||
if(var4.title!=null){
|
||||
title = var4.title;
|
||||
}
|
||||
|
|
|
@ -144,18 +144,18 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
|||
super.onNewIntent(intent);
|
||||
Uri data = intent.getData();
|
||||
if(data!=null){
|
||||
status.sRedirectStatus = data.toString();
|
||||
if(status.sIsAppStarted){
|
||||
onLoadURL(status.sRedirectStatus);
|
||||
status.sSettingRedirectStatus = data.toString();
|
||||
if(status.sSettingIsAppStarted){
|
||||
onLoadURL(status.sSettingRedirectStatus);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void initLandingPage(){
|
||||
if(status.sFirstStart){
|
||||
helperMethod.openActivity(landingController.class, constants.LIST_HISTORY, homeController.this,false);
|
||||
status.sFirstStart = false;
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.FIRST_INSTALLED,false));
|
||||
if(status.sSettingFirstStart){
|
||||
helperMethod.openActivity(landingController.class, constants.CONST_LIST_HISTORY, homeController.this,false);
|
||||
status.sSettingFirstStart = false;
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_FIRST_INSTALLED,false));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -171,7 +171,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
|||
|
||||
mProgressBar = findViewById(R.id.progressBar);
|
||||
mSplashScreen = findViewById(R.id.splashScreen);
|
||||
mSearchbar = findViewById(R.id.p_search);
|
||||
mSearchbar = findViewById(R.id.pSearchInput);
|
||||
mLoadingIcon = findViewById(R.id.imageView_loading_back);
|
||||
mLoadingText = findViewById(R.id.loadingText);
|
||||
mWebViewContainer = findViewById(R.id.webviewContainer);
|
||||
|
@ -186,7 +186,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
|||
mGeckoView.setSaveFromParentEnabled(false);
|
||||
|
||||
mGeckoClient = new geckoClients();
|
||||
boolean is_engine_switched = (boolean) dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.ENGINE_SWITCHED,false));
|
||||
boolean is_engine_switched = (boolean) dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_ENGINE_SWITCHED,false));
|
||||
|
||||
mHomeViewController.initialization(new homeViewCallback(),this,mNewTab, mWebViewContainer, mLoadingText, mProgressBar, mSearchbar, mSplashScreen, mLoadingIcon, mBannerAds,dataController.getInstance().getSuggestions(), mGatewaySplash, mTopBar, mGeckoView, mBackSplash,is_engine_switched, mConnectButton, mSwitchEngineBack);
|
||||
}
|
||||
|
@ -215,8 +215,8 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
|||
mHomeViewController.initTab(dataController.getInstance().getTotalTabs());
|
||||
}
|
||||
|
||||
public void initTab(){
|
||||
onNewTab(false);
|
||||
public void initTab(boolean isKeyboardOpened){
|
||||
onNewTab(isKeyboardOpened, false);
|
||||
mHomeViewController.initTab(dataController.getInstance().getTotalTabs());
|
||||
}
|
||||
|
||||
|
@ -237,8 +237,8 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
|||
|
||||
public void onLoadProxy(View view){
|
||||
if(pluginController.getInstance().isInitialized() && !mPageClosed){
|
||||
pluginController.getInstance().logEvent(strings.GATEWAY_OPENED);
|
||||
helperMethod.openActivity(orbotController.class, constants.LIST_HISTORY, homeController.this,true);
|
||||
pluginController.getInstance().logEvent(strings.EVENT_GATEWAY_OPENED);
|
||||
helperMethod.openActivity(orbotController.class, constants.CONST_LIST_HISTORY, homeController.this,true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -316,7 +316,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
|||
final Handler handler = new Handler();
|
||||
handler.postDelayed(() ->
|
||||
{
|
||||
pluginController.getInstance().logEvent(strings.SEARCH_INVOKED);
|
||||
pluginController.getInstance().logEvent(strings.EVENT_SEARCH_INVOKED);
|
||||
onSearchBarInvoked(v);
|
||||
mGeckoView.clearFocus();
|
||||
}, 500);
|
||||
|
@ -337,7 +337,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
|||
if(hasFocus)
|
||||
{
|
||||
helperMethod.hideKeyboard(homeController.this);
|
||||
status.sIsAppStarted = true;
|
||||
status.sSettingIsAppStarted = true;
|
||||
pluginController.getInstance().onResetMessage();
|
||||
mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(),false);
|
||||
}
|
||||
|
@ -371,7 +371,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
|||
mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(),true);
|
||||
}
|
||||
});
|
||||
pluginController.getInstance().logEvent(strings.APP_STARTED);
|
||||
pluginController.getInstance().logEvent(strings.EVENT_APP_STARTED);
|
||||
|
||||
KeyboardUtils.addKeyboardToggleListener(this, isVisible -> isKeyboardOpened = isVisible);
|
||||
}
|
||||
|
@ -394,22 +394,22 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
|||
}
|
||||
|
||||
public void onHomeButton(View view){
|
||||
pluginController.getInstance().logEvent(strings.HOME_INVOKED);
|
||||
pluginController.getInstance().logEvent(strings.EVENT_HOME_INVOKED);
|
||||
onLoadURL(mHomeModel.getSearchEngine());
|
||||
mHomeViewController.onUpdateLogo();
|
||||
}
|
||||
|
||||
public void onNewTab(boolean isKeyboardOpenedTemp){
|
||||
public void onNewTab(boolean isKeyboardOpenedTemp, boolean isKeyboardOpened){
|
||||
initializeGeckoView(true);
|
||||
onLoadURL("about:blank");
|
||||
mHomeViewController.progressBarReset();
|
||||
mHomeViewController.onNewTab(true,isKeyboardOpenedTemp);
|
||||
mHomeViewController.onNewTab(isKeyboardOpened,isKeyboardOpenedTemp);
|
||||
mHomeViewController.onSessionChanged();
|
||||
}
|
||||
|
||||
public void onOpenTabViewBoundary(View view){
|
||||
mNewTab.setPressed(true);
|
||||
helperMethod.openActivity(tabController.class, constants.LIST_HISTORY, homeController.this,true);
|
||||
helperMethod.openActivity(tabController.class, constants.CONST_LIST_HISTORY, homeController.this,true);
|
||||
}
|
||||
|
||||
public void onNotificationInvoked(String message,enums.etype e_type){
|
||||
|
@ -418,8 +418,8 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
|||
|
||||
public void onOpenMenuItem(View view){
|
||||
pluginController.getInstance().setLanguage(this);
|
||||
pluginController.getInstance().logEvent(strings.MENU_INVOKED);
|
||||
status.sIsAppStarted = true;
|
||||
pluginController.getInstance().logEvent(strings.EVENT_MENU_INVOKED);
|
||||
status.sSettingIsAppStarted = true;
|
||||
pluginController.getInstance().onResetMessage();
|
||||
initLocalLanguage();
|
||||
pluginController.getInstance().onCreate(this);
|
||||
|
@ -430,7 +430,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
|||
|
||||
@Override
|
||||
public void onBackPressed(){
|
||||
pluginController.getInstance().logEvent(strings.ON_BACK);
|
||||
pluginController.getInstance().logEvent(strings.EVENT_ON_BACK);
|
||||
mSearchbar.clearFocus();
|
||||
if(mGeckoClient.getFullScreenStatus()){
|
||||
mGeckoClient.onBackPressed(true);
|
||||
|
@ -442,40 +442,40 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
|||
}
|
||||
|
||||
public void onSwitchSearch(View view){
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.ENGINE_SWITCHED,true));
|
||||
pluginController.getInstance().logEvent(strings.SEARCH_SWITCH);
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_ENGINE_SWITCHED,true));
|
||||
pluginController.getInstance().logEvent(strings.EVENT_SEARCH_SWITCH);
|
||||
|
||||
if(status.sSearchStatus.equals(constants.BACKEND_GOOGLE_URL))
|
||||
if(status.sSettingSearchStatus.equals(constants.CONST_BACKEND_GOOGLE_URL))
|
||||
{
|
||||
status.sSearchStatus = constants.BACKEND_GENESIS_URL;
|
||||
status.sSettingSearchStatus = constants.CONST_BACKEND_GENESIS_URL;
|
||||
mHomeViewController.onUpdateLogo();
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SEARCH_ENGINE,constants.BACKEND_GENESIS_URL));
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_SEARCH_ENGINE,constants.CONST_BACKEND_GENESIS_URL));
|
||||
onHomeButton(null);
|
||||
}
|
||||
else if(status.sSearchStatus.equals(constants.BACKEND_GENESIS_URL))
|
||||
else if(status.sSettingSearchStatus.equals(constants.CONST_BACKEND_GENESIS_URL))
|
||||
{
|
||||
status.sSearchStatus = constants.BACKEND_DUCK_DUCK_GO_URL;
|
||||
status.sSettingSearchStatus = constants.CONST_BACKEND_DUCK_DUCK_GO_URL;
|
||||
if(pluginController.getInstance().isOrbotRunning())
|
||||
{
|
||||
mHomeViewController.onUpdateLogo();
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SEARCH_ENGINE,constants.BACKEND_DUCK_DUCK_GO_URL));
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_SEARCH_ENGINE,constants.CONST_BACKEND_DUCK_DUCK_GO_URL));
|
||||
onHomeButton(null);
|
||||
}
|
||||
else {
|
||||
pluginController.getInstance().MessageManagerHandler(homeController.this, Collections.singletonList(constants.BACKEND_DUCK_DUCK_GO_URL),enums.etype.start_orbot);
|
||||
pluginController.getInstance().MessageManagerHandler(homeController.this, Collections.singletonList(constants.CONST_BACKEND_DUCK_DUCK_GO_URL),enums.etype.start_orbot);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
status.sSearchStatus = constants.BACKEND_GOOGLE_URL;
|
||||
status.sSettingSearchStatus = constants.CONST_BACKEND_GOOGLE_URL;
|
||||
if(pluginController.getInstance().isOrbotRunning())
|
||||
{
|
||||
mHomeViewController.onUpdateLogo();
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SEARCH_ENGINE,constants.BACKEND_GOOGLE_URL));
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_SEARCH_ENGINE,constants.CONST_BACKEND_GOOGLE_URL));
|
||||
onHomeButton(null);
|
||||
}
|
||||
else {
|
||||
pluginController.getInstance().MessageManagerHandler(homeController.this,Collections.singletonList(constants.BACKEND_GOOGLE_URL),enums.etype.start_orbot);
|
||||
pluginController.getInstance().MessageManagerHandler(homeController.this,Collections.singletonList(constants.CONST_BACKEND_GOOGLE_URL),enums.etype.start_orbot);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -584,7 +584,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
|||
|
||||
Callable<String> callable = () -> {
|
||||
mHomeViewController.onUpdateLogs(pluginController.getInstance().orbotLogs());
|
||||
return strings.EMPTY_STR;
|
||||
return strings.GENERIC_EMPTY_STR;
|
||||
};
|
||||
|
||||
mHomeViewController.initProxyLoading(callable);
|
||||
|
@ -645,72 +645,86 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
|||
public void onMenuItemInvoked(View view){
|
||||
int menuId = view.getId();
|
||||
if (menuId == R.id.menu11) {
|
||||
onNewTab(isKeyboardOpened);
|
||||
onNewTab(true, isKeyboardOpened);
|
||||
}
|
||||
else if (menuId == R.id.menu10) {
|
||||
if(!onCloseCurrentTab(mGeckoClient.getSession())){
|
||||
onNewTab(isKeyboardOpened);
|
||||
onNewTab(true, isKeyboardOpened);
|
||||
}
|
||||
}
|
||||
else {
|
||||
helperMethod.hideKeyboard(this);
|
||||
mSearchbar.clearFocus();
|
||||
if (menuId == R.id.menu9) {
|
||||
helperMethod.openActivity(tabController.class, constants.LIST_HISTORY, homeController.this,true);
|
||||
helperMethod.hideKeyboard(this);
|
||||
helperMethod.openActivity(tabController.class, constants.CONST_LIST_HISTORY, homeController.this,true);
|
||||
}
|
||||
else if (menuId == R.id.menu8) {
|
||||
helperMethod.hideKeyboard(this);
|
||||
onOpenDownloadFolder(null);
|
||||
}
|
||||
else if (menuId == R.id.menu7) {
|
||||
helperMethod.openActivity(historyController.class, constants.LIST_HISTORY, homeController.this,true);
|
||||
helperMethod.hideKeyboard(this);
|
||||
helperMethod.openActivity(historyController.class, constants.CONST_LIST_HISTORY, homeController.this,true);
|
||||
}
|
||||
else if (menuId == R.id.menu6)
|
||||
{
|
||||
helperMethod.openActivity(settingController.class,constants.LIST_HISTORY, homeController.this,true);
|
||||
helperMethod.hideKeyboard(this);
|
||||
helperMethod.openActivity(settingController.class,constants.CONST_LIST_HISTORY, homeController.this,true);
|
||||
}
|
||||
else if (menuId == R.id.menu5)
|
||||
else if (menuId == R.id.pMenuDelete)
|
||||
{
|
||||
pluginController.getInstance().MessageManagerHandler(homeController.this, Collections.singletonList(mGeckoClient.getSession().getCurrentURL()),enums.etype.bookmark);
|
||||
}
|
||||
else if (menuId == R.id.menu4)
|
||||
else if (menuId == R.id.pMenuOpenNewTab)
|
||||
{
|
||||
helperMethod.openActivity(bookmarkController.class,constants.LIST_BOOKMARK, homeController.this,true);
|
||||
helperMethod.hideKeyboard(this);
|
||||
helperMethod.openActivity(bookmarkController.class,constants.CONST_LIST_BOOKMARK, homeController.this,true);
|
||||
}
|
||||
else if (menuId == R.id.menu3)
|
||||
else if (menuId == R.id.pMenuOpenCurrentTab)
|
||||
{
|
||||
helperMethod.hideKeyboard(this);
|
||||
pluginController.getInstance().MessageManagerHandler(homeController.this,null,enums.etype.report_url);
|
||||
}
|
||||
else if (menuId == R.id.menu2)
|
||||
else if (menuId == R.id.pMenuShare)
|
||||
{
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.IS_APP_RATED,true));
|
||||
status.sIsAppRated = true;
|
||||
pluginController.getInstance().MessageManagerHandler(activityContextManager.getInstance().getHomeController(), Collections.singletonList(strings.EMPTY_STR), enums.etype.rate_app);
|
||||
helperMethod.hideKeyboard(this);
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.PROXY_IS_APP_RATED,true));
|
||||
status.sSettingIsAppRated = true;
|
||||
pluginController.getInstance().MessageManagerHandler(activityContextManager.getInstance().getHomeController(), Collections.singletonList(strings.GENERIC_EMPTY_STR), enums.etype.rate_app);
|
||||
}
|
||||
else if (menuId == R.id.menu1)
|
||||
else if (menuId == R.id.pMenuCopy)
|
||||
{
|
||||
helperMethod.hideKeyboard(this);
|
||||
helperMethod.shareApp(homeController.this);
|
||||
}
|
||||
if (menuId == R.id.menu20) {
|
||||
helperMethod.hideKeyboard(this);
|
||||
mGeckoClient.onStop();
|
||||
}
|
||||
if (menuId == R.id.menu21) {
|
||||
helperMethod.hideKeyboard(this);
|
||||
mGeckoClient.onReload();
|
||||
}
|
||||
if (menuId == R.id.menu22) {
|
||||
helperMethod.hideKeyboard(this);
|
||||
mGeckoClient.onForwardPressed();
|
||||
}
|
||||
if (menuId == R.id.menu23) {
|
||||
helperMethod.hideKeyboard(this);
|
||||
mGeckoClient.onBackPressed(false);
|
||||
}
|
||||
if (menuId == R.id.menu24) {
|
||||
helperMethod.hideKeyboard(this);
|
||||
onHomeButton(view);
|
||||
}
|
||||
if (menuId == R.id.menu26 || menuId == R.id.menu27 || menuId == R.id.menu28) {
|
||||
helperMethod.hideKeyboard(this);
|
||||
mGeckoClient.toogleUserAgent();
|
||||
mGeckoClient.onReload();
|
||||
}
|
||||
if(menuId == R.id.menu25){
|
||||
helperMethod.openActivity(languageController.class, constants.LIST_HISTORY, homeController.this,true);
|
||||
helperMethod.hideKeyboard(this);
|
||||
helperMethod.openActivity(languageController.class, constants.CONST_LIST_HISTORY, homeController.this,true);
|
||||
}
|
||||
}
|
||||
mHomeViewController.closeMenu();
|
||||
|
@ -751,7 +765,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
|||
|
||||
String dataToStr(Object data){
|
||||
if(data==null){
|
||||
return strings.EMPTY_STR;
|
||||
return strings.GENERIC_EMPTY_STR;
|
||||
}
|
||||
else {
|
||||
return data.toString();
|
||||
|
@ -773,7 +787,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
|||
else if(e_type.equals(enums.etype.back_list_empty)){
|
||||
if(dataController.getInstance().getTotalTabs()>1){
|
||||
if(!onCloseCurrentTab(mGeckoClient.getSession())){
|
||||
onNewTab(false);
|
||||
onNewTab(true,false);
|
||||
}
|
||||
}else {
|
||||
helperMethod.onMinimizeApp(homeController.this);
|
||||
|
@ -789,17 +803,17 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
|||
dataController.getInstance().addSuggesion(data.get(0).toString(),data.get(2).toString());
|
||||
}
|
||||
else if(e_type.equals(enums.etype.on_page_loaded)){
|
||||
pluginController.getInstance().logEvent(strings.PAGE_OPENED_SUCCESS);
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.IS_BOOTSTRAPPED,true));
|
||||
pluginController.getInstance().logEvent(strings.EVENT_PAGE_OPENED_SUCCESS);
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_IS_BOOTSTRAPPED,true));
|
||||
mHomeViewController.onPageFinished();
|
||||
if(status.sIsWelcomeEnabled && !status.sIsAppStarted){
|
||||
if(status.sSettingIsWelcomeEnabled && !status.sSettingIsAppStarted){
|
||||
final Handler handler = new Handler();
|
||||
Runnable runnable = () ->
|
||||
{
|
||||
if(!status.sIsAppStarted){
|
||||
pluginController.getInstance().MessageManagerHandler(activityContextManager.getInstance().getHomeController(), Collections.singletonList(strings.EMPTY_STR), enums.etype.welcome);
|
||||
if(!status.sSettingIsAppStarted){
|
||||
pluginController.getInstance().MessageManagerHandler(activityContextManager.getInstance().getHomeController(), Collections.singletonList(strings.GENERIC_EMPTY_STR), enums.etype.welcome);
|
||||
}
|
||||
status.sIsAppStarted = true;
|
||||
status.sSettingIsAppStarted = true;
|
||||
};
|
||||
handler.postDelayed(runnable, 1300);
|
||||
}else {
|
||||
|
@ -812,10 +826,10 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
|||
}
|
||||
}
|
||||
else if(e_type.equals(enums.etype.rate_application)){
|
||||
if(!status.sIsAppRated){
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.IS_APP_RATED,true));
|
||||
status.sIsAppRated = true;
|
||||
pluginController.getInstance().MessageManagerHandler(activityContextManager.getInstance().getHomeController(), Collections.singletonList(strings.EMPTY_STR), enums.etype.rate_app);
|
||||
if(!status.sSettingIsAppRated){
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.PROXY_IS_APP_RATED,true));
|
||||
status.sSettingIsAppRated = true;
|
||||
pluginController.getInstance().MessageManagerHandler(activityContextManager.getInstance().getHomeController(), Collections.singletonList(strings.GENERIC_EMPTY_STR), enums.etype.rate_app);
|
||||
}
|
||||
}
|
||||
else if(e_type.equals(enums.etype.on_load_error)){
|
||||
|
@ -852,7 +866,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
|||
}
|
||||
else if(e_type.equals(enums.etype.on_close_sesson)){
|
||||
if(!onCloseCurrentTab(mGeckoClient.getSession())){
|
||||
onNewTab(false);
|
||||
onNewTab(true,false);
|
||||
}
|
||||
}
|
||||
else if(e_type.equals(enums.etype.on_playstore_load)){
|
||||
|
|
|
@ -12,7 +12,7 @@ class homeModel
|
|||
{
|
||||
|
||||
String getSearchEngine(){
|
||||
return status.sSearchStatus;
|
||||
return status.sSettingSearchStatus;
|
||||
}
|
||||
|
||||
String urlComplete(String url){
|
||||
|
@ -31,10 +31,10 @@ class homeModel
|
|||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
if(status.sSearchStatus.equals(constants.BACKEND_GOOGLE_URL)){
|
||||
if(status.sSettingSearchStatus.equals(constants.CONST_BACKEND_GOOGLE_URL)){
|
||||
return getSearchEngine()+"search?q="+url.replaceAll(" ","+");
|
||||
}
|
||||
else if(status.sSearchStatus.equals(constants.BACKEND_GENESIS_URL)){
|
||||
else if(status.sSettingSearchStatus.equals(constants.CONST_BACKEND_GENESIS_URL)){
|
||||
return getSearchEngine()+"/search?s_type=all&p_num=1&q="+url.replaceAll(" ","+");
|
||||
}
|
||||
else{
|
||||
|
|
|
@ -2,7 +2,6 @@ package com.darkweb.genesissearchengine.appManager.homeManager;
|
|||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.LayoutTransition;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.annotation.SuppressLint;
|
||||
|
@ -15,9 +14,6 @@ import android.graphics.drawable.Drawable;
|
|||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.transition.Explode;
|
||||
import android.util.Log;
|
||||
import android.util.TypedValue;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
@ -25,9 +21,7 @@ import android.view.ViewGroup;
|
|||
import android.view.ViewOutlineProvider;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.view.animation.Animation;
|
||||
import android.view.animation.DecelerateInterpolator;
|
||||
import android.view.animation.ScaleAnimation;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.*;
|
||||
|
@ -117,7 +111,7 @@ class homeViewController
|
|||
}
|
||||
|
||||
void initTab(int count){
|
||||
mNewTab.setText(count+strings.EMPTY_STR);
|
||||
mNewTab.setText(count+strings.GENERIC_EMPTY_STR);
|
||||
|
||||
YoYo.with(Techniques.FlipInX)
|
||||
.duration(450)
|
||||
|
@ -217,7 +211,7 @@ class homeViewController
|
|||
Drawable drawable;
|
||||
Resources res = mContext.getResources();
|
||||
try {
|
||||
drawable = Drawable.createFromXml(res, res.getXml(R.xml.sc_rounded_corner_suggestion));
|
||||
drawable = Drawable.createFromXml(res, res.getXml(R.xml.hox_rounded_corner_suggestion));
|
||||
mSearchbar.setDropDownBackgroundDrawable(drawable);
|
||||
mSearchbar.setOutlineProvider(ViewOutlineProvider.BACKGROUND);
|
||||
mSearchbar.setClipToOutline(true);
|
||||
|
@ -272,18 +266,18 @@ class homeViewController
|
|||
try
|
||||
{
|
||||
sleep(1000);
|
||||
mEvent.invokeObserver(Collections.singletonList(status.sSearchStatus), enums.etype.recheck_orbot);
|
||||
mEvent.invokeObserver(Collections.singletonList(status.sSettingSearchStatus), enums.etype.recheck_orbot);
|
||||
if(temp_context.isDestroyed()){
|
||||
return;
|
||||
}
|
||||
startPostTask(messages.UPDATE_LOADING_TEXT);
|
||||
startPostTask(messages.MESSAGE_UPDATE_LOADING_TEXT);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
startPostTask(messages.ON_URL_LOAD);
|
||||
startPostTask(messages.MESSAGE_ON_URL_LOAD);
|
||||
}
|
||||
}.start();
|
||||
}
|
||||
|
@ -406,7 +400,7 @@ class homeViewController
|
|||
Button btn = popupView.findViewById(R.id.notification_event);
|
||||
btn.setOnClickListener(v ->
|
||||
{
|
||||
mEvent.invokeObserver(Collections.singletonList(status.sSearchStatus), e_type);
|
||||
mEvent.invokeObserver(Collections.singletonList(status.sSettingSearchStatus), e_type);
|
||||
popupWindow.dismiss();
|
||||
});
|
||||
|
||||
|
@ -508,7 +502,7 @@ class homeViewController
|
|||
}
|
||||
|
||||
void onNewTab(boolean keyboard,boolean isKeyboardOpen){
|
||||
onUpdateSearchBar(strings.BLANK_PAGE,false);
|
||||
onUpdateSearchBar(strings.HOME_BLANK_PAGE,false);
|
||||
if(keyboard){
|
||||
|
||||
if(!isKeyboardOpen){
|
||||
|
@ -645,7 +639,7 @@ class homeViewController
|
|||
|
||||
void onUpdateLogo(){
|
||||
|
||||
switch (status.sSearchStatus)
|
||||
switch (status.sSettingSearchStatus)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -665,15 +659,15 @@ class homeViewController
|
|||
@Override
|
||||
public void handleMessage(Message msg)
|
||||
{
|
||||
if(msg.what == messages.ON_URL_LOAD)
|
||||
if(msg.what == messages.MESSAGE_ON_URL_LOAD)
|
||||
{
|
||||
if(status.sRedirectStatus.equals(strings.EMPTY_STR)){
|
||||
mEvent.invokeObserver(Collections.singletonList(status.sSearchStatus), enums.etype.on_url_load);
|
||||
if(status.sSettingRedirectStatus.equals(strings.GENERIC_EMPTY_STR)){
|
||||
mEvent.invokeObserver(Collections.singletonList(status.sSettingSearchStatus), enums.etype.on_url_load);
|
||||
}else {
|
||||
mEvent.invokeObserver(Collections.singletonList(status.sRedirectStatus), enums.etype.on_url_load);
|
||||
mEvent.invokeObserver(Collections.singletonList(status.sSettingRedirectStatus), enums.etype.on_url_load);
|
||||
}
|
||||
}
|
||||
if(msg.what == messages.UPDATE_LOADING_TEXT)
|
||||
if(msg.what == messages.MESSAGE_UPDATE_LOADING_TEXT)
|
||||
{
|
||||
if(mLogs !=null)
|
||||
{
|
||||
|
|
|
@ -56,14 +56,14 @@ public class languageController extends AppCompatActivity {
|
|||
}
|
||||
|
||||
public void changeLanguage(Locale language){
|
||||
status.sLanguage = language.getLanguage();
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.LANGUAGE,language.getLanguage()));
|
||||
status.sSettingLanguage = language.getLanguage();
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_LANGUAGE,language.getLanguage()));
|
||||
pluginController.getInstance().setLanguage(this);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------CALLBACKS-------------------------------------------------------*/
|
||||
|
||||
public void onNavigationBackPressed(View view) {
|
||||
public void onClose(View view) {
|
||||
finish();
|
||||
}
|
||||
|
||||
|
@ -72,22 +72,22 @@ public class languageController extends AppCompatActivity {
|
|||
if (menuId == R.id.langEnglish) {
|
||||
changeLanguage(Locale.ENGLISH);
|
||||
}
|
||||
else if (menuId == R.id.langGerman) {
|
||||
else if (menuId == R.id.pLangGerman) {
|
||||
changeLanguage(new Locale("de"));
|
||||
}
|
||||
else if (menuId == R.id.langItalian) {
|
||||
else if (menuId == R.id.pLangItalian) {
|
||||
changeLanguage(new Locale("it"));
|
||||
}
|
||||
else if (menuId == R.id.langPorteguse) {
|
||||
else if (menuId == R.id.pLangPorteguse) {
|
||||
changeLanguage(new Locale("pt"));
|
||||
}
|
||||
else if (menuId == R.id.langRussian) {
|
||||
else if (menuId == R.id.pLangRussian) {
|
||||
changeLanguage(new Locale("ru"));
|
||||
}
|
||||
else if (menuId == R.id.langUkarian) {
|
||||
else if (menuId == R.id.pLangUkarian) {
|
||||
changeLanguage(new Locale("uk"));
|
||||
}
|
||||
else if (menuId == R.id.langChinese) {
|
||||
else if (menuId == R.id.pLangChinese) {
|
||||
changeLanguage(new Locale("zh"));
|
||||
}
|
||||
finish();
|
||||
|
|
|
@ -23,10 +23,10 @@ public class orbotController extends AppCompatActivity {
|
|||
|
||||
/* PRIVATE VARIABLES */
|
||||
|
||||
private SwitchMaterial m_bridge_switch;
|
||||
private SwitchMaterial m_vpn_switch;
|
||||
private orbotViewController m_orbot_view_controller;
|
||||
private LinearLayout m_customizable_bridge_menu;
|
||||
private SwitchMaterial mBridgeSwitch;
|
||||
private SwitchMaterial mVpnSwitch;
|
||||
private orbotViewController mOrbotViewController;
|
||||
private LinearLayout mCustomizableBridgeMenu;
|
||||
|
||||
/* INITIALIZATIONS */
|
||||
|
||||
|
@ -40,32 +40,32 @@ public class orbotController extends AppCompatActivity {
|
|||
}
|
||||
|
||||
public void viewsInitializations() {
|
||||
m_bridge_switch = findViewById(R.id.p_bridge_switch);
|
||||
m_vpn_switch = findViewById(R.id.p_vpn_switch);
|
||||
m_customizable_bridge_menu = findViewById(R.id.p_customizable_bridge_menu);
|
||||
mBridgeSwitch = findViewById(R.id.pBridgeSwitch);
|
||||
mVpnSwitch = findViewById(R.id.pVpnSwitch);
|
||||
mCustomizableBridgeMenu = findViewById(R.id.pCustomizableBridgeMenu);
|
||||
|
||||
m_orbot_view_controller = new orbotViewController(m_bridge_switch,m_vpn_switch, this, m_customizable_bridge_menu);
|
||||
m_orbot_view_controller.onTrigger(orbotEnums.eOrbotViewCommands.M_INIT_UI, Arrays.asList(status.sVPNStatus,status.sBridgeStatus));
|
||||
mOrbotViewController = new orbotViewController(mBridgeSwitch, mVpnSwitch, this, mCustomizableBridgeMenu);
|
||||
mOrbotViewController.onTrigger(orbotEnums.eOrbotViewCommands.S_INIT_UI, Arrays.asList(status.sBridgeVPNStatus,status.sBridgeStatus));
|
||||
}
|
||||
// status.sGatewayAuto || status.sGatewayManual
|
||||
|
||||
/* LISTENERS */
|
||||
|
||||
public void onBridgeSwitch(View view){
|
||||
status.sBridgeStatus = !m_bridge_switch.isChecked();
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.S_BRIDGE_ENABLES,status.sBridgeStatus));
|
||||
status.sBridgeStatus = !mBridgeSwitch.isChecked();
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.BRIDGE_BRIDGE_ENABLES,status.sBridgeStatus));
|
||||
pluginController.getInstance().updateBridges(status.sBridgeStatus);
|
||||
m_orbot_view_controller.onTrigger(orbotEnums.eOrbotViewCommands.M_UPDATE_BRIDGE_SETTINGS_VIEWS, Collections.singletonList(status.sBridgeStatus));
|
||||
mOrbotViewController.onTrigger(orbotEnums.eOrbotViewCommands.S_UPDATE_BRIDGE_SETTINGS_VIEWS, Collections.singletonList(status.sBridgeStatus));
|
||||
}
|
||||
|
||||
public void openBridgeSettings(View view){
|
||||
helperMethod.openActivity(bridgeController.class, constants.LIST_HISTORY, orbotController.this, true);
|
||||
helperMethod.openActivity(bridgeController.class, constants.CONST_LIST_HISTORY, orbotController.this, true);
|
||||
}
|
||||
|
||||
public void onVPNSwitch(View view){
|
||||
status.sVPNStatus = !m_vpn_switch.isChecked();
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.S_VPN_ENABLED,status.sVPNStatus));
|
||||
m_orbot_view_controller.updateVPN(status.sVPNStatus);
|
||||
pluginController.getInstance().updateVPN(status.sVPNStatus);
|
||||
status.sBridgeVPNStatus = !mVpnSwitch.isChecked();
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.BRIDGE_VPN_ENABLED,status.sBridgeVPNStatus));
|
||||
mOrbotViewController.updateVPN(status.sBridgeVPNStatus);
|
||||
pluginController.getInstance().updateVPN(status.sBridgeVPNStatus);
|
||||
}
|
||||
|
||||
/* LOCAL OVERRIDES */
|
||||
|
@ -74,7 +74,7 @@ public class orbotController extends AppCompatActivity {
|
|||
public void onResume()
|
||||
{
|
||||
activityContextManager.getInstance().setCurrentActivity(this);
|
||||
m_orbot_view_controller.onTrigger(orbotEnums.eOrbotViewCommands.M_INIT_POST_UI,null);
|
||||
mOrbotViewController.onTrigger(orbotEnums.eOrbotViewCommands.S_INIT_POST_UI,null);
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,6 @@ public class orbotEnums
|
|||
{
|
||||
/*Settings Manager*/
|
||||
public enum eOrbotViewCommands {
|
||||
M_UPDATE_BRIDGE_SETTINGS_VIEWS, M_INIT_POST_UI, M_INIT_UI
|
||||
S_UPDATE_BRIDGE_SETTINGS_VIEWS, S_INIT_POST_UI, S_INIT_UI
|
||||
}
|
||||
}
|
|
@ -15,34 +15,34 @@ class orbotViewController
|
|||
{
|
||||
/*Private Variables*/
|
||||
|
||||
private AppCompatActivity m_context;
|
||||
private SwitchMaterial m_bridge_switch;
|
||||
private SwitchMaterial m_vpn_switch;
|
||||
private LinearLayout m_customizable_bridge_menu;
|
||||
private AppCompatActivity mContext;
|
||||
private SwitchMaterial mBridgeSwitch;
|
||||
private SwitchMaterial mVpnSwitch;
|
||||
private LinearLayout mCustomizableBridgeMenu;
|
||||
|
||||
/*Initializations*/
|
||||
|
||||
orbotViewController(SwitchMaterial p_bridge_switch, SwitchMaterial p_vpn_switch, AppCompatActivity p_context, LinearLayout p_customizable_bridge_menu)
|
||||
orbotViewController(SwitchMaterial pBridgeSwitch, SwitchMaterial pVpnSwitch, AppCompatActivity pContext, LinearLayout pCustomizableBridgeMenu)
|
||||
{
|
||||
this.m_context = p_context;
|
||||
this.m_bridge_switch = p_bridge_switch;
|
||||
this.m_customizable_bridge_menu = p_customizable_bridge_menu;
|
||||
this.m_vpn_switch = p_vpn_switch;
|
||||
this.mContext = pContext;
|
||||
this.mBridgeSwitch = pBridgeSwitch;
|
||||
this.mCustomizableBridgeMenu = pCustomizableBridgeMenu;
|
||||
this.mVpnSwitch = pVpnSwitch;
|
||||
|
||||
initPostUI();
|
||||
}
|
||||
|
||||
private void initPostUI(){
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
Window window = m_context.getWindow();
|
||||
Window window = mContext.getWindow();
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
||||
|
||||
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
|
||||
window.setStatusBarColor(m_context.getResources().getColor(R.color.blue_dark));
|
||||
window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark));
|
||||
}
|
||||
else {
|
||||
m_context.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);// set status text dark
|
||||
m_context.getWindow().setStatusBarColor(ContextCompat.getColor(m_context, R.color.white));
|
||||
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);// set status text dark
|
||||
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.white));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -52,27 +52,27 @@ class orbotViewController
|
|||
}
|
||||
|
||||
public void updateVPN(boolean p_status){
|
||||
m_vpn_switch.setChecked(p_status);
|
||||
mVpnSwitch.setChecked(p_status);
|
||||
}
|
||||
|
||||
public void updateBridgeViews(boolean p_status,boolean p_is_invoked){
|
||||
m_bridge_switch.setChecked(p_status);
|
||||
mBridgeSwitch.setChecked(p_status);
|
||||
if(p_status){
|
||||
m_customizable_bridge_menu.setClickable(true);
|
||||
m_customizable_bridge_menu.setAlpha(0);
|
||||
m_customizable_bridge_menu.setVisibility(View.VISIBLE);
|
||||
mCustomizableBridgeMenu.setClickable(true);
|
||||
mCustomizableBridgeMenu.setAlpha(0);
|
||||
mCustomizableBridgeMenu.setVisibility(View.VISIBLE);
|
||||
if(p_is_invoked){
|
||||
m_customizable_bridge_menu.animate().alpha(1);
|
||||
mCustomizableBridgeMenu.animate().alpha(1);
|
||||
}else {
|
||||
m_customizable_bridge_menu.setAlpha(1);
|
||||
mCustomizableBridgeMenu.setAlpha(1);
|
||||
}
|
||||
}else {
|
||||
m_customizable_bridge_menu.setClickable(false);
|
||||
mCustomizableBridgeMenu.setClickable(false);
|
||||
if(p_is_invoked){
|
||||
m_customizable_bridge_menu.animate().alpha(0).withEndAction(() -> m_customizable_bridge_menu.setVisibility(View.GONE));
|
||||
mCustomizableBridgeMenu.animate().alpha(0).withEndAction(() -> mCustomizableBridgeMenu.setVisibility(View.GONE));
|
||||
}else {
|
||||
m_customizable_bridge_menu.setAlpha(0);
|
||||
m_customizable_bridge_menu.setVisibility(View.GONE);
|
||||
mCustomizableBridgeMenu.setAlpha(0);
|
||||
mCustomizableBridgeMenu.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -83,13 +83,13 @@ class orbotViewController
|
|||
}
|
||||
|
||||
public void onTrigger(orbotEnums.eOrbotViewCommands p_commands, List<Object> p_data){
|
||||
if(p_commands == orbotEnums.eOrbotViewCommands.M_UPDATE_BRIDGE_SETTINGS_VIEWS){
|
||||
if(p_commands == orbotEnums.eOrbotViewCommands.S_UPDATE_BRIDGE_SETTINGS_VIEWS){
|
||||
bridgeSettingsStatus((boolean) p_data.get(0));
|
||||
}
|
||||
else if(p_commands == orbotEnums.eOrbotViewCommands.M_INIT_POST_UI){
|
||||
else if(p_commands == orbotEnums.eOrbotViewCommands.S_INIT_POST_UI){
|
||||
initPostUI();
|
||||
}
|
||||
else if(p_commands == orbotEnums.eOrbotViewCommands.M_INIT_UI){
|
||||
else if(p_commands == orbotEnums.eOrbotViewCommands.S_INIT_UI){
|
||||
initViews((boolean)p_data.get(0),(boolean) p_data.get(1));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,9 +22,9 @@ import com.example.myapplication.R;
|
|||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import static com.darkweb.genesissearchengine.constants.status.sCookieStatus;
|
||||
import static com.darkweb.genesissearchengine.constants.status.sHistoryStatus;
|
||||
import static com.darkweb.genesissearchengine.constants.status.sJavaStatus;
|
||||
import static com.darkweb.genesissearchengine.constants.status.sSettingCookieStatus;
|
||||
import static com.darkweb.genesissearchengine.constants.status.sSettingHistoryStatus;
|
||||
import static com.darkweb.genesissearchengine.constants.status.sSettingJavaStatus;
|
||||
|
||||
public class settingController extends AppCompatActivity
|
||||
{
|
||||
|
@ -67,11 +67,11 @@ public class settingController extends AppCompatActivity
|
|||
}
|
||||
|
||||
public void modelInitialization(){
|
||||
mSettingModel.setJavaStatus(sJavaStatus);
|
||||
mSettingModel.setHistoryStatus(sHistoryStatus);
|
||||
mSettingModel.setSearchStatus(status.sSearchStatus);
|
||||
mSettingModel.setAdjustableStatus(status.sFontAdjustable);
|
||||
mSettingModel.setFontSize(status.sFontSize);
|
||||
mSettingModel.setJavaStatus(sSettingJavaStatus);
|
||||
mSettingModel.setHistoryStatus(sSettingHistoryStatus);
|
||||
mSettingModel.setSearchStatus(status.sSettingSearchStatus);
|
||||
mSettingModel.setAdjustableStatus(status.sSettingFontAdjustable);
|
||||
mSettingModel.setFontSize(status.sSettingFontSize);
|
||||
}
|
||||
|
||||
public void viewsInitializations()
|
||||
|
@ -96,7 +96,7 @@ public class settingController extends AppCompatActivity
|
|||
initializeItemSelectedListener(mHistory);
|
||||
initializeItemSelectedListener(mFontAdjustable);
|
||||
initializeItemSelectedListener(mCookies);
|
||||
pluginController.getInstance().logEvent(strings.SETTINGS_OPENED);
|
||||
pluginController.getInstance().logEvent(strings.EVENT_SETTINGS_OPENED);
|
||||
}
|
||||
|
||||
/*Event Handlers*/
|
||||
|
@ -104,9 +104,9 @@ public class settingController extends AppCompatActivity
|
|||
@Override
|
||||
public void onTrimMemory(int level)
|
||||
{
|
||||
if(status.sIsAppPaused && (level==80 || level==15))
|
||||
if(status.sSettingIsAppPaused && (level==80 || level==15))
|
||||
{
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.LOW_MEMORY,true));
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.HOME_LOW_MEMORY,true));
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ public class settingController extends AppCompatActivity
|
|||
public void onResume()
|
||||
{
|
||||
activityContextManager.getInstance().setCurrentActivity(this);
|
||||
status.sIsAppPaused = false;
|
||||
status.sSettingIsAppPaused = false;
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
|
@ -217,22 +217,22 @@ public class settingController extends AppCompatActivity
|
|||
public Object invokeObserver(List<Object> data, enums.etype e_type)
|
||||
{
|
||||
if(e_type == enums.etype.update_searcn){
|
||||
status.sSearchStatus = (String)data.get(0);
|
||||
status.sSettingSearchStatus = (String)data.get(0);
|
||||
mHomeController.onHomeButton(null);
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SEARCH_ENGINE, mSettingModel.getSearchStatus()));
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_SEARCH_ENGINE, mSettingModel.getSearchStatus()));
|
||||
}
|
||||
else if(e_type == enums.etype.update_javascript){
|
||||
status.sJavaStatus = (boolean)data.get(0);
|
||||
status.sSettingJavaStatus = (boolean)data.get(0);
|
||||
mHomeController.onUpdateJavascript();
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.JAVA_SCRIPT, status.sJavaStatus));
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_JAVA_SCRIPT, status.sSettingJavaStatus));
|
||||
}
|
||||
else if(e_type == enums.etype.update_history){
|
||||
sHistoryStatus = (boolean)data.get(0);
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.HISTORY_CLEAR, sHistoryStatus));
|
||||
sSettingHistoryStatus = (boolean)data.get(0);
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_HISTORY_CLEAR, sSettingHistoryStatus));
|
||||
}
|
||||
else if(e_type == enums.etype.update_notification){
|
||||
pluginController.getInstance().setNotificationStatus((int)data.get(0));
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.NOTIFICATION_STATUS, pluginController.getInstance().getNotificationStatus()));
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_NOTIFICATION_STATUS, pluginController.getInstance().getNotificationStatus()));
|
||||
|
||||
int notificationStatus = pluginController.getInstance().getNotificationStatus();
|
||||
if(notificationStatus==0){
|
||||
|
@ -248,8 +248,8 @@ public class settingController extends AppCompatActivity
|
|||
mHomeController.onLoadFont();
|
||||
}
|
||||
else if(e_type == enums.etype.update_cookies){
|
||||
sCookieStatus = (int)data.get(0);
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.COOKIE_ADJUSTABLE, sCookieStatus));
|
||||
sSettingCookieStatus = (int)data.get(0);
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_COOKIE_ADJUSTABLE, sSettingCookieStatus));
|
||||
mHomeController.onUpdateCookies();
|
||||
pluginController.getInstance().updateCookiesStatus();
|
||||
}
|
||||
|
@ -267,15 +267,15 @@ public class settingController extends AppCompatActivity
|
|||
|
||||
if (index == 0)
|
||||
{
|
||||
return constants.BACKEND_GENESIS_URL;
|
||||
return constants.CONST_BACKEND_GENESIS_URL;
|
||||
}
|
||||
else if (index == 1)
|
||||
{
|
||||
return constants.BACKEND_GOOGLE_URL;
|
||||
return constants.CONST_BACKEND_GOOGLE_URL;
|
||||
}
|
||||
else
|
||||
{
|
||||
return constants.BACKEND_DUCK_DUCK_GO_URL;
|
||||
return constants.CONST_BACKEND_DUCK_DUCK_GO_URL;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ class settingModel
|
|||
|
||||
private eventObserver.eventListener mEvent;
|
||||
|
||||
private String mSearchStatus = strings.EMPTY_STR;
|
||||
private String mSearchStatus = strings.GENERIC_EMPTY_STR;
|
||||
private int mCookieStatus = ACCEPT_FIRST_PARTY;
|
||||
private int mNotificationStatus = 0;
|
||||
private boolean mJavaStatus = false;
|
||||
|
@ -38,10 +38,10 @@ class settingModel
|
|||
|
||||
private void init_status()
|
||||
{
|
||||
mSearchStatus = status.sSearchStatus;
|
||||
mHistoryStatus = status.sHistoryStatus;
|
||||
mJavaStatus = status.sJavaStatus;
|
||||
mCookieStatus = status.sCookieStatus;
|
||||
mSearchStatus = status.sSettingSearchStatus;
|
||||
mHistoryStatus = status.sSettingHistoryStatus;
|
||||
mJavaStatus = status.sSettingJavaStatus;
|
||||
mCookieStatus = status.sSettingCookieStatus;
|
||||
}
|
||||
|
||||
void initNotification(int notificationStatus){
|
||||
|
@ -86,11 +86,11 @@ class settingModel
|
|||
|
||||
void onCloseView()
|
||||
{
|
||||
if(!status.sSearchStatus.equals(mSearchStatus))
|
||||
if(!status.sSettingSearchStatus.equals(mSearchStatus))
|
||||
{
|
||||
mEvent.invokeObserver(Collections.singletonList(mSearchStatus), enums.etype.update_searcn);
|
||||
}
|
||||
if(status.sJavaStatus != mJavaStatus)
|
||||
if(status.sSettingJavaStatus != mJavaStatus)
|
||||
{
|
||||
mEvent.invokeObserver(Collections.singletonList(mJavaStatus), enums.etype.update_javascript);
|
||||
}
|
||||
|
@ -98,41 +98,41 @@ class settingModel
|
|||
{
|
||||
mEvent.invokeObserver(Collections.singletonList(mNotificationStatus), enums.etype.update_notification);
|
||||
}
|
||||
if(status.sHistoryStatus != mHistoryStatus)
|
||||
if(status.sSettingHistoryStatus != mHistoryStatus)
|
||||
{
|
||||
status.sHistoryStatus = mHistoryStatus;
|
||||
status.sSettingHistoryStatus = mHistoryStatus;
|
||||
mEvent.invokeObserver(Collections.singletonList(mHistoryStatus), enums.etype.update_history);
|
||||
}
|
||||
if(status.sFontAdjustable != mFontAdjustable)
|
||||
if(status.sSettingFontAdjustable != mFontAdjustable)
|
||||
{
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.COOKIE_ADJUSTABLE,mFontAdjustable));
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.FONT_SIZE,100));
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_COOKIE_ADJUSTABLE,mFontAdjustable));
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_FONT_SIZE,100));
|
||||
|
||||
status.sFontAdjustable = mFontAdjustable;
|
||||
status.sFontSize = 100;
|
||||
status.sSettingFontAdjustable = mFontAdjustable;
|
||||
status.sSettingFontSize = 100;
|
||||
mFontSize = 100;
|
||||
|
||||
mEvent.invokeObserver(Collections.singletonList(mFontSize), enums.etype.update_font_adjustable);
|
||||
}
|
||||
if(status.sFontSize != mFontSize)
|
||||
if(status.sSettingFontSize != mFontSize)
|
||||
{
|
||||
if(mFontSize <=0){
|
||||
mFontSize = 1;
|
||||
}
|
||||
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.FONT_SIZE,mFontSize));
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.FONT_ADJUSTABLE,false));
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_FONT_SIZE,mFontSize));
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_FONT_ADJUSTABLE,false));
|
||||
|
||||
status.sFontSize = mFontSize;
|
||||
status.sFontAdjustable = false;
|
||||
status.sSettingFontSize = mFontSize;
|
||||
status.sSettingFontAdjustable = false;
|
||||
mFontAdjustable = false;
|
||||
|
||||
mEvent.invokeObserver(Collections.singletonList(mFontSize), enums.etype.update_font_size);
|
||||
}
|
||||
if(status.sCookieStatus != mCookieStatus)
|
||||
if(status.sSettingCookieStatus != mCookieStatus)
|
||||
{
|
||||
status.sCookieStatus = mCookieStatus;
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.COOKIE_ADJUSTABLE,status.sCookieStatus));
|
||||
status.sSettingCookieStatus = mCookieStatus;
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_COOKIE_ADJUSTABLE,status.sSettingCookieStatus));
|
||||
mEvent.invokeObserver(Collections.singletonList(mCookieStatus), enums.etype.update_cookies);
|
||||
}
|
||||
mEvent.invokeObserver(Collections.singletonList(mHistoryStatus), enums.etype.close_view);
|
||||
|
|
|
@ -15,8 +15,8 @@ import com.darkweb.genesissearchengine.constants.status;
|
|||
import com.darkweb.genesissearchengine.constants.strings;
|
||||
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
||||
import com.example.myapplication.R;
|
||||
import static com.darkweb.genesissearchengine.constants.status.sHistoryStatus;
|
||||
import static com.darkweb.genesissearchengine.constants.status.sJavaStatus;
|
||||
import static com.darkweb.genesissearchengine.constants.status.sSettingHistoryStatus;
|
||||
import static com.darkweb.genesissearchengine.constants.status.sSettingJavaStatus;
|
||||
|
||||
class settingViewController
|
||||
{
|
||||
|
@ -94,7 +94,7 @@ class settingViewController
|
|||
|
||||
private void initJavascript()
|
||||
{
|
||||
if (sJavaStatus)
|
||||
if (sSettingJavaStatus)
|
||||
{
|
||||
mJavaScript.setSelection(0);
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ class settingViewController
|
|||
|
||||
private void initHistory()
|
||||
{
|
||||
if (sHistoryStatus)
|
||||
if (sSettingHistoryStatus)
|
||||
{
|
||||
mHistory.setSelection(0);
|
||||
}
|
||||
|
@ -123,12 +123,12 @@ class settingViewController
|
|||
|
||||
private void initCookies()
|
||||
{
|
||||
mCookies.setSelection(status.sCookieStatus);
|
||||
mCookies.setSelection(status.sSettingCookieStatus);
|
||||
}
|
||||
|
||||
private void initFontAdjustable()
|
||||
{
|
||||
if (status.sFontAdjustable)
|
||||
if (status.sSettingFontAdjustable)
|
||||
{
|
||||
mFontAdjustable.setSelection(0);
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ class settingViewController
|
|||
|
||||
private void initFontSize()
|
||||
{
|
||||
mFontSize.setProgress((int)status.sFontSize);
|
||||
mFontSize.setProgress((int)status.sSettingFontSize);
|
||||
updatePercentage(mFontSize.getProgress());
|
||||
}
|
||||
|
||||
|
@ -164,10 +164,10 @@ class settingViewController
|
|||
/*External Helper Methods*/
|
||||
|
||||
private int getEngineIndex(){
|
||||
if(status.sSearchStatus.equals(constants.BACKEND_GENESIS_URL)){
|
||||
if(status.sSettingSearchStatus.equals(constants.CONST_BACKEND_GENESIS_URL)){
|
||||
return 0;
|
||||
}
|
||||
else if(status.sSearchStatus.equals(constants.BACKEND_GOOGLE_URL)){
|
||||
else if(status.sSettingSearchStatus.equals(constants.CONST_BACKEND_GOOGLE_URL)){
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
|
@ -177,6 +177,6 @@ class settingViewController
|
|||
@SuppressLint("SetTextI18n")
|
||||
void updatePercentage(int font_size){
|
||||
|
||||
mFontSizePercentage.setText(strings.CUSTOM_FONTS + strings.EMPTY_SPACE + font_size +strings.PERCENT_SIGN);
|
||||
mFontSizePercentage.setText(strings.SETTING_CUSTOM_FONTS + strings.GENERIC_EMPTY_SPACE + font_size +strings.SETTING_PERCENT_SIGN);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ public class tabAdapter extends RecyclerView.Adapter<tabAdapter.listViewHolder>
|
|||
private ArrayList<tabRowModel> mModelList;
|
||||
private ArrayList<tabRowModel> mTempModelList;
|
||||
private eventObserver.eventListener mEvent;
|
||||
private String filter = strings.EMPTY_STR;
|
||||
private String filter = strings.GENERIC_EMPTY_STR;
|
||||
private boolean isClosing = false;
|
||||
|
||||
tabAdapter(ArrayList<tabRowModel> model_list, eventObserver.eventListener event) {
|
||||
|
@ -38,7 +38,7 @@ public class tabAdapter extends RecyclerView.Adapter<tabAdapter.listViewHolder>
|
|||
@NonNull
|
||||
@Override
|
||||
public listViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_row_view, parent, false);
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.recyclerview_row, parent, false);
|
||||
return new listViewHolder(view);
|
||||
}
|
||||
|
||||
|
@ -120,9 +120,9 @@ public class tabAdapter extends RecyclerView.Adapter<tabAdapter.listViewHolder>
|
|||
|
||||
void bindListView(tabRowModel model) {
|
||||
|
||||
heaaderText = itemView.findViewById(R.id.p_header);
|
||||
descriptionText = itemView.findViewById(R.id.p_description);
|
||||
itemContainer = itemView.findViewById(R.id.p_item_container);
|
||||
heaaderText = itemView.findViewById(R.id.pHeader);
|
||||
descriptionText = itemView.findViewById(R.id.pDescription);
|
||||
//itemContainer = itemView.findViewById(R.id.pRowContainer);
|
||||
|
||||
if(model.getSession().getTitle().equals("") || model.getSession().getTitle().equals("loading")){
|
||||
heaaderText.setText(helperMethod.getDomainName(model.getSession().getCurrentURL()));
|
||||
|
@ -139,7 +139,7 @@ public class tabAdapter extends RecyclerView.Adapter<tabAdapter.listViewHolder>
|
|||
|
||||
descriptionText.setText(url);
|
||||
// messageButton = itemView.findViewById(R.id.message_button);
|
||||
empty_message = itemView.findViewById(R.id.p_empty_list);
|
||||
empty_message = itemView.findViewById(R.id.pEmptyListNotification);
|
||||
data_model = model;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,13 +63,13 @@ public class tabController extends AppCompatActivity
|
|||
mContextManager = activityContextManager.getInstance();
|
||||
mHomeController = activityContextManager.getInstance().getHomeController();
|
||||
mContextManager.setTabController(this);
|
||||
pluginController.getInstance().logEvent(strings.TAB_OPENED);
|
||||
pluginController.getInstance().logEvent(strings.EVENT_TAB_OPENED);
|
||||
}
|
||||
public void initializeViews(){
|
||||
mEmptyListNotifier = findViewById(R.id.p_empty_list);
|
||||
mSearchBar = findViewById(R.id.p_search);
|
||||
mListView = findViewById(R.id.p_listview);
|
||||
mClearButton = findViewById(R.id.p_clearButton);
|
||||
mEmptyListNotifier = findViewById(R.id.pEmptyListNotification);
|
||||
mSearchBar = findViewById(R.id.pSearchInput);
|
||||
mListView = findViewById(R.id.pRecycleView);
|
||||
mClearButton = findViewById(R.id.pClearButton);
|
||||
mtabViewController = new tabViewController(mEmptyListNotifier, mListView, mClearButton,this);
|
||||
mClearButton.setText(R.string.tab_view_clear_tab);
|
||||
}
|
||||
|
@ -136,22 +136,22 @@ public class tabController extends AppCompatActivity
|
|||
}
|
||||
|
||||
public void onclearDataTrigger(View view){
|
||||
pluginController.getInstance().MessageManagerHandler(this, Collections.singletonList(strings.EMPTY_STR),enums.etype.clear_tab);
|
||||
pluginController.getInstance().MessageManagerHandler(this, Collections.singletonList(strings.GENERIC_EMPTY_STR),enums.etype.clear_tab);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTrimMemory(int level)
|
||||
{
|
||||
if(status.sIsAppPaused && (level==80 || level==15))
|
||||
if(status.sSettingIsAppPaused && (level==80 || level==15))
|
||||
{
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.LOW_MEMORY,true));
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.HOME_LOW_MEMORY,true));
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
public void onNewTabInvoked(View view)
|
||||
{
|
||||
mHomeController.onNewTab(false);
|
||||
mHomeController.onNewTab(true,false);
|
||||
finish();
|
||||
}
|
||||
|
||||
|
@ -159,7 +159,7 @@ public class tabController extends AppCompatActivity
|
|||
public void onResume()
|
||||
{
|
||||
activityContextManager.getInstance().setCurrentActivity(this);
|
||||
status.sIsAppPaused = false;
|
||||
status.sSettingIsAppPaused = false;
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
|
@ -171,7 +171,7 @@ public class tabController extends AppCompatActivity
|
|||
@Override
|
||||
public void onPause()
|
||||
{
|
||||
status.sIsAppPaused = true;
|
||||
status.sSettingIsAppPaused = true;
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
|
@ -187,7 +187,7 @@ public class tabController extends AppCompatActivity
|
|||
}
|
||||
if(e_type.equals(enums.etype.url_triggered)){
|
||||
tabRowModel model = (tabRowModel)data.get(0);
|
||||
pluginController.getInstance().logEvent(strings.TAB_TRIGGERED);
|
||||
pluginController.getInstance().logEvent(strings.EVENT_TAB_TRIGGERED);
|
||||
mHomeController.onLoadTab(model.getSession(),false);
|
||||
tabController.this.finish();
|
||||
}
|
||||
|
@ -201,7 +201,7 @@ public class tabController extends AppCompatActivity
|
|||
mtabViewController.updateIfListEmpty(mListModel.getList().size(),300);
|
||||
mHomeController.releaseSession();
|
||||
if(dataController.getInstance().getTotalTabs()<1){
|
||||
mHomeController.onNewTab(false);
|
||||
mHomeController.onNewTab(true,false);
|
||||
finish();
|
||||
}else {
|
||||
mHomeController.loadExistingTab();
|
||||
|
|
|
@ -4,53 +4,47 @@ public class constants
|
|||
{
|
||||
/*LOCAL URL CONSTANTS*/
|
||||
|
||||
public static final String BLACK_MARKET_URL = "https://boogle.store/search?q=black+market&p_num=1&s_type=all";
|
||||
public static final String LEAKED_DOCUMENT_URL = "https://boogle.store/search?q=leaked+document&p_num=1&s_type=all&p_num=1&s_type=all";
|
||||
public static final String NEWS_URL = "https://boogle.store/search?q=latest%20news&p_num=1&s_type=news";
|
||||
public static final String SOFTWARE_URL = "https://boogle.store/search?q=softwares+tools&p_num=1&s_type=all&p_num=1&s_type=all";
|
||||
public static final String CONST_BLACK_MARKET_URL = "https://boogle.store/search?q=black+market&p_num=1&s_type=all";
|
||||
public static final String CONST_LEAKED_DOCUMENT_URL = "https://boogle.store/search?q=leaked+document&p_num=1&s_type=all&p_num=1&s_type=all";
|
||||
public static final String CONST_NEWS_URL = "https://boogle.store/search?q=latest%20news&p_num=1&s_type=news";
|
||||
public static final String CONST_SOFTWARE_URL = "https://boogle.store/search?q=softwares+tools&p_num=1&s_type=all&p_num=1&s_type=all";
|
||||
|
||||
/*URL CONSTANTS*/
|
||||
|
||||
public static final String BACKEND_GENESIS_URL = "http://boogle.store";
|
||||
public static final String GENESIS_UPDATE_URL = "https://boogle.store/manual?abi=";
|
||||
public static final String BACKEND_GOOGLE_URL = "https://www.google.com/";
|
||||
public static final String BACKEND_DUCK_DUCK_GO_URL = "https://duckduckgo.com/";
|
||||
public static final String PLAYSTORE_URL = "https://play.google.com/store/apps/details?id=com.darkweb.genesissearchengine";
|
||||
public static final String CONST_BACKEND_GENESIS_URL = "http://boogle.store";
|
||||
public static final String CONST_GENESIS_UPDATE_URL = "https://boogle.store/manual?abi=";
|
||||
public static final String CONST_BACKEND_GOOGLE_URL = "https://www.google.com/";
|
||||
public static final String CONST_BACKEND_DUCK_DUCK_GO_URL = "https://duckduckgo.com/";
|
||||
public static final String CONST_PLAYSTORE_URL = "https://play.google.com/store/apps/details?id=com.darkweb.genesissearchengine";
|
||||
|
||||
/*PROXY CONSTANTS*/
|
||||
|
||||
public static final String PROXY_SOCKS = "127.0.0.1";
|
||||
public static final String PROXY_SOCKS_PORT = "9050";
|
||||
public static final int PROXY_SOCKS_VERSION = 5;
|
||||
public static final boolean PROXY_SOCKS_REMOTE_DNS = true;
|
||||
public static final boolean PROXY_CACHE = true;
|
||||
public static final boolean PROXY_MEMORY = true;
|
||||
public static final int DISK_CAPACITY = 10000;
|
||||
public static final String PROXY_USER_AGENT_OVERRIDE = "Mozilla/5.0 (Android 9; Mobile; rv:67.0) Gecko/67.0 Firefox/67.0";
|
||||
public static final String PROXY_USER_AGENT_OVERRIDE_DESKTOP = "Mozilla/5.0 (X11; Linux x86_64:68.0) Gecko/20100101 Firefox/68.0";
|
||||
public static final boolean PROXY_DO_NOT_TRACK_HEADER_ENABLED = false;
|
||||
public static final int PROXY_DO_NOT_TRACK_HEADER_VALUE = 1;
|
||||
public static final String CONST_PROXY_SOCKS = "127.0.0.1";
|
||||
public static final int CONST_PROXY_SOCKS_VERSION = 5;
|
||||
public static final boolean CONST_PROXY_SOCKS_REMOTE_DNS = true;
|
||||
public static final boolean CONST_PROXY_CACHE = true;
|
||||
public static final boolean CONST_PROXY_MEMORY = true;
|
||||
public static final boolean CONST_PROXY_DO_NOT_TRACK_HEADER_ENABLED = false;
|
||||
public static final int CONST_PROXY_DO_NOT_TRACK_HEADER_VALUE = 1;
|
||||
|
||||
/*MENU CONSTANTS*/
|
||||
|
||||
public static final int LIST_HISTORY = 1;
|
||||
public static final int LIST_BOOKMARK = 2;
|
||||
public static final int CONST_LIST_HISTORY = 1;
|
||||
public static final int CONST_LIST_BOOKMARK = 2;
|
||||
|
||||
/*SETTINGS CONSTANTS*/
|
||||
|
||||
public static final int MAX_LIST_DATA_SIZE =5000;
|
||||
public static final int MAX_LIST_SIZE =5000;
|
||||
public static final int FETCHABLE_LIST_SIZE =100;
|
||||
public static final String DATABASE_NAME ="genesis_dbase";
|
||||
public static final int CONST_MAX_LIST_DATA_SIZE =5000;
|
||||
public static final int CONST_FETCHABLE_LIST_SIZE =100;
|
||||
public static final int CONST_MAX_BOOKMARK_SIZE =500;
|
||||
public static final String CONST_DATABASE_NAME ="genesis_dbase";
|
||||
|
||||
/*ADMOB CONSTANTS*/
|
||||
|
||||
public static final String ADMOB_KEY = "ca-app-pub-5074525529134731~2926711128";
|
||||
public static final String TEST_KEY = "5AAFC2DFAE5C3906292EB576F0822FD7";
|
||||
public static final String CONST_ADMOB_KEY = "ca-app-pub-5074525529134731~2926711128";
|
||||
|
||||
/*ANALYTICS CONSTANTS*/
|
||||
|
||||
public static final String UNIQUE_KEY_ID = "*PREF_UNIQUE_ID";
|
||||
public static final String USER_EMAIL = "user@fabric.io";
|
||||
public static final String CONST_UNIQUE_KEY_ID = "*PREF_UNIQUE_ID";
|
||||
|
||||
}
|
||||
|
|
|
@ -4,12 +4,11 @@ public class enums
|
|||
{
|
||||
/*Settings Manager*/
|
||||
public enum etype{
|
||||
HiddenWeb, DuckDuckGo,Google, on_update_favicon,
|
||||
hidden_onion, hidden_onion_start,hidden_base,
|
||||
onion, base,on_verify_selected_url_menu,
|
||||
welcome,abi_error,rate_success,reported_success,bookmark, clear_tab,clear_history,clear_bookmark,report_url,rate_app,version_warning,start_orbot,download_file,download_file_long_press,tor_banned,on_long_press_url,
|
||||
cancel_welcome,ignore_abi,reload,connect_vpn,start_home,disable_splash,app_rated,download_file_manual,download_folder, update_searcn, update_javascript,update_notification, update_history,update_cookies, update_font_size,update_font_adjustable,close_view,open_link_new_tab,open_link_current_tab,copy_link,
|
||||
url_triggered, url_triggered_new_tab,url_clear,clear_recycler,url_clear_at,remove_from_database,is_empty,load_more,
|
||||
on_close_sesson,on_long_press,on_long_press_with_link,on_reset_app,on_bridge_mail,on_not_support,on_full_screen,on_error_cert,on_handle_external_intent,on_update_suggestion_url,progress_update,recheck_orbot,on_url_load,on_playstore_load,back_list_empty,redraw,start_proxy,start_proxy_back,start_proxy_forward,onMenuSelected,on_request_completed, on_update_history,on_update_suggestion,on_page_loaded,on_load_error,update_tab_title,download_file_popup,proxy_error,on_init_ads,rate_application,search_update, open_new_tab
|
||||
on_update_favicon,
|
||||
onion,on_verify_selected_url_menu,
|
||||
welcome,abi_error, rate_failure,reported_success,bookmark, clear_tab,clear_history,clear_bookmark,report_url,rate_app,version_warning,start_orbot,download_file,download_file_long_press,on_long_press_url,
|
||||
cancel_welcome,ignore_abi,reload,connect_vpn,app_rated,download_file_manual,download_folder, update_searcn, update_javascript,update_notification, update_history,update_cookies, update_font_size,update_font_adjustable,close_view,open_link_new_tab,open_link_current_tab,copy_link,
|
||||
url_triggered, url_triggered_new_tab,url_clear,clear_recycler,url_clear_at,remove_from_database,is_empty,
|
||||
on_close_sesson,on_long_press,on_long_press_with_link,on_reset_app,on_bridge_mail,on_not_support,on_full_screen,on_handle_external_intent,on_update_suggestion_url,progress_update,recheck_orbot,on_url_load,on_playstore_load,back_list_empty,start_proxy,on_request_completed, on_update_history,on_update_suggestion,on_page_loaded,on_load_error,download_file_popup,on_init_ads,rate_application,search_update, open_new_tab
|
||||
}
|
||||
}
|
|
@ -4,7 +4,7 @@ public class keys
|
|||
{
|
||||
/*Home page*/
|
||||
|
||||
public static String LOW_MEMORY = "LOW_MEMORY";
|
||||
public static String HOME_LOW_MEMORY = "LOW_MEMORY";
|
||||
|
||||
/*Proxy Manager*/
|
||||
|
||||
|
@ -13,37 +13,34 @@ public class keys
|
|||
public static final String PROXY_SOCKS_PORT = "network.proxy.socks_port";
|
||||
public static final String PROXY_SOCKS_VERSION = "network.proxy.socks_version";
|
||||
public static final String PROXY_SOCKS_REMOTE_DNS = "network.proxy.socks_remote_dns";
|
||||
public static final String PROXY_SOCKS_COOKIES = "privacy.clearOnShutdown.cookies";
|
||||
public static final String PROXY_CACHE = "browser.cache.disk.enable";
|
||||
public static final String PROXY_MEMORY = "browser.cache.memory.enable";
|
||||
public static final String PROXY_DISK_CAPACITY = "browser.cache.disk.capacity";
|
||||
public static final String PROXY_USER_AGENT_OVERRIDE = "general.useragent.override";
|
||||
public static final String PROXY_DO_NOT_TRACK_HEADER_ENABLED = "privacy.donottrackheader.enabled";
|
||||
public static final String PROXY_DO_NOT_TRACK_HEADER_VALUE = "privacy.donottrackheader.value";
|
||||
public static final String IS_APP_RATED = "IS_APP_RATED";
|
||||
public static final String list_type = "list_type";
|
||||
public static final String PROXY_IS_APP_RATED = "IS_APP_RATED";
|
||||
public static final String PROXY_LIST_TYPE = "list_type";
|
||||
|
||||
/*Settings*/
|
||||
|
||||
public static final String LANGUAGE = "LANGUAGE";
|
||||
public static final String SEARCH_ENGINE = "SEARCH_ENGINE";
|
||||
public static final String FIRST_INSTALLED = "FIRST_INSTALLED";
|
||||
public static final String JAVA_SCRIPT = "JAVA_SCRIPT";
|
||||
public static final String HISTORY_CLEAR = "HISTORY_CLEAR";
|
||||
public static final String GATEWAY_AUTO = "pref_bridges_enabled_auto";
|
||||
public static final String GATEWAY_MANUAL = "pref_bridges_enabled_manual";
|
||||
public static final String IS_BOOTSTRAPPED = "IS_BOOTSTRAPPED";
|
||||
public static final String IS_WELCOME_ENABLED = "IS_WELCOME_ENABLED";
|
||||
public static final String ENGINE_SWITCHED = "ENGINE_SWITCHED";
|
||||
public static final String FONT_SIZE = "FONT_SIZE";
|
||||
public static final String FONT_ADJUSTABLE = "FONT_ADJUSTABLE";
|
||||
public static final String COOKIE_ADJUSTABLE = "COOKIE_ADJUSTABLE_NEW";
|
||||
public static final String CLEAR_PREFS = "CLEAR_PREFS";
|
||||
public static final String NOTIFICATION_STATUS = "NOTIFICATION_STATUS";
|
||||
public static final String SETTING_LANGUAGE = "LANGUAGE";
|
||||
public static final String SETTING_SEARCH_ENGINE = "SEARCH_ENGINE";
|
||||
public static final String SETTING_FIRST_INSTALLED = "FIRST_INSTALLED";
|
||||
public static final String SETTING_JAVA_SCRIPT = "JAVA_SCRIPT";
|
||||
public static final String SETTING_HISTORY_CLEAR = "HISTORY_CLEAR";
|
||||
public static final String SETTING_GATEWAY_AUTO = "pref_bridges_enabled_auto";
|
||||
public static final String SETTING_GATEWAY_MANUAL = "pref_bridges_enabled_manual";
|
||||
public static final String SETTING_IS_BOOTSTRAPPED = "IS_BOOTSTRAPPED";
|
||||
public static final String SETTING_IS_WELCOME_ENABLED = "IS_WELCOME_ENABLED";
|
||||
public static final String SETTING_ENGINE_SWITCHED = "ENGINE_SWITCHED";
|
||||
public static final String SETTING_FONT_SIZE = "FONT_SIZE";
|
||||
public static final String SETTING_FONT_ADJUSTABLE = "FONT_ADJUSTABLE";
|
||||
public static final String SETTING_COOKIE_ADJUSTABLE = "COOKIE_ADJUSTABLE_NEW";
|
||||
public static final String SETTING_NOTIFICATION_STATUS = "NOTIFICATION_STATUS";
|
||||
|
||||
/*Bridge Settings*/
|
||||
public static final String CUSTOM_BRIDGE_1 = "CLEAR_PREFS";
|
||||
public static final String S_BRIDGE_ENABLES = "S_BRIDGE_ENABLES";
|
||||
public static final String S_VPN_ENABLED = "S_VPN_ENABLED";
|
||||
|
||||
public static final String BRIDGE_CUSTOM_BRIDGE_1 = "CLEAR_PREFS";
|
||||
public static final String BRIDGE_BRIDGE_ENABLES = "S_BRIDGE_ENABLES";
|
||||
public static final String BRIDGE_VPN_ENABLED = "S_VPN_ENABLED";
|
||||
|
||||
}
|
||||
|
|
|
@ -4,6 +4,6 @@ public class messages
|
|||
{
|
||||
/*POST MESSAGES KEYS*/
|
||||
|
||||
public final static int UPDATE_LOADING_TEXT =1;
|
||||
public final static int ON_URL_LOAD =2;
|
||||
public final static int MESSAGE_UPDATE_LOADING_TEXT =1;
|
||||
public final static int MESSAGE_ON_URL_LOAD =2;
|
||||
}
|
||||
|
|
|
@ -4,7 +4,8 @@ public class sql
|
|||
{
|
||||
/*HISTORY*/
|
||||
|
||||
public static final String H_CLEAR_DATA = "delete from history where 1";
|
||||
public static final String SQL_CLEAR_HISTORY = "delete from history where 1";
|
||||
public static final String SQL_CLEAR_BOOKMARK = "delete from bookmark where 1";
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -11,54 +11,54 @@ public class status
|
|||
{
|
||||
/*App Status*/
|
||||
|
||||
public static String current_ABI = "7.0";
|
||||
public static boolean paid_status = false;
|
||||
public static String sAppCurrentABI = "7.0";
|
||||
public static boolean sPaidStatus = false;
|
||||
|
||||
/*Settings Status*/
|
||||
|
||||
public static String sSearchStatus = constants.BACKEND_GENESIS_URL;
|
||||
public static String sRedirectStatus = strings.EMPTY_STR;
|
||||
public static boolean sJavaStatus = true;
|
||||
public static boolean sHistoryStatus = true;
|
||||
public static boolean sIsAppPaused = false;
|
||||
public static boolean sIsWelcomeEnabled = true;
|
||||
public static boolean sIsAppStarted = false;
|
||||
public static boolean sIsAppRated = false;
|
||||
public static boolean sFontAdjustable = true;
|
||||
public static boolean sFirstStart = true;
|
||||
public static boolean sDesktopSite = false;
|
||||
public static int sCookieStatus = ACCEPT_FIRST_PARTY;
|
||||
public static float sFontSize = 1;
|
||||
public static String sLanguage = "en";
|
||||
public static String sSettingSearchStatus = constants.CONST_BACKEND_GENESIS_URL;
|
||||
public static String sSettingRedirectStatus = strings.GENERIC_EMPTY_STR;
|
||||
public static boolean sSettingJavaStatus = true;
|
||||
public static boolean sSettingHistoryStatus = true;
|
||||
public static boolean sSettingIsAppPaused = false;
|
||||
public static boolean sSettingIsWelcomeEnabled = true;
|
||||
public static boolean sSettingIsAppStarted = false;
|
||||
public static boolean sSettingIsAppRated = false;
|
||||
public static boolean sSettingFontAdjustable = true;
|
||||
public static boolean sSettingFirstStart = true;
|
||||
public static boolean sSettingDesktopSite = false;
|
||||
public static int sSettingCookieStatus = ACCEPT_FIRST_PARTY;
|
||||
public static float sSettingFontSize = 1;
|
||||
public static String sSettingLanguage = "en";
|
||||
|
||||
/*Bridge Status*/
|
||||
|
||||
public static boolean sGatewayAuto = false;
|
||||
public static boolean sGatewayManual = false;
|
||||
public static boolean sVPNStatus = false;
|
||||
public static boolean sBridgeGatewayAuto = false;
|
||||
public static boolean sBridgeGatewayManual = false;
|
||||
public static boolean sBridgeVPNStatus = false;
|
||||
public static boolean sBridgeStatus = false;
|
||||
public static String sCustomBridge = strings.CUSTOM_BRIDGE_OBFS4;
|
||||
public static String sBridgeCustomBridge = strings.BRIDGE_CUSTOM_BRIDGE_OBFS4;
|
||||
|
||||
|
||||
public static void initStatus()
|
||||
{
|
||||
status.sJavaStatus = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.JAVA_SCRIPT,true));
|
||||
status.sHistoryStatus = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.HISTORY_CLEAR,true));
|
||||
status.sGatewayAuto = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.GATEWAY_AUTO,true));
|
||||
status.sGatewayManual = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.GATEWAY_MANUAL,false));
|
||||
status.sIsWelcomeEnabled = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.IS_WELCOME_ENABLED,true));
|
||||
status.sIsAppRated = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.IS_APP_RATED,false));
|
||||
status.sVPNStatus = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.S_VPN_ENABLED,false));
|
||||
status.sBridgeStatus = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.S_BRIDGE_ENABLES,true));
|
||||
status.sFontAdjustable = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.FONT_ADJUSTABLE,true));
|
||||
status.sFirstStart = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.FIRST_INSTALLED,true));
|
||||
status.sSettingJavaStatus = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_JAVA_SCRIPT,true));
|
||||
status.sSettingHistoryStatus = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_HISTORY_CLEAR,true));
|
||||
status.sBridgeGatewayAuto = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_GATEWAY_AUTO,true));
|
||||
status.sBridgeGatewayManual = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_GATEWAY_MANUAL,false));
|
||||
status.sSettingIsWelcomeEnabled = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_IS_WELCOME_ENABLED,true));
|
||||
status.sSettingIsAppRated = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.PROXY_IS_APP_RATED,false));
|
||||
status.sBridgeVPNStatus = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.BRIDGE_VPN_ENABLED,false));
|
||||
status.sBridgeStatus = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.BRIDGE_BRIDGE_ENABLES,true));
|
||||
status.sSettingFontAdjustable = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_FONT_ADJUSTABLE,true));
|
||||
status.sSettingFirstStart = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_FIRST_INSTALLED,true));
|
||||
|
||||
status.sCookieStatus = (int)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_INT, Arrays.asList(keys.COOKIE_ADJUSTABLE,ACCEPT_FIRST_PARTY));
|
||||
status.sFontSize = (int)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_FLOAT, Arrays.asList(keys.FONT_SIZE,100));
|
||||
status.sSettingCookieStatus = (int)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_INT, Arrays.asList(keys.SETTING_COOKIE_ADJUSTABLE,ACCEPT_FIRST_PARTY));
|
||||
status.sSettingFontSize = (int)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_FLOAT, Arrays.asList(keys.SETTING_FONT_SIZE,100));
|
||||
|
||||
status.sLanguage = (String)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_STRING, Arrays.asList(keys.LANGUAGE,strings.DEFAULT_LANGUAGE));
|
||||
status.sSearchStatus = (String)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_STRING, Arrays.asList(keys.SEARCH_ENGINE,constants.BACKEND_GENESIS_URL));
|
||||
status.sCustomBridge = (String)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_STRING, Arrays.asList(keys.CUSTOM_BRIDGE_1,strings.CUSTOM_BRIDGE_OBFS4));
|
||||
status.sSettingLanguage = (String)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_STRING, Arrays.asList(keys.SETTING_LANGUAGE,strings.SETTING_DEFAULT_LANGUAGE));
|
||||
status.sSettingSearchStatus = (String)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_STRING, Arrays.asList(keys.SETTING_SEARCH_ENGINE,constants.CONST_BACKEND_GENESIS_URL));
|
||||
status.sBridgeCustomBridge = (String)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_BRIDGE_1,strings.BRIDGE_CUSTOM_BRIDGE_OBFS4));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,153 +2,53 @@ package com.darkweb.genesissearchengine.constants;
|
|||
|
||||
public class strings
|
||||
{
|
||||
/*Orbot Manager*/
|
||||
|
||||
public static final String WELCOME_MESSAGE_TITLE = "Welcome | Hidden Web Gateway";
|
||||
public static final String WELCOME_MESSAGE_DESC = "This application provide you a platform to Search and Open Hidden Web urls.Here are few Suggestions\n";
|
||||
public static final String WELCOME_MESSAGE_BT_1 = "Deep Web Online Market";
|
||||
public static final String WELCOME_MESSAGE_BT_2 = "Leaked Documents and Books";
|
||||
public static final String WELCOME_MESSAGE_BT_3 = "Dark Web News and Articles";
|
||||
public static final String WELCOME_MESSAGE_BT_4 = "Secret Softwares and Hacking Tools";
|
||||
public static final String WELCOME_MESSAGE_BT_5 = "Don't Show Again";
|
||||
|
||||
public static final String ABI_ERROR_TITLE = "Invalid Setup File";
|
||||
public static final String ABI_ERROR_DESC = "Looks like you messed up the installation. Either Install it from playstore or follow the link";
|
||||
public static final String ABI_ERROR_BT_1 = "Local Upgrade";
|
||||
public static final String ABI_ERROR_BT_2 = "Playstore Upgrade";
|
||||
public static final String ABI_ERROR_BT_3 = "Continue Anyway";
|
||||
|
||||
public static final String REPORT_URL_TITLE = "Report This Website";
|
||||
public static final String REPORT_URL_DESC = "If you think url is illegal or disturbing report us so that we can update our database\n";
|
||||
public static final String REPORT_URL_BT_1 = "Report";
|
||||
public static final String REPORT_URL_BT_2 = "Dismiss";
|
||||
|
||||
public static final String ORBOT_INIT_TITLE = "Initializing";
|
||||
public static final String ORBOT_INIT_DESC = "Please wait! While we connect you to hidden web. This might take few minutes\n";
|
||||
public static final String ORBOT_INIT_BT_1 = "Dismiss";
|
||||
public static final String ORBOT_INIT_BT_2 = "Try Again";
|
||||
|
||||
public static final String ORBOT_CLEAR_TITLE = "Data Cleared";
|
||||
public static final String ORBOT_CLEAR_DESC = "Genesis data has been cleared. Please try to start application from Homepage\n";
|
||||
public static final String ORBOT_CLEAR_BT_1 = "Dismiss";
|
||||
|
||||
public static final String VERSION_TITLE = "Update Pending";
|
||||
public static final String VERSION_DESC = "You have not updated this app for a while please update it to get best performance\n";
|
||||
public static final String VERSION_BT_1 = "Update";
|
||||
|
||||
public static final String REPORT_SUCCESS_TITLE = "URL Reported Successfully";
|
||||
public static final String REPORT_SUCCESS_DESC = "URL has been successfully reported. It will take about a week to completely remove this website from our servers\n";
|
||||
public static final String REPORT_SUCCESS_BT_1 = "Dismiss";
|
||||
|
||||
public static final String RATE_TITLE = "Rate US";
|
||||
public static final String RATE_MESSAGE = "We dont take donations or earn money from this app. We are trying to make a private anonymous internet \n\nIf you think this app works please rate us it gives us hope and strength to continue";
|
||||
public static final String RATE_POSITIVE = "Like This App";
|
||||
public static final String RATE_NEGATIVE = "Don't Like This App";
|
||||
|
||||
public static final String RATE_SUCCESS_TITLE = "Sorry To Hear That!";
|
||||
public static final String RATE_SUCCESS_DESC = "If you are having any trouble and want to contact us please email us at gamesolstudios@gmail.com We will try to solve your problem as soon as possible";
|
||||
public static final String RATE_SUCCESS_BT_1 = "Send Mail";
|
||||
|
||||
public static final String BOOKMARK_URL_BT_1 = "Bookmark";
|
||||
public static final String BOOKMARK_URL_BT_2 = "Dismiss";
|
||||
|
||||
public static final String CLEAR_HISTORY_TITLE = "Clear site storage?";
|
||||
public static final String CLEAR_HISTORY_DESC = "This will clear data for all sites";
|
||||
public static final String CLEAR_HISTORY_BT_1 = "Clear";
|
||||
public static final String CLEAR_HISTORY_BT_2 = "Dismiss";
|
||||
|
||||
public static final String CLEAR_TAB_TITLE = "Clear open tabs?";
|
||||
public static final String CLEAR_TAB_DESC = "This will clear all stored tabs";
|
||||
public static final String CLEAR_TAB_BT_1 = "Clear";
|
||||
|
||||
public static final String clear_bookmark_title = "Clear site bookmark?";
|
||||
public static final String clear_bookmark_desc = "This will clear data for all saved sites\n";
|
||||
public static final String clear_bookmark_bt1 = "Clear";
|
||||
public static final String clear_bookmark_bt2 = "Dismiss";
|
||||
|
||||
public static final String DOWNLOAD_TITLE = "Download Notification";
|
||||
public static final String DOWNLOAD_MESSAGE = "Download File | ";
|
||||
public static final String DOWNLOAD_POSITIVE = "Download";
|
||||
|
||||
public static final String BRIDGE_MAIL_TITLE = "Request New Bridge";
|
||||
public static final String BRIDGE_MAIL_MESSAGE = "You can get a bridge address through email, the web or by scanning a bridge QR code. Select 'Email' below to request a bridge address.\n\nOnce you have an address, copy & paste it into the above box and start.";
|
||||
public static final String BRIDGE_MAIL_POSITIVE = "EMAIL";
|
||||
|
||||
public static final String LONG_URL_TITLE = "URL Notification";
|
||||
public static final String LONG_URL_MESSAGE = "";
|
||||
public static final String LONG_URL_OPTION_1 = "Open In New Tab";
|
||||
public static final String LONG_URL_OPTION_2 = "Open In Current Tab";
|
||||
public static final String LONG_URL_OPTION_3 = "Copy to Clipboard";
|
||||
public static final String LONG_URL_OPTION_4 = "Download this file";
|
||||
|
||||
public static final String LONG_URL_FULL_MESSAGE = "URL Description";
|
||||
public static final String LONG_URL_FULL_OPTION_1 = "Open url in new tab";
|
||||
public static final String LONG_URL_FULL_OPTION_2 = "Open url in current tab";
|
||||
public static final String LONG_URL_FULL_OPTION_3 = "Copy url to clipboard";
|
||||
public static final String LONG_URL_FULL_OPTION_4 = "Open image in new tab";
|
||||
public static final String LONG_URL_FULL_OPTION_5 = "Open image current tab";
|
||||
public static final String LONG_URL_FULL_OPTION_6 = "Copy image to clipboard";
|
||||
public static final String LONG_URL_FULL_OPTION_7 = "Download image file";
|
||||
|
||||
public static final String BANNED_TITLE = "Is Tor Bannned In Your Country?";
|
||||
public static final String BANNED_DESC = "Enable free GATEWAY to tunnel through banned configuration | Use it only if tor is banned in your country";
|
||||
|
||||
/*History Manager*/
|
||||
public static final String H_HISTORY_TITLE = "history";
|
||||
public static final String HISTORY_TITLE = "history";
|
||||
public static final String HISTORY_CLEAR_HISTORY = "CLEAR HISTORY";
|
||||
public static final String HISTORY_NO_HISTORY_FOUND = "NO HISTORY FOUND";
|
||||
|
||||
|
||||
/*Tab Manager*/
|
||||
|
||||
public static final String CLEAR_TABS = "CLEAR TABS";
|
||||
/*Bookmark Manager*/
|
||||
public static final String BOOKMARK_CLEAR_BOOKMARK = "CLEAR HISTORY";
|
||||
public static final String BOOKMARK_NO_BOOKMARK_FOUND = "NO BOOKMARK FOUND";
|
||||
|
||||
/*Bridge Manager*/
|
||||
|
||||
public static final String CUSTOM_BRIDGE_OBFS4 = "obfs4";
|
||||
public static final String CUSTOM_BRIDGE_MEEK = "meek";
|
||||
public static final String CUSTOM_BRIDGE_CUSTOM = "custom";
|
||||
public static final String BRIDGE_CUSTOM_BRIDGE_OBFS4 = "obfs4";
|
||||
public static final String BRIDGE_CUSTOM_BRIDGE_MEEK = "meek";
|
||||
public static final String BRIDGE_CUSTOM_BRIDGE_CUSTOM = "custom";
|
||||
|
||||
/*Text Manager*/
|
||||
/*Generic*/
|
||||
|
||||
public static final String DARK_WEB = "Hidden Web";
|
||||
public static final String EMPTY_STR = "";
|
||||
public static final String EMPTY_SPACE = " ";
|
||||
public static final String GENERIC_EMPTY_STR = "";
|
||||
public static final String GENERIC_EMPTY_SPACE = " ";
|
||||
|
||||
/*Settings Manager*/
|
||||
|
||||
public static final String CUSTOM_FONTS = "Custom Font";
|
||||
public static final String PERCENT_SIGN = "%";
|
||||
public static final String DEFAULT_LANGUAGE = "en";
|
||||
|
||||
/*Bookmark Manager*/
|
||||
|
||||
public static final String CLEAR_BOOKMARK = "CLEAR BOOKMARK";
|
||||
public static final String SETTING_CUSTOM_FONTS = "Custom Font";
|
||||
public static final String SETTING_PERCENT_SIGN = "%";
|
||||
public static final String SETTING_DEFAULT_LANGUAGE = "en";
|
||||
|
||||
/*Home Manager*/
|
||||
|
||||
public static final String BLANK_PAGE = "about:blank";
|
||||
public static final String HOME_BLANK_PAGE = "about:blank";
|
||||
|
||||
/*Events*/
|
||||
|
||||
public static final String APP_STARTED = "APP_STARTED";
|
||||
public static final String PROXY_CHANGED = "PROXY_CHANGED";
|
||||
public static final String APP_RESTARTED = "APP_RESTARTED";
|
||||
public static final String APP_FINISHED = "APP_FINISHED";
|
||||
public static final String SEARCH_SWITCH = "SEARCH_SWITCH";
|
||||
public static final String SETTINGS_OPENED = "SETTINGS_OPENED";
|
||||
public static final String URL_BOOKMARKED = "URL_BOOKMARKED";
|
||||
public static final String BOOKMARK_OPENED = "BOOKMARK_OPENED";
|
||||
public static final String TAB_OPENED = "TAB_OPENED";
|
||||
public static final String GATEWAY_OPENED = "GATEWAY_OPENED";
|
||||
public static final String HISTORY_OPENED = "HISTORY_OPENED";
|
||||
public static final String HISTORY_TRIGGERED = "HISTORY_TRIGGERED";
|
||||
public static final String BOOKMARK_TRIGGERED = "BOOKMARK_TRIGGERED";
|
||||
public static final String TAB_TRIGGERED = "TAB_TRIGGERED";
|
||||
public static final String URL_ERROR = "URL_ERROR";
|
||||
public static final String URL_ERROR_NOT_LOADED = "URL_ERROR_NOT_LOADED";
|
||||
public static final String PAGE_OPENED_SUCCESS = "PAGE_OPENED_SUCCESS";
|
||||
public static final String HOME_INVOKED = "HOME_INVOKED";
|
||||
public static final String SEARCH_INVOKED = "SEARCH_INVOKED";
|
||||
public static final String MENU_INVOKED = "MENU_INVOKED";
|
||||
public static final String ON_BACK = "ON_BACK";
|
||||
public static final String EVENT_APP_STARTED = "APP_STARTED";
|
||||
public static final String EVENT_SEARCH_SWITCH = "SEARCH_SWITCH";
|
||||
public static final String EVENT_SETTINGS_OPENED = "SETTINGS_OPENED";
|
||||
public static final String EVENT_URL_BOOKMARKED = "URL_BOOKMARKED";
|
||||
public static final String EVENT_BOOKMARK_OPENED = "BOOKMARK_OPENED";
|
||||
public static final String EVENT_TAB_OPENED = "TAB_OPENED";
|
||||
public static final String EVENT_GATEWAY_OPENED = "GATEWAY_OPENED";
|
||||
public static final String EVENT_HISTORY_OPENED = "HISTORY_OPENED";
|
||||
public static final String EVENT_HISTORY_TRIGGERED = "HISTORY_TRIGGERED";
|
||||
public static final String EVENT_BOOKMARK_TRIGGERED = "BOOKMARK_TRIGGERED";
|
||||
public static final String EVENT_TAB_TRIGGERED = "TAB_TRIGGERED";
|
||||
public static final String EVENT_PAGE_OPENED_SUCCESS = "PAGE_OPENED_SUCCESS";
|
||||
public static final String EVENT_HOME_INVOKED = "HOME_INVOKED";
|
||||
public static final String EVENT_SEARCH_INVOKED = "SEARCH_INVOKED";
|
||||
public static final String EVENT_MENU_INVOKED = "MENU_INVOKED";
|
||||
public static final String EVENT_ON_BACK = "ON_BACK";
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,77 @@
|
|||
package com.darkweb.genesissearchengine.dataManager;
|
||||
|
||||
import com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkRowModel;
|
||||
import com.darkweb.genesissearchengine.appManager.databaseManager.databaseController;
|
||||
import com.darkweb.genesissearchengine.constants.constants;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class bookmarkDataModel {
|
||||
|
||||
private ArrayList<bookmarkRowModel> mBookmarks;
|
||||
|
||||
public bookmarkDataModel(){
|
||||
mBookmarks = new ArrayList<>();
|
||||
}
|
||||
|
||||
void initializebookmark(ArrayList<bookmarkRowModel> pBookmark){
|
||||
mBookmarks = pBookmark;
|
||||
}
|
||||
|
||||
private ArrayList<bookmarkRowModel> getBookmark() {
|
||||
return mBookmarks;
|
||||
}
|
||||
|
||||
void addBookmark(String url, String title){
|
||||
if(url.length()>1500){
|
||||
return;
|
||||
}
|
||||
int autoval = 0;
|
||||
if(mBookmarks.size()> constants.CONST_MAX_BOOKMARK_SIZE)
|
||||
{
|
||||
databaseController.getInstance().execSQL("delete from bookmark where id="+ mBookmarks.get(mBookmarks.size()-1).getID(),null);
|
||||
}
|
||||
|
||||
if(mBookmarks.size()>0)
|
||||
{
|
||||
autoval = mBookmarks.get(0).getID()+1;
|
||||
}
|
||||
|
||||
if(title.equals(""))
|
||||
{
|
||||
title = "New_Bookmark"+autoval;
|
||||
}
|
||||
|
||||
String[] params = new String[2];
|
||||
params[0] = title;
|
||||
params[1] = url;
|
||||
|
||||
databaseController.getInstance().execSQL("INSERT INTO bookmark(id,title,url) VALUES("+autoval+",?,?);",params);
|
||||
mBookmarks.add(0,new bookmarkRowModel(title, url,autoval));
|
||||
}
|
||||
|
||||
void clearBookmark(int pID) {
|
||||
for(int mCounter=0;mCounter<mBookmarks.size();mCounter++){
|
||||
if(mBookmarks.get(mCounter).getID()==pID){
|
||||
mBookmarks.remove(mCounter);
|
||||
}
|
||||
}
|
||||
databaseController.getInstance().execSQL("delete from bookmark where id="+ pID,null);
|
||||
}
|
||||
|
||||
public Object onTrigger(dataEnums.eBookmarkCommands p_commands, List<Object> p_data){
|
||||
if(p_commands == dataEnums.eBookmarkCommands.M_GET_BOOKMARK){
|
||||
return getBookmark();
|
||||
}
|
||||
if(p_commands == dataEnums.eBookmarkCommands.M_ADD_BOOKMARK){
|
||||
addBookmark((String)p_data.get(0), (String)p_data.get(1));
|
||||
}
|
||||
if(p_commands == dataEnums.eBookmarkCommands.M_DELETE_BOOKMARK){
|
||||
clearBookmark((int)p_data.get(0));
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -2,7 +2,6 @@ package com.darkweb.genesissearchengine.dataManager;
|
|||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import com.darkweb.genesissearchengine.appManager.activityContextManager;
|
||||
import com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkRowModel;
|
||||
import com.darkweb.genesissearchengine.appManager.databaseManager.databaseController;
|
||||
import com.darkweb.genesissearchengine.appManager.historyManager.historyRowModel;
|
||||
import com.darkweb.genesissearchengine.appManager.homeManager.geckoSession;
|
||||
|
@ -19,10 +18,11 @@ public class dataController
|
|||
{
|
||||
/*Private Variables*/
|
||||
|
||||
private dataModel m_data_model;
|
||||
private preferenceDataModel m_preference_model;
|
||||
private historyDataModel m_history_model;
|
||||
private imageCacheModel m_image_cache_model;
|
||||
private dataModel mDataModel;
|
||||
private preferenceDataModel mPreferenceModel;
|
||||
private historyDataModel mHistoryModel;
|
||||
private imageCacheModel mImageCacheModel;
|
||||
private bookmarkDataModel mBookMarkDataModel;
|
||||
|
||||
/*Private Declarations*/
|
||||
|
||||
|
@ -35,17 +35,18 @@ public class dataController
|
|||
/*Initializations*/
|
||||
|
||||
public void initialize(AppCompatActivity app_context){
|
||||
m_history_model = new historyDataModel();
|
||||
m_data_model = new dataModel();
|
||||
m_preference_model = new preferenceDataModel(app_context);
|
||||
m_image_cache_model = new imageCacheModel();
|
||||
m_data_model.initializeBookmarks();
|
||||
mHistoryModel = new historyDataModel();
|
||||
mDataModel = new dataModel();
|
||||
mPreferenceModel = new preferenceDataModel(app_context);
|
||||
mImageCacheModel = new imageCacheModel();
|
||||
mBookMarkDataModel = new bookmarkDataModel();
|
||||
}
|
||||
public void initializeListData(){
|
||||
m_data_model.initSuggestions();
|
||||
if(!status.sHistoryStatus)
|
||||
mDataModel.initSuggestions();
|
||||
mBookMarkDataModel.initializebookmark(databaseController.getInstance().selectBookmark());
|
||||
if(!status.sSettingHistoryStatus)
|
||||
{
|
||||
m_history_model.onTrigger(dataEnums.eHistoryCommands.M_INITIALIZE_HISTORY, Arrays.asList(databaseController.getInstance().selectHistory(0,constants.FETCHABLE_LIST_SIZE), databaseController.getInstance().getLargestHistoryID(),databaseController.getInstance().getLargestHistoryID()));
|
||||
mHistoryModel.onTrigger(dataEnums.eHistoryCommands.M_INITIALIZE_HISTORY, Arrays.asList(databaseController.getInstance().selectHistory(0,constants.CONST_FETCHABLE_LIST_SIZE), databaseController.getInstance().getLargestHistoryID(),databaseController.getInstance().getLargestHistoryID()));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -56,21 +57,27 @@ public class dataController
|
|||
/*Recieving History*/
|
||||
public Object invokeHistory(dataEnums.eHistoryCommands p_commands, List<Object> p_data){
|
||||
if(p_commands.equals(dataEnums.eHistoryCommands.M_LOAD_MORE_HISTORY)){
|
||||
int m_history_size = (int)m_history_model.onTrigger(dataEnums.eHistoryCommands.M_HISTORY_SIZE,null);
|
||||
return m_history_model.onTrigger(p_commands, Collections.singletonList(databaseController.getInstance().selectHistory(m_history_size+1,constants.FETCHABLE_LIST_SIZE)));
|
||||
int m_history_size = (int) mHistoryModel.onTrigger(dataEnums.eHistoryCommands.M_HISTORY_SIZE,null);
|
||||
return mHistoryModel.onTrigger(p_commands, Collections.singletonList(databaseController.getInstance().selectHistory(m_history_size+1,constants.CONST_FETCHABLE_LIST_SIZE)));
|
||||
}else {
|
||||
return m_history_model.onTrigger(p_commands, p_data);
|
||||
return mHistoryModel.onTrigger(p_commands, p_data);
|
||||
}
|
||||
}
|
||||
|
||||
/*Recieving Images*/
|
||||
public Object invokeImageCache(dataEnums.eImageCacheCommands p_commands, List<Object> p_data){
|
||||
return m_image_cache_model.onTrigger(p_commands, p_data);
|
||||
return mImageCacheModel.onTrigger(p_commands, p_data);
|
||||
}
|
||||
|
||||
/*Recieving Preferences*/
|
||||
public Object invokePrefs(dataEnums.ePreferencesCommands p_commands, List<Object> p_data){
|
||||
return m_preference_model.onTrigger(p_commands, p_data);
|
||||
return mPreferenceModel.onTrigger(p_commands, p_data);
|
||||
}
|
||||
|
||||
|
||||
/*Recieving History*/
|
||||
public Object invokeBookmark(dataEnums.eBookmarkCommands p_commands, List<Object> p_data){
|
||||
return mBookMarkDataModel.onTrigger(p_commands, p_data);
|
||||
}
|
||||
|
||||
|
||||
|
@ -91,58 +98,44 @@ public class dataController
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
/*Recieving Bookmarks*/
|
||||
|
||||
public ArrayList<bookmarkRowModel> getBookmark(){
|
||||
return m_data_model.getBookmark();
|
||||
}
|
||||
public void addBookmark(String url,String title){
|
||||
m_data_model.addBookmark(url,title);
|
||||
}
|
||||
public void clearBookmark(){
|
||||
m_data_model.clearBookmark();
|
||||
}
|
||||
|
||||
/*Recieving Suggestions*/
|
||||
|
||||
public ArrayList<historyRowModel> getSuggestions(){
|
||||
return m_data_model.getmSuggestions();
|
||||
return mDataModel.getmSuggestions();
|
||||
}
|
||||
|
||||
/*Recieving Tabs*/
|
||||
|
||||
public ArrayList<tabRowModel> getTab(){
|
||||
return m_data_model.getTab();
|
||||
return mDataModel.getTab();
|
||||
}
|
||||
public void addTab(geckoSession mSession,boolean isHardCopy){
|
||||
m_data_model.addTabs(mSession,isHardCopy);
|
||||
mDataModel.addTabs(mSession,isHardCopy);
|
||||
}
|
||||
public void clearTabs(){
|
||||
m_data_model.clearTab();
|
||||
mDataModel.clearTab();
|
||||
}
|
||||
public void closeTab(geckoSession session){
|
||||
m_data_model.closeTab(session);
|
||||
mDataModel.closeTab(session);
|
||||
}
|
||||
public void moveTabToTop(geckoSession session){
|
||||
m_data_model.moveTabToTop(session);
|
||||
mDataModel.moveTabToTop(session);
|
||||
}
|
||||
public tabRowModel getCurrentTab(){
|
||||
return m_data_model.getCurrentTab();
|
||||
return mDataModel.getCurrentTab();
|
||||
}
|
||||
public int getTotalTabs(){
|
||||
return m_data_model.getTotalTabs();
|
||||
return mDataModel.getTotalTabs();
|
||||
}
|
||||
|
||||
public void updateSuggestionURL(String url,String title) {
|
||||
url = helperMethod.removeLastSlash(url);
|
||||
m_data_model.updateSuggestionURL(url,title,false);
|
||||
mDataModel.updateSuggestionURL(url,title,false);
|
||||
activityContextManager.getInstance().getHomeController().onSuggestionUpdate();
|
||||
}
|
||||
public void addSuggesion(String url,String title) {
|
||||
url = helperMethod.removeLastSlash(url);
|
||||
m_data_model.addSuggenstions(url,title,false);
|
||||
mDataModel.addSuggenstions(url,title,false);
|
||||
activityContextManager.getInstance().getHomeController().onSuggestionUpdate();
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,10 @@ public class dataEnums
|
|||
M_GET_HISTORY, M_ADD_HISTORY, M_REMOVE_HISTORY, M_CLEAR_HISTORY, M_LOAD_MORE_HISTORY, M_INITIALIZE_HISTORY, M_HISTORY_SIZE
|
||||
}
|
||||
|
||||
public enum eBookmarkCommands {
|
||||
M_ADD_BOOKMARK, M_GET_BOOKMARK, M_DELETE_BOOKMARK, M_CLEAR_BOOKMARK;
|
||||
}
|
||||
|
||||
public enum ePreferencesCommands{
|
||||
M_SET_STRING, M_SET_BOOL, M_SET_INT, M_SET_FLOAT, M_GET_STRING, M_GET_BOOL, M_GET_INT, M_GET_FLOAT, M_CLEAR_PREFS
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.darkweb.genesissearchengine.dataManager;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkRowModel;
|
||||
|
||||
import com.darkweb.genesissearchengine.appManager.databaseManager.databaseController;
|
||||
import com.darkweb.genesissearchengine.appManager.historyManager.historyRowModel;
|
||||
import com.darkweb.genesissearchengine.appManager.homeManager.geckoSession;
|
||||
|
@ -15,7 +15,6 @@ import java.util.Map;
|
|||
@SuppressLint("CommitPrefEdits")
|
||||
class dataModel
|
||||
{
|
||||
private ArrayList<bookmarkRowModel> mBookmarks = new ArrayList<>();
|
||||
private ArrayList<tabRowModel> mTabs = new ArrayList<>();
|
||||
private ArrayList<historyRowModel> mSuggestions = new ArrayList<>();
|
||||
private Map<String, historyRowModel> mSuggestionCache = new HashMap<>();
|
||||
|
@ -70,44 +69,6 @@ class dataModel
|
|||
}
|
||||
}
|
||||
|
||||
/*List Bookmark*/
|
||||
|
||||
void initializeBookmarks(){
|
||||
mBookmarks = databaseController.getInstance().selectBookmark();
|
||||
}
|
||||
void addBookmark(String url, String title){
|
||||
if(url.length()>1500){
|
||||
return;
|
||||
}
|
||||
int autoval = 0;
|
||||
if(mBookmarks.size()> constants.MAX_LIST_SIZE)
|
||||
{
|
||||
databaseController.getInstance().execSQL("delete from bookmark where id="+ mBookmarks.get(mBookmarks.size()-1).getmId(),null);
|
||||
}
|
||||
|
||||
if(mBookmarks.size()>0)
|
||||
{
|
||||
autoval = mBookmarks.get(0).getmId()+1;
|
||||
}
|
||||
|
||||
if(title.equals(""))
|
||||
{
|
||||
title = "New_Bookmark"+autoval;
|
||||
}
|
||||
|
||||
String[] params = new String[2];
|
||||
params[0] = title;
|
||||
params[1] = url;
|
||||
|
||||
databaseController.getInstance().execSQL("INSERT INTO bookmark(id,title,url) VALUES("+autoval+",?,?);",params);
|
||||
mBookmarks.add(0,new bookmarkRowModel(url,title,autoval));
|
||||
}
|
||||
ArrayList<bookmarkRowModel> getBookmark(){
|
||||
return mBookmarks;
|
||||
}
|
||||
void clearBookmark() {
|
||||
mBookmarks.clear();
|
||||
}
|
||||
|
||||
/*List Tabs*/
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ import com.darkweb.genesissearchengine.helperManager.helperMethod;
|
|||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
@ -30,7 +29,7 @@ public class historyDataModel {
|
|||
m_max_history_Id = pMaxHistoryId;
|
||||
m_history_size = pHistorySize;
|
||||
this.m_history = history;
|
||||
if(!status.sHistoryStatus){
|
||||
if(!status.sSettingHistoryStatus){
|
||||
initializeCache(history);
|
||||
}else {
|
||||
clearHistory();
|
||||
|
@ -101,9 +100,9 @@ public class historyDataModel {
|
|||
databaseController.getInstance().execSQL("UPDATE history SET date = '" + m_date + "' , url = ? , title = ? WHERE id="+p_id,params);
|
||||
return p_id;
|
||||
}else {
|
||||
if(m_history_size > constants.MAX_LIST_DATA_SIZE)
|
||||
if(m_history_size > constants.CONST_MAX_LIST_DATA_SIZE)
|
||||
{
|
||||
databaseController.getInstance().execSQL("DELETE FROM history WHERE id IN (SELECT id FROM History ORDER BY id ASC LIMIT "+(constants.MAX_LIST_DATA_SIZE /2)+")",null);
|
||||
databaseController.getInstance().execSQL("DELETE FROM history WHERE id IN (SELECT id FROM History ORDER BY id ASC LIMIT "+(constants.CONST_MAX_LIST_DATA_SIZE /2)+")",null);
|
||||
}
|
||||
|
||||
if(p_header.equals("loading")){
|
||||
|
@ -127,7 +126,7 @@ public class historyDataModel {
|
|||
}
|
||||
private void removeHistory(int p_id){
|
||||
databaseController.getInstance().execSQL("DELETE FROM history WHERE id = "+p_id,null);
|
||||
databaseController.getInstance().selectHistory(0,constants.FETCHABLE_LIST_SIZE);
|
||||
databaseController.getInstance().selectHistory(0,constants.CONST_FETCHABLE_LIST_SIZE);
|
||||
m_history_cache.remove(p_id);
|
||||
m_history_size -= 1;
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@ package com.darkweb.genesissearchengine.helperManager;
|
|||
import android.app.Activity;
|
||||
import android.app.Service;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.text.TextUtils;
|
||||
|
@ -55,7 +54,7 @@ public class LocaleManager {
|
|||
|
||||
private static void setContextLocale(Context context, Locale selectedLocale) {
|
||||
Configuration configuration = context.getResources().getConfiguration();
|
||||
configuration.locale = new Locale(status.sLanguage);
|
||||
configuration.locale = new Locale(status.sSettingLanguage);
|
||||
context.getResources().updateConfiguration(
|
||||
configuration,
|
||||
context.getResources().getDisplayMetrics()
|
||||
|
|
|
@ -41,7 +41,7 @@ public class autoCompleteAdapter extends ArrayAdapter<historyRowModel> {
|
|||
TextView myTv = v.findViewById( R.id.hintCompletionUrl);
|
||||
|
||||
if (customerNameLabel != null) {
|
||||
if(customer.getHeader().equals(strings.EMPTY_STR)){
|
||||
if(customer.getHeader().equals(strings.GENERIC_EMPTY_STR)){
|
||||
customerNameLabel.setText(customer.getHeader() );
|
||||
}else {
|
||||
customerNameLabel.setText(customer.getHeader());
|
||||
|
@ -61,7 +61,7 @@ public class autoCompleteAdapter extends ArrayAdapter<historyRowModel> {
|
|||
@Override
|
||||
public String convertResultToString(Object resultValue) {
|
||||
if(resultValue==null){
|
||||
return strings.EMPTY_STR;
|
||||
return strings.GENERIC_EMPTY_STR;
|
||||
}
|
||||
historyRowModel model = (historyRowModel)(resultValue);
|
||||
String str = model.getHeader();
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package com.darkweb.genesissearchengine.helperManager;
|
||||
|
||||
import android.webkit.URLUtil;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.darkweb.genesissearchengine.constants.strings;
|
||||
|
@ -167,7 +165,7 @@ public class errorHandler
|
|||
}
|
||||
private String createErrorPage(final String error,String url) {
|
||||
if(error==null){
|
||||
return strings.EMPTY_STR;
|
||||
return strings.GENERIC_EMPTY_STR;
|
||||
}
|
||||
|
||||
if (mErrorTemplate == null) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.darkweb.genesissearchengine.helperManager;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.ActivityManager;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.DownloadManager;
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
|
@ -11,20 +11,23 @@ import android.content.pm.PackageManager;
|
|||
import android.content.res.Resources;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Point;
|
||||
import android.net.NetworkInfo;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Vibrator;
|
||||
import android.text.SpannableString;
|
||||
import android.text.Spanned;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.util.Log;
|
||||
import android.view.Display;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.animation.Animation;
|
||||
import android.view.animation.RotateAnimation;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.ActionMenuView;
|
||||
import android.widget.PopupWindow;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
@ -36,13 +39,12 @@ import com.darkweb.genesissearchengine.constants.keys;
|
|||
import com.darkweb.genesissearchengine.dataManager.dataController;
|
||||
import com.darkweb.genesissearchengine.dataManager.dataEnums;
|
||||
import com.example.myapplication.BuildConfig;
|
||||
import com.example.myapplication.R;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.util.ArrayList;
|
||||
|
@ -51,6 +53,7 @@ import java.util.List;
|
|||
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
|
||||
import static android.content.Context.LAYOUT_INFLATER_SERVICE;
|
||||
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
|
||||
import static android.content.Intent.FLAG_ACTIVITY_NO_ANIMATION;
|
||||
|
||||
|
@ -144,7 +147,7 @@ public class helperMethod
|
|||
}
|
||||
|
||||
public static void rateApp(AppCompatActivity context){
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.IS_APP_RATED,true));
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.PROXY_IS_APP_RATED,true));
|
||||
context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=com.darkweb.genesissearchengine")));
|
||||
}
|
||||
|
||||
|
@ -166,6 +169,11 @@ public class helperMethod
|
|||
.startChooser();
|
||||
}
|
||||
|
||||
public static void vibrate(AppCompatActivity context) {
|
||||
Vibrator v = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
|
||||
v.vibrate(50);
|
||||
}
|
||||
|
||||
public static void shareURL(AppCompatActivity context, String p_share) {
|
||||
ShareCompat.IntentBuilder.from(context)
|
||||
.setType("text/plain")
|
||||
|
@ -240,7 +248,7 @@ public class helperMethod
|
|||
|
||||
public static void openActivity( Class<?> cls,int type,AppCompatActivity context,boolean animation){
|
||||
Intent myIntent = new Intent(context, cls);
|
||||
myIntent.putExtra(keys.list_type, type);
|
||||
myIntent.putExtra(keys.PROXY_LIST_TYPE, type);
|
||||
if(!animation){
|
||||
myIntent.addFlags(FLAG_ACTIVITY_NO_ANIMATION);
|
||||
}
|
||||
|
@ -371,4 +379,32 @@ public class helperMethod
|
|||
intent.setData(Uri.parse("package:" + context.getPackageName()));
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
public static PopupWindow onCreateMenu(View p_view, int p_layout) {
|
||||
PopupWindow popupWindow = null;
|
||||
if(popupWindow!=null){
|
||||
popupWindow.dismiss();
|
||||
}
|
||||
|
||||
LayoutInflater layoutInflater
|
||||
= (LayoutInflater) p_view.getContext()
|
||||
.getSystemService(LAYOUT_INFLATER_SERVICE);
|
||||
@SuppressLint("InflateParams") final View popupView = layoutInflater.inflate(p_layout, null);
|
||||
|
||||
|
||||
popupWindow = new PopupWindow(
|
||||
popupView,
|
||||
ActionMenuView.LayoutParams.WRAP_CONTENT,
|
||||
ActionMenuView.LayoutParams.WRAP_CONTENT, true);
|
||||
|
||||
popupWindow.setOutsideTouchable(true);
|
||||
popupWindow.setFocusable(true);
|
||||
popupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
popupWindow.setAnimationStyle(R.style.popup_window_animation);
|
||||
popupWindow.showAtLocation(p_view, Gravity.TOP|Gravity.END,0,0);
|
||||
popupWindow.setElevation(7);
|
||||
|
||||
return popupWindow;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
184
app/src/main/java/com/darkweb/genesissearchengine/pluginManager/admanager.java
Normal file → Executable file
184
app/src/main/java/com/darkweb/genesissearchengine/pluginManager/admanager.java
Normal file → Executable file
|
@ -1,93 +1,91 @@
|
|||
package com.darkweb.genesissearchengine.pluginManager;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import com.darkweb.genesissearchengine.constants.constants;
|
||||
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
||||
import com.google.android.gms.ads.*;
|
||||
|
||||
import static com.darkweb.genesissearchengine.constants.status.paid_status;
|
||||
|
||||
class adManager
|
||||
{
|
||||
|
||||
/*Private Variables*/
|
||||
|
||||
private AppCompatActivity mAppContext;
|
||||
private eventObserver.eventListener mEvent;
|
||||
private AdView mBannerAds;
|
||||
private boolean bannerAdsLoading = false;
|
||||
private boolean bannerAdsLoaded = false;
|
||||
|
||||
/*Initializations*/
|
||||
|
||||
adManager(AppCompatActivity app_context, eventObserver.eventListener event, AdView banner_ads) {
|
||||
this.mAppContext = app_context;
|
||||
this.mEvent = event;
|
||||
mBannerAds = banner_ads;
|
||||
}
|
||||
|
||||
void loadAds(){
|
||||
if(!paid_status)
|
||||
{
|
||||
if (!bannerAdsLoading)
|
||||
{
|
||||
bannerAdsLoading = true;
|
||||
MobileAds.initialize(mAppContext, constants.ADMOB_KEY);
|
||||
mBannerAds.setAlpha(0f);
|
||||
initializeBannerAds();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
boolean isAdvertLoaded(){
|
||||
return bannerAdsLoaded;
|
||||
}
|
||||
|
||||
/*Local Helper Methods*/
|
||||
|
||||
private void admobListeners(){
|
||||
if(!paid_status){
|
||||
mBannerAds.setAdListener(new AdListener() {
|
||||
@Override
|
||||
public void onAdLoaded() {
|
||||
bannerAdsLoaded = true;
|
||||
mEvent.invokeObserver(null,null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdFailedToLoad(int errorCode) {
|
||||
//Log.i("Failure___",""+errorCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdOpened() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdClicked() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdLeftApplication() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdClosed() {
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/*External Helper Methods*/
|
||||
|
||||
private void initializeBannerAds(){
|
||||
if(!paid_status){
|
||||
AdRequest request = new AdRequest.Builder().addTestDevice("E731DE5933CDC0E42B335787CE3E23EF").build();
|
||||
mBannerAds.loadAd(request);
|
||||
admobListeners();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
package com.darkweb.genesissearchengine.pluginManager;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import com.darkweb.genesissearchengine.constants.constants;
|
||||
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
||||
import com.google.android.gms.ads.*;
|
||||
|
||||
import static com.darkweb.genesissearchengine.constants.status.sPaidStatus;
|
||||
|
||||
class adManager
|
||||
{
|
||||
|
||||
/*Private Variables*/
|
||||
|
||||
private AppCompatActivity mAppContext;
|
||||
private eventObserver.eventListener mEvent;
|
||||
private AdView mBannerAds;
|
||||
private boolean bannerAdsLoading = false;
|
||||
private boolean bannerAdsLoaded = false;
|
||||
|
||||
/*Initializations*/
|
||||
|
||||
adManager(AppCompatActivity app_context, eventObserver.eventListener event, AdView banner_ads) {
|
||||
this.mAppContext = app_context;
|
||||
this.mEvent = event;
|
||||
mBannerAds = banner_ads;
|
||||
}
|
||||
|
||||
void loadAds(){
|
||||
if(!sPaidStatus)
|
||||
{
|
||||
if (!bannerAdsLoading)
|
||||
{
|
||||
bannerAdsLoading = true;
|
||||
MobileAds.initialize(mAppContext, constants.CONST_ADMOB_KEY);
|
||||
mBannerAds.setAlpha(0f);
|
||||
initializeBannerAds();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
boolean isAdvertLoaded(){
|
||||
return bannerAdsLoaded;
|
||||
}
|
||||
|
||||
/*Local Helper Methods*/
|
||||
|
||||
private void admobListeners(){
|
||||
if(!sPaidStatus){
|
||||
mBannerAds.setAdListener(new AdListener() {
|
||||
@Override
|
||||
public void onAdLoaded() {
|
||||
bannerAdsLoaded = true;
|
||||
mEvent.invokeObserver(null,null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdFailedToLoad(int errorCode) {
|
||||
//Log.i("Failure___",""+errorCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdOpened() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdClicked() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdLeftApplication() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdClosed() {
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/*External Helper Methods*/
|
||||
|
||||
private void initializeBannerAds(){
|
||||
if(!sPaidStatus){
|
||||
AdRequest request = new AdRequest.Builder().addTestDevice("E731DE5933CDC0E42B335787CE3E23EF").build();
|
||||
mBannerAds.loadAd(request);
|
||||
admobListeners();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ class analyticManager
|
|||
}
|
||||
|
||||
private void initialize(){
|
||||
final String PREF_UNIQUE_ID = constants.UNIQUE_KEY_ID;
|
||||
final String PREF_UNIQUE_ID = constants.CONST_UNIQUE_KEY_ID;
|
||||
|
||||
if (mUniqueID == null)
|
||||
{
|
||||
|
|
|
@ -1,17 +1,22 @@
|
|||
package com.darkweb.genesissearchengine.pluginManager;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.net.Uri;
|
||||
import android.os.Handler;
|
||||
import android.text.InputType;
|
||||
import android.view.Gravity;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.EditText;
|
||||
import android.widget.PopupMenu;
|
||||
import android.widget.RatingBar;
|
||||
import android.widget.TextView;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import com.crowdfire.cfalertdialog.CFAlertDialog;
|
||||
|
||||
import com.darkweb.genesissearchengine.appManager.activityContextManager;
|
||||
import com.darkweb.genesissearchengine.constants.constants;
|
||||
import com.darkweb.genesissearchengine.constants.enums;
|
||||
import com.darkweb.genesissearchengine.constants.status;
|
||||
|
@ -27,319 +32,213 @@ class messageManager
|
|||
{
|
||||
/*Private Variables*/
|
||||
|
||||
private boolean is_popup_open = false;
|
||||
private CFAlertDialog.Builder popup_instance;
|
||||
private List<String> data;
|
||||
private boolean isDialogDismissed = true;
|
||||
|
||||
private AppCompatActivity app_context;
|
||||
private eventObserver.eventListener event;
|
||||
private CFAlertDialog dialog_main = null;
|
||||
|
||||
|
||||
Dialog dialog = null;
|
||||
|
||||
/*Initializations*/
|
||||
|
||||
messageManager(eventObserver.eventListener event)
|
||||
{
|
||||
this.event = event;
|
||||
initialize();
|
||||
}
|
||||
|
||||
private void initialize()
|
||||
{
|
||||
popup_instance = new CFAlertDialog.Builder(app_context);
|
||||
}
|
||||
|
||||
private void onDismissListener()
|
||||
{
|
||||
popup_instance.onDismissListener(dialogInterface -> is_popup_open = false);
|
||||
}
|
||||
|
||||
/*Helper Methods*/
|
||||
private void welcomeMessage()
|
||||
{
|
||||
popup_instance.setDialogStyle(CFAlertDialog.CFAlertStyle.ALERT)
|
||||
.setTitle(app_context.getString(R.string.WELCOME_MESSAGE_TITLE))
|
||||
.setBackgroundColor(app_context.getResources().getColor(R.color.holo_dark_gray_alpha_v1))
|
||||
.setTextColor(app_context.getResources().getColor(R.color.blue_dark))
|
||||
.setMessage(app_context.getString(R.string.WELCOME_MESSAGE_DESC))
|
||||
.onDismissListener(dialog -> is_popup_open = false)
|
||||
.addButton(app_context.getString(R.string.WELCOME_MESSAGE_BT_1), -1, Color.rgb(77,136,255 ), CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (DialogInterface tempDialog, int which) ->
|
||||
{
|
||||
tempDialog.dismiss();
|
||||
event.invokeObserver(Collections.singletonList(constants.BLACK_MARKET_URL), enums.etype.welcome);
|
||||
})
|
||||
.addButton(app_context.getString(R.string.WELCOME_MESSAGE_BT_2), -1, Color.rgb(77,136,255 ), CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (tempDialog, which) ->
|
||||
{
|
||||
tempDialog.dismiss();
|
||||
event.invokeObserver(Collections.singletonList(constants.LEAKED_DOCUMENT_URL), enums.etype.welcome);
|
||||
})
|
||||
.addButton(app_context.getString(R.string.WELCOME_MESSAGE_BT_3), -1, Color.rgb(77,136,255 ), CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (tempDialog, which) ->
|
||||
{
|
||||
tempDialog.dismiss();
|
||||
event.invokeObserver(Collections.singletonList(constants.NEWS_URL), enums.etype.welcome);
|
||||
})
|
||||
.addButton(app_context.getString(R.string.WELCOME_MESSAGE_BT_4), -1, Color.rgb(77,136,255 ), CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (tempDialog, which) ->
|
||||
{
|
||||
tempDialog.dismiss();
|
||||
event.invokeObserver(Collections.singletonList(constants.SOFTWARE_URL), enums.etype.welcome);
|
||||
})
|
||||
.addButton(app_context.getString(R.string.WELCOME_MESSAGE_BT_5), -1, -1, CFAlertDialog.CFAlertActionStyle.NEGATIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (tempDialog, which) ->
|
||||
{
|
||||
event.invokeObserver(null, enums.etype.cancel_welcome);
|
||||
tempDialog.dismiss();
|
||||
});
|
||||
}
|
||||
|
||||
private void abiErrorRestart()
|
||||
{
|
||||
is_popup_open = false;
|
||||
final Handler handler = new Handler();
|
||||
Runnable runnable = () ->
|
||||
{
|
||||
is_popup_open = false;
|
||||
createMessage(app_context,Collections.singletonList(strings.EMPTY_STR), enums.etype.abi_error);
|
||||
};
|
||||
handler.postDelayed(runnable, 1500);
|
||||
|
||||
initializeDialog(R.layout.popup_welcome, Gravity.CENTER);
|
||||
dialog.findViewById(R.id.pOption1).setOnClickListener(v -> {
|
||||
event.invokeObserver(Collections.singletonList(constants.CONST_BLACK_MARKET_URL), enums.etype.welcome);
|
||||
dialog.dismiss();
|
||||
});
|
||||
dialog.findViewById(R.id.pOption2).setOnClickListener(v -> {
|
||||
event.invokeObserver(Collections.singletonList(constants.CONST_LEAKED_DOCUMENT_URL), enums.etype.welcome);
|
||||
dialog.dismiss();
|
||||
});
|
||||
dialog.findViewById(R.id.pOption3).setOnClickListener(v -> {
|
||||
event.invokeObserver(Collections.singletonList(constants.CONST_NEWS_URL), enums.etype.welcome);
|
||||
dialog.dismiss();
|
||||
});
|
||||
dialog.findViewById(R.id.pOption4).setOnClickListener(v -> {
|
||||
event.invokeObserver(Collections.singletonList(constants.CONST_SOFTWARE_URL), enums.etype.welcome);
|
||||
dialog.dismiss();
|
||||
});
|
||||
dialog.findViewById(R.id.pOption6).setOnClickListener(v -> {
|
||||
event.invokeObserver(Collections.singletonList(constants.CONST_SOFTWARE_URL), enums.etype.welcome);
|
||||
dialog.dismiss();
|
||||
});
|
||||
dialog.findViewById(R.id.pOption5).setOnClickListener(v -> {
|
||||
event.invokeObserver(null, enums.etype.cancel_welcome);
|
||||
dialog.dismiss();
|
||||
});
|
||||
}
|
||||
|
||||
private void abiError()
|
||||
{
|
||||
popup_instance.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET)
|
||||
.setTitle(app_context.getString(R.string.ABI_ERROR_TITLE))
|
||||
.setBackgroundColor(app_context.getResources().getColor(R.color.holo_dark_gray_alpha))
|
||||
.setTextColor(app_context.getResources().getColor(R.color.black))
|
||||
.onDismissListener(dialog -> abiErrorRestart())
|
||||
.setMessage(app_context.getString(R.string.ABI_ERROR_DESC))
|
||||
.addButton(app_context.getString(R.string.ABI_ERROR_BT_1), -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (tempDialog, which) ->
|
||||
{
|
||||
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(constants.GENESIS_UPDATE_URL + status.current_ABI));
|
||||
if(browserIntent.resolveActivity(app_context.getPackageManager()) != null)
|
||||
{
|
||||
app_context.startActivity(browserIntent);
|
||||
}else {
|
||||
helperMethod.showToastMessage("Not Supported",app_context);
|
||||
}
|
||||
})
|
||||
.addButton(app_context.getString(R.string.ABI_ERROR_BT_2), -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (tempDialog, which) ->
|
||||
{
|
||||
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(constants.PLAYSTORE_URL));
|
||||
if(browserIntent.resolveActivity(app_context.getPackageManager()) != null)
|
||||
{
|
||||
app_context.startActivity(browserIntent);
|
||||
}else {
|
||||
helperMethod.showToastMessage("Playstore Not Found",app_context);
|
||||
}
|
||||
})
|
||||
/*
|
||||
.addButton(app_context.getString(R.string.ABI_ERROR_BT_3, -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (tempDialog, which) ->
|
||||
{
|
||||
event.invokeObserver(null, enums.etype.ignore_abi);
|
||||
tempDialog.dismiss();
|
||||
})*/;
|
||||
|
||||
|
||||
initializeDialog(R.layout.popup_abi_error, Gravity.CENTER);
|
||||
dialog.findViewById(R.id.pOption1).setOnClickListener(v -> dialog.dismiss());
|
||||
dialog.findViewById(R.id.pOption2).setOnClickListener(v -> {
|
||||
dialog.dismiss();
|
||||
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(constants.CONST_GENESIS_UPDATE_URL + status.sAppCurrentABI));
|
||||
if(browserIntent.resolveActivity(app_context.getPackageManager()) != null)
|
||||
{
|
||||
app_context.startActivity(browserIntent);
|
||||
}else {
|
||||
helperMethod.showToastMessage("Not Supported",app_context);
|
||||
}
|
||||
});
|
||||
dialog.findViewById(R.id.pOption2).setOnClickListener(v -> {
|
||||
dialog.dismiss();
|
||||
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(constants.CONST_PLAYSTORE_URL));
|
||||
if(browserIntent.resolveActivity(app_context.getPackageManager()) != null)
|
||||
{
|
||||
app_context.startActivity(browserIntent);
|
||||
}else {
|
||||
helperMethod.showToastMessage("Playstore Not Found",app_context);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void ratedSuccessfully()
|
||||
private void rateFailure()
|
||||
{
|
||||
popup_instance.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET)
|
||||
.setTitle(app_context.getString(R.string.RATE_SUCCESS_TITLE))
|
||||
.onDismissListener(dialog -> is_popup_open = false)
|
||||
.setBackgroundColor(app_context.getResources().getColor(R.color.holo_dark_gray_alpha))
|
||||
.setTextColor(app_context.getResources().getColor(R.color.black))
|
||||
.setMessage(app_context.getString(R.string.RATE_SUCCESS_DESC))
|
||||
.addButton(app_context.getString(R.string.RATE_SUCCESS_BT_1), -1, -1, CFAlertDialog.CFAlertActionStyle.NEGATIVE, CFAlertDialog.CFAlertActionAlignment.END, (tempDialog, which) ->
|
||||
{
|
||||
tempDialog.dismiss();
|
||||
onFinish();
|
||||
final Handler handler = new Handler();
|
||||
Runnable runnable = () ->
|
||||
{
|
||||
try{
|
||||
helperMethod.sendRateEmail(app_context);
|
||||
}
|
||||
catch (Exception ex){
|
||||
createMessage(app_context,Collections.singletonList(app_context.getString(R.string.NOT_SUPPORTED_MESSAGE)),enums.etype.on_not_support);
|
||||
}
|
||||
};
|
||||
handler.postDelayed(runnable, 250);
|
||||
});
|
||||
initializeDialog(R.layout.popup_rate_failure, Gravity.CENTER);
|
||||
dialog.findViewById(R.id.pDismiss).setOnClickListener(v -> dialog.dismiss());
|
||||
dialog.findViewById(R.id.pNext).setOnClickListener(v -> {
|
||||
dialog.dismiss();
|
||||
final Handler handler = new Handler();
|
||||
Runnable runnable = () -> {
|
||||
try{
|
||||
helperMethod.sendRateEmail(app_context);
|
||||
}
|
||||
catch (Exception ex){
|
||||
createMessage(app_context,Collections.singletonList(app_context.getString(R.string.NOT_SUPPORTED_MESSAGE)),enums.etype.on_not_support);
|
||||
}
|
||||
};
|
||||
handler.postDelayed(runnable, 1000);
|
||||
});
|
||||
}
|
||||
|
||||
private void reportedSuccessfully()
|
||||
{
|
||||
popup_instance.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET)
|
||||
.setTitle(app_context.getString(R.string.REPORT_SUCCESS_TITLE))
|
||||
.onDismissListener(dialog -> is_popup_open = false)
|
||||
.setBackgroundColor(app_context.getResources().getColor(R.color.holo_dark_gray_alpha))
|
||||
.setTextColor(app_context.getResources().getColor(R.color.black))
|
||||
.setMessage(app_context.getString(R.string.REPORT_SUCCESS_DESC))
|
||||
.addButton(app_context.getString(R.string.REPORT_SUCCESS_BT_1), -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.END, (tempDialog, which) ->
|
||||
onFinish());
|
||||
initializeDialog(R.layout.popup_reported_successfully, Gravity.CENTER);
|
||||
dialog.findViewById(R.id.pNext).setOnClickListener(v -> dialog.dismiss());
|
||||
}
|
||||
|
||||
private void notSupportMessage()
|
||||
{
|
||||
String message = data.get(0);
|
||||
popup_instance.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET)
|
||||
.setTitle(app_context.getString(R.string.NOT_SUPPORTED_TITLE))
|
||||
.onDismissListener(dialog -> is_popup_open = false)
|
||||
.setBackgroundColor(app_context.getResources().getColor(R.color.holo_dark_gray_alpha))
|
||||
.setTextColor(app_context.getResources().getColor(R.color.black))
|
||||
.setMessage(message)
|
||||
.addButton(app_context.getString(R.string.NOT_SUPPORTED_BT_1), -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.END, (tempDialog, which) ->
|
||||
onFinish());
|
||||
initializeDialog(R.layout.popup_not_supported, Gravity.BOTTOM);
|
||||
dialog.findViewById(R.id.pDismiss).setOnClickListener(v -> dialog.dismiss());
|
||||
}
|
||||
|
||||
@SuppressLint("ResourceType")
|
||||
private void bookmark()
|
||||
{
|
||||
final EditText input = new EditText(app_context);
|
||||
input.setInputType(InputType.TYPE_CLASS_TEXT);
|
||||
input.setText("");
|
||||
input.setBackground(ContextCompat.getDrawable(app_context, R.xml.sc_popup_input));
|
||||
input.setPadding(40, 15, 40, 15);
|
||||
input.setHeight(80);
|
||||
input.setTextSize(17);
|
||||
input.setHint("Title...");
|
||||
initializeDialog(R.layout.popup_create_bookmark, Gravity.CENTER);
|
||||
EditText mBoomMarkTitle = dialog.findViewById(R.id.pBookmark);
|
||||
dialog.setOnDismissListener(dialog -> {
|
||||
final Handler handler = new Handler();
|
||||
Runnable runnable = () -> {
|
||||
helperMethod.hideKeyboard(activityContextManager.getInstance().getHomeController());
|
||||
dialog.dismiss();
|
||||
};
|
||||
handler.postDelayed(runnable, 50);
|
||||
});
|
||||
dialog.findViewById(R.id.pDismiss).setOnClickListener(v -> {
|
||||
dialog.dismiss();
|
||||
helperMethod.hideKeyboard(activityContextManager.getInstance().getHomeController());
|
||||
});
|
||||
|
||||
popup_instance.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET)
|
||||
.setBackgroundColor(app_context.getResources().getColor(R.color.holo_dark_gray_alpha))
|
||||
.setTextColor(app_context.getResources().getColor(R.color.black))
|
||||
.setHeaderView(input)
|
||||
.onDismissListener(dialog -> is_popup_open = false)
|
||||
.setMessage("Bookmark URL | " + data.get(0) + "\n")
|
||||
.addButton(app_context.getString(R.string.BOOKMARK_URL_BT_1), -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.END, (tempDialog, which) ->
|
||||
{
|
||||
event.invokeObserver(Collections.singletonList(data.get(0).replace("genesis.onion","boogle.store")+"split"+input.getText().toString()), enums.etype.bookmark);
|
||||
mBoomMarkTitle.requestFocus();
|
||||
InputMethodManager imm = (InputMethodManager) app_context.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,0);
|
||||
|
||||
onFinish();
|
||||
});
|
||||
dialog.findViewById(R.id.pNext).setOnClickListener(v -> {
|
||||
dialog.dismiss();
|
||||
helperMethod.hideKeyboard(app_context);
|
||||
event.invokeObserver(Collections.singletonList(data.get(0).replace("genesis.onion","boogle.store")+"split"+((EditText)dialog.findViewById(R.id.pBookmark)).getText().toString()), enums.etype.bookmark);
|
||||
});
|
||||
}
|
||||
|
||||
private void initializeDialog(int pLayout,int pGravity){
|
||||
if(dialog!=null && dialog.isShowing()){
|
||||
dialog.dismiss();
|
||||
}
|
||||
|
||||
dialog = new Dialog(app_context);
|
||||
dialog.getWindow().setGravity(pGravity);
|
||||
dialog.getWindow().getAttributes().windowAnimations = R.style.dialiog_animation;
|
||||
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
|
||||
dialog.setCancelable(true);
|
||||
dialog.setContentView(pLayout);
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
private void clearHistory()
|
||||
{
|
||||
popup_instance.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET)
|
||||
.setTitle(app_context.getString(R.string.CLEAR_HISTORY_TITLE))
|
||||
.setBackgroundColor(app_context.getResources().getColor(R.color.holo_dark_gray_alpha))
|
||||
.setTextColor(app_context.getResources().getColor(R.color.black))
|
||||
.onDismissListener(dialog -> is_popup_open = false)
|
||||
.setMessage(app_context.getString(R.string.CLEAR_HISTORY_DESC))
|
||||
.addButton(app_context.getString(R.string.CLEAR_HISTORY_BT_1), -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.END, (tempDialog, which) ->
|
||||
{
|
||||
onFinish();
|
||||
final Handler handler = new Handler();
|
||||
Runnable runnable = () ->
|
||||
{
|
||||
is_popup_open = false;
|
||||
event.invokeObserver(null, enums.etype.clear_history);
|
||||
};
|
||||
handler.postDelayed(runnable, 250);
|
||||
});
|
||||
}
|
||||
|
||||
private void clearTabs()
|
||||
{
|
||||
popup_instance.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET)
|
||||
.setTitle(app_context.getString(R.string.CLEAR_TAB_TITLE))
|
||||
.setBackgroundColor(app_context.getResources().getColor(R.color.holo_dark_gray_alpha))
|
||||
.setTextColor(app_context.getResources().getColor(R.color.black))
|
||||
.onDismissListener(dialog -> is_popup_open = false)
|
||||
.setMessage(app_context.getString(R.string.CLEAR_TAB_DESC))
|
||||
.addButton(app_context.getString(R.string.CLEAR_TAB_BT_1), -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.END, (tempDialog, which) ->
|
||||
{
|
||||
onFinish();
|
||||
final Handler handler = new Handler();
|
||||
Runnable runnable = () ->
|
||||
{
|
||||
is_popup_open = false;
|
||||
event.invokeObserver(null, enums.etype.clear_tab);
|
||||
};
|
||||
handler.postDelayed(runnable, 250);
|
||||
});
|
||||
initializeDialog(R.layout.popup_clear_history, Gravity.CENTER);
|
||||
dialog.findViewById(R.id.pDismiss).setOnClickListener(v -> dialog.dismiss());
|
||||
dialog.findViewById(R.id.pNext).setOnClickListener(v -> {
|
||||
dialog.dismiss();
|
||||
event.invokeObserver(null, enums.etype.clear_history);
|
||||
});
|
||||
}
|
||||
|
||||
private void clearBookmark()
|
||||
{
|
||||
popup_instance.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET)
|
||||
.setTitle(app_context.getString(R.string.clear_bookmark_title))
|
||||
.setBackgroundColor(app_context.getResources().getColor(R.color.holo_dark_gray_alpha))
|
||||
.setTextColor(app_context.getResources().getColor(R.color.black))
|
||||
.onDismissListener(dialog -> is_popup_open = false)
|
||||
.setMessage(app_context.getString(R.string.clear_bookmark_desc))
|
||||
.addButton(app_context.getString(R.string.clear_bookmark_bt1), -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.END, (tempDialog, which) ->
|
||||
{
|
||||
is_popup_open = false;
|
||||
event.invokeObserver(null, enums.etype.clear_bookmark);
|
||||
onFinish();
|
||||
});
|
||||
initializeDialog(R.layout.popup_clear_bookmark, Gravity.CENTER);
|
||||
dialog.findViewById(R.id.pDismiss).setOnClickListener(v -> dialog.dismiss());
|
||||
dialog.findViewById(R.id.pNext).setOnClickListener(v -> {
|
||||
dialog.dismiss();
|
||||
event.invokeObserver(null, enums.etype.clear_bookmark);
|
||||
});
|
||||
}
|
||||
|
||||
private void reportURL()
|
||||
{
|
||||
popup_instance.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET)
|
||||
.setTitle(app_context.getString(R.string.REPORT_URL_TITLE))
|
||||
.setBackgroundColor(app_context.getResources().getColor(R.color.holo_dark_gray_alpha))
|
||||
.setTextColor(app_context.getResources().getColor(R.color.black))
|
||||
.onDismissListener(dialog -> is_popup_open = false)
|
||||
.setMessage(app_context.getString(R.string.REPORT_URL_DESC))
|
||||
.addButton(app_context.getString(R.string.REPORT_URL_BT_1), -1, -1, CFAlertDialog.CFAlertActionStyle.NEGATIVE, CFAlertDialog.CFAlertActionAlignment.END, (tempDialog, which) ->
|
||||
{
|
||||
onFinish();
|
||||
|
||||
final Handler handler = new Handler();
|
||||
Runnable runnable = () -> createMessage(app_context,Collections.singletonList(strings.EMPTY_STR), enums.etype.reported_success);
|
||||
handler.postDelayed(runnable, 1000);
|
||||
|
||||
});
|
||||
|
||||
|
||||
initializeDialog(R.layout.popup_report_url, Gravity.CENTER);
|
||||
dialog.findViewById(R.id.pDismiss).setOnClickListener(v -> dialog.dismiss());
|
||||
dialog.findViewById(R.id.pNext).setOnClickListener(v -> {
|
||||
dialog.dismiss();
|
||||
final Handler handler = new Handler();
|
||||
Runnable runnable = () -> createMessage(app_context,Collections.singletonList(strings.GENERIC_EMPTY_STR), enums.etype.reported_success);
|
||||
handler.postDelayed(runnable, 1000);
|
||||
});
|
||||
}
|
||||
|
||||
private void rateApp()
|
||||
{
|
||||
popup_instance.setDialogStyle(CFAlertDialog.CFAlertStyle.ALERT)
|
||||
.setTitle(app_context.getString(R.string.RATE_TITLE))
|
||||
.setBackgroundColor(app_context.getResources().getColor(R.color.holo_dark_gray_alpha_v1))
|
||||
.setTextColor(app_context.getResources().getColor(R.color.black))
|
||||
.onDismissListener(dialog -> is_popup_open = false)
|
||||
.setMessage(app_context.getString(R.string.RATE_MESSAGE))
|
||||
.addButton(app_context.getString(R.string.RATE_POSITIVE), -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (tempDialog, which) ->
|
||||
initializeDialog(R.layout.popup_rate_us, Gravity.CENTER);
|
||||
dialog.findViewById(R.id.pDismiss).setOnClickListener(v -> dialog.dismiss());
|
||||
dialog.findViewById(R.id.pNext).setOnClickListener(v -> {
|
||||
RatingBar mRatingBar = dialog.findViewById(R.id.pRating);
|
||||
if(mRatingBar.getRating()>=3){
|
||||
event.invokeObserver(null, enums.etype.app_rated);
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=com.darkweb.genesissearchengine"));
|
||||
if(intent.resolveActivity(app_context.getPackageManager()) != null)
|
||||
{
|
||||
event.invokeObserver(null, enums.etype.app_rated);
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=com.darkweb.genesissearchengine"));
|
||||
if(intent.resolveActivity(app_context.getPackageManager()) != null)
|
||||
{
|
||||
app_context.startActivity(intent);
|
||||
}else {
|
||||
helperMethod.showToastMessage("Playstore Not Found",app_context);
|
||||
}
|
||||
onFinish();
|
||||
})
|
||||
.addButton(app_context.getString(R.string.RATE_NEGATIVE), -1, -1, CFAlertDialog.CFAlertActionStyle.NEGATIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (tempDialog, which) ->
|
||||
{
|
||||
event.invokeObserver(null, enums.etype.app_rated);
|
||||
onFinish();
|
||||
final Handler handler = new Handler();
|
||||
handler.postDelayed(() ->
|
||||
createMessage(app_context,Collections.singletonList(strings.EMPTY_STR), enums.etype.rate_success), 1000);
|
||||
});
|
||||
app_context.startActivity(intent);
|
||||
}else {
|
||||
helperMethod.showToastMessage("Playstore Not Found",app_context);
|
||||
}
|
||||
dialog.dismiss();
|
||||
}else if(mRatingBar.getRating()>0) {
|
||||
event.invokeObserver(null, enums.etype.app_rated);
|
||||
final Handler handler = new Handler();
|
||||
handler.postDelayed(() -> createMessage(app_context,Collections.singletonList(strings.GENERIC_EMPTY_STR), enums.etype.rate_failure), 1000);
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void downloadFile()
|
||||
{
|
||||
popup_instance.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET)
|
||||
.setTitle(app_context.getString(R.string.DOWNLOAD_TITLE))
|
||||
.onDismissListener(dialog -> is_popup_open = false)
|
||||
.setBackgroundColor(app_context.getResources().getColor(R.color.holo_dark_gray_alpha))
|
||||
.setTextColor(app_context.getResources().getColor(R.color.black))
|
||||
.setMessage(app_context.getString(R.string.DOWNLOAD_MESSAGE) + data.get(0))
|
||||
.addButton(app_context.getString(R.string.DOWNLOAD_POSITIVE), -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.END, (dialog, which) ->
|
||||
{
|
||||
event.invokeObserver(null, enums.etype.download_file);
|
||||
onFinish();
|
||||
});
|
||||
initializeDialog(R.layout.popup_download_file, Gravity.BOTTOM);
|
||||
((TextView)dialog.findViewById(R.id.pDescription)).setText((app_context.getString(R.string.DOWNLOAD_MESSAGE) + data.get(0)));
|
||||
dialog.findViewById(R.id.pDismiss).setOnClickListener(v -> dialog.dismiss());
|
||||
}
|
||||
|
||||
@SuppressLint("ResourceAsColor")
|
||||
|
@ -354,38 +253,29 @@ class messageManager
|
|||
size = 35;
|
||||
}
|
||||
|
||||
|
||||
popup_instance.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET)
|
||||
.onDismissListener(dialog -> is_popup_open = false)
|
||||
.setBackgroundColor(app_context.getResources().getColor(R.color.holo_dark_gray_alpha))
|
||||
.setTextColor(app_context.getResources().getColor(R.color.black))
|
||||
.setMessage(title + f.getName().substring(0,size)+"...")
|
||||
.setTextGravity(Gravity.START)
|
||||
.addButton(app_context.getString(R.string.LONG_URL_OPTION_4), -1, Color.rgb(242,242,242 ), CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) ->
|
||||
{
|
||||
event.invokeObserver(Collections.singletonList(data.get(0)), enums.etype.download_file_manual);
|
||||
onFinish();
|
||||
})
|
||||
.addButton(app_context.getString(R.string.LONG_URL_OPTION_1), -1, Color.rgb(242,242,242 ), CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) ->
|
||||
{
|
||||
event.invokeObserver(Collections.singletonList(data.get(0)), enums.etype.open_link_new_tab);
|
||||
onFinish();
|
||||
})
|
||||
.addButton(app_context.getString(R.string.LONG_URL_OPTION_2), -1, Color.rgb(242,242,242 ), CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) ->
|
||||
{
|
||||
event.invokeObserver(Collections.singletonList(data.get(0)), enums.etype.open_link_current_tab);
|
||||
onFinish();
|
||||
})
|
||||
.addButton(app_context.getString(R.string.LONG_URL_OPTION_3), -1, Color.rgb(242,242,242 ), CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) ->
|
||||
{
|
||||
event.invokeObserver(Collections.singletonList(data.get(0)), enums.etype.copy_link);
|
||||
onFinish();
|
||||
});
|
||||
initializeDialog(R.layout.popup_file_longpress, Gravity.CENTER);
|
||||
((TextView)dialog.findViewById(R.id.pDescription)).setText((title + data.get(0).substring(0,size)+"..."));
|
||||
dialog.findViewById(R.id.pDismiss).setOnClickListener(v -> dialog.dismiss());
|
||||
dialog.findViewById(R.id.pOption1).setOnClickListener(v -> {
|
||||
event.invokeObserver(Collections.singletonList(data.get(0)), enums.etype.download_file_manual);
|
||||
dialog.dismiss();
|
||||
});
|
||||
dialog.findViewById(R.id.pOption2).setOnClickListener(v -> {
|
||||
event.invokeObserver(Collections.singletonList(data.get(0)), enums.etype.open_link_current_tab);
|
||||
dialog.dismiss();
|
||||
});
|
||||
dialog.findViewById(R.id.pOption3).setOnClickListener(v -> {
|
||||
event.invokeObserver(Collections.singletonList(data.get(0)), enums.etype.copy_link);
|
||||
dialog.dismiss();
|
||||
});
|
||||
dialog.findViewById(R.id.pOption3).setOnClickListener(v -> {
|
||||
event.invokeObserver(Collections.singletonList(data.get(0)), enums.etype.copy_link);
|
||||
dialog.dismiss();
|
||||
});
|
||||
}
|
||||
|
||||
private void openURLLongPress()
|
||||
{
|
||||
|
||||
int size = data.get(0).length()-1;
|
||||
String title = data.get(1);
|
||||
|
||||
|
@ -393,39 +283,21 @@ class messageManager
|
|||
size = 35;
|
||||
}
|
||||
|
||||
popup_instance.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET)
|
||||
.onDismissListener(dialog -> is_popup_open = false)
|
||||
.setBackgroundColor(app_context.getResources().getColor(R.color.holo_dark_gray_alpha))
|
||||
.setTextColor(app_context.getResources().getColor(R.color.black))
|
||||
.setMessage(title + data.get(0).substring(0,size)+"...")
|
||||
.addButton(app_context.getString(R.string.LONG_URL_OPTION_1), -1, Color.rgb(242,242,242 ), CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) ->
|
||||
{
|
||||
event.invokeObserver(Collections.singletonList(data.get(0)), enums.etype.open_link_new_tab);
|
||||
onFinish();
|
||||
})
|
||||
.addButton(app_context.getString(R.string.LONG_URL_OPTION_2), -1, Color.rgb(242,242,242 ), CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) ->
|
||||
{
|
||||
event.invokeObserver(Collections.singletonList(data.get(0)), enums.etype.open_link_current_tab);
|
||||
onFinish();
|
||||
})
|
||||
.addButton(app_context.getString(R.string.LONG_URL_OPTION_3), -1, Color.rgb(242,242,242 ), CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) ->
|
||||
{
|
||||
event.invokeObserver(Collections.singletonList(data.get(0)), enums.etype.copy_link);
|
||||
onFinish();
|
||||
});
|
||||
}
|
||||
|
||||
private void onResetApp()
|
||||
{
|
||||
is_popup_open = true;
|
||||
popup_instance.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET)
|
||||
.setTitle(app_context.getString(R.string.ORBOT_CLEAR_TITLE))
|
||||
.setBackgroundColor(app_context.getResources().getColor(R.color.holo_dark_gray_alpha))
|
||||
.setTextColor(app_context.getResources().getColor(R.color.black))
|
||||
.setMessage(app_context.getString(R.string.ORBOT_CLEAR_DESC))
|
||||
.onDismissListener(dialog -> is_popup_open = false)
|
||||
.addButton(app_context.getString(R.string.ORBOT_CLEAR_BT_1), -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.END, (tempDialog, which) ->
|
||||
onFinish());
|
||||
initializeDialog(R.layout.popup_url_longpress, Gravity.CENTER);
|
||||
((TextView)dialog.findViewById(R.id.pDescription)).setText((title + data.get(0).substring(0,size)+"..."));
|
||||
dialog.findViewById(R.id.pDismiss).setOnClickListener(v -> dialog.dismiss());
|
||||
dialog.findViewById(R.id.pOption1).setOnClickListener(v -> {
|
||||
event.invokeObserver(Collections.singletonList(data.get(0)), enums.etype.open_link_new_tab);
|
||||
dialog.dismiss();
|
||||
});
|
||||
dialog.findViewById(R.id.pOption2).setOnClickListener(v -> {
|
||||
event.invokeObserver(Collections.singletonList(data.get(0)), enums.etype.open_link_current_tab);
|
||||
dialog.dismiss();
|
||||
});
|
||||
dialog.findViewById(R.id.pOption3).setOnClickListener(v -> {
|
||||
event.invokeObserver(Collections.singletonList(data.get(0)), enums.etype.copy_link);
|
||||
dialog.dismiss();
|
||||
});
|
||||
}
|
||||
|
||||
private void popupDownloadFull(){
|
||||
|
@ -453,120 +325,69 @@ class messageManager
|
|||
data_local = title + file.substring(0,size1)+"...";
|
||||
}
|
||||
|
||||
popup_instance.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET)
|
||||
|
||||
.onDismissListener(dialog -> is_popup_open = false)
|
||||
.setBackgroundColor(app_context.getResources().getColor(R.color.holo_dark_gray_alpha))
|
||||
.setTextColor(app_context.getResources().getColor(R.color.black))
|
||||
.setMessage(data_local)
|
||||
|
||||
.addButton(app_context.getString(R.string.LONG_URL_FULL_OPTION_1), -1, Color.rgb(242,242,242 ), CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) ->
|
||||
{
|
||||
event.invokeObserver(Collections.singletonList(url), enums.etype.open_link_new_tab);
|
||||
onFinish();
|
||||
})
|
||||
.addButton(app_context.getString(R.string.LONG_URL_FULL_OPTION_2), -1, Color.rgb(242,242,242 ), CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) ->
|
||||
{
|
||||
event.invokeObserver(Collections.singletonList(url), enums.etype.open_link_current_tab);
|
||||
onFinish();
|
||||
})
|
||||
.addButton(app_context.getString(R.string.LONG_URL_FULL_OPTION_3), -1, Color.rgb(242,242,242 ), CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) ->
|
||||
{
|
||||
event.invokeObserver(Collections.singletonList(url), enums.etype.copy_link);
|
||||
onFinish();
|
||||
})
|
||||
.addButton(app_context.getString(R.string.LONG_URL_FULL_OPTION_7), -1, Color.rgb(242,242,242 ), CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) ->
|
||||
{
|
||||
event.invokeObserver(Collections.singletonList(file), enums.etype.download_file_manual);
|
||||
onFinish();
|
||||
})
|
||||
.addButton(app_context.getString(R.string.LONG_URL_FULL_OPTION_4), -1, Color.rgb(242,242,242 ), CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) ->
|
||||
{
|
||||
event.invokeObserver(Collections.singletonList(file), enums.etype.open_link_new_tab);
|
||||
onFinish();
|
||||
})
|
||||
.addButton(app_context.getString(R.string.LONG_URL_FULL_OPTION_5), -1, Color.rgb(242,242,242 ), CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) ->
|
||||
{
|
||||
event.invokeObserver(Collections.singletonList(file), enums.etype.open_link_current_tab);
|
||||
onFinish();
|
||||
})
|
||||
.addButton(app_context.getString(R.string.LONG_URL_FULL_OPTION_6), -1, Color.rgb(242,242,242 ), CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) ->
|
||||
{
|
||||
event.invokeObserver(Collections.singletonList(file), enums.etype.copy_link);
|
||||
onFinish();
|
||||
});
|
||||
initializeDialog(R.layout.popup_url_longpress, Gravity.CENTER);
|
||||
((TextView)dialog.findViewById(R.id.pHeader)).setText((title + data.get(0).substring(0,size)+"..."));
|
||||
((TextView)dialog.findViewById(R.id.pDescription)).setText((data_local));
|
||||
dialog.findViewById(R.id.pDismiss).setOnClickListener(v -> dialog.dismiss());
|
||||
dialog.findViewById(R.id.pOption1).setOnClickListener(v -> {
|
||||
event.invokeObserver(Collections.singletonList(data.get(0)), enums.etype.open_link_new_tab);
|
||||
dialog.dismiss();
|
||||
});
|
||||
dialog.findViewById(R.id.pOption2).setOnClickListener(v -> {
|
||||
event.invokeObserver(Collections.singletonList(data.get(0)), enums.etype.open_link_current_tab);
|
||||
dialog.dismiss();
|
||||
});
|
||||
dialog.findViewById(R.id.pOption3).setOnClickListener(v -> {
|
||||
event.invokeObserver(Collections.singletonList(data.get(0)), enums.etype.copy_link);
|
||||
dialog.dismiss();
|
||||
});
|
||||
dialog.findViewById(R.id.pOption3).setOnClickListener(v -> {
|
||||
event.invokeObserver(Collections.singletonList(data.get(0)), enums.etype.copy_link);
|
||||
dialog.dismiss();
|
||||
});
|
||||
dialog.findViewById(R.id.pOption3).setOnClickListener(v -> {
|
||||
event.invokeObserver(Collections.singletonList(data.get(0)), enums.etype.copy_link);
|
||||
dialog.dismiss();
|
||||
});
|
||||
dialog.findViewById(R.id.pOption3).setOnClickListener(v -> {
|
||||
event.invokeObserver(Collections.singletonList(data.get(0)), enums.etype.copy_link);
|
||||
dialog.dismiss();
|
||||
});
|
||||
dialog.findViewById(R.id.pOption3).setOnClickListener(v -> {
|
||||
event.invokeObserver(Collections.singletonList(data.get(0)), enums.etype.copy_link);
|
||||
dialog.dismiss();
|
||||
});
|
||||
}
|
||||
|
||||
private void startingOrbotInfo()
|
||||
{
|
||||
is_popup_open = true;
|
||||
popup_instance.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET)
|
||||
.setTitle(app_context.getString(R.string.ORBOT_INIT_TITLE))
|
||||
.setBackgroundColor(app_context.getResources().getColor(R.color.holo_dark_gray_alpha))
|
||||
.setTextColor(app_context.getResources().getColor(R.color.black))
|
||||
.setMessage(app_context.getString(R.string.ORBOT_INIT_DESC))
|
||||
.onDismissListener(dialog -> is_popup_open = false)
|
||||
.addButton(app_context.getString(R.string.ORBOT_INIT_BT_1), -1, -1, CFAlertDialog.CFAlertActionStyle.NEGATIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (tempDialog, which) ->
|
||||
onFinish()).addButton(app_context.getString(R.string.ORBOT_INIT_BT_2), -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) ->
|
||||
{
|
||||
onFinish();
|
||||
|
||||
final Handler handler = new Handler();
|
||||
handler.postDelayed(() ->
|
||||
event.invokeObserver(Collections.singletonList(data.get(0)), enums.etype.reload), 250);
|
||||
|
||||
});
|
||||
initializeDialog(R.layout.popup_starting_orbot_info, Gravity.BOTTOM);
|
||||
dialog.findViewById(R.id.pDismiss).setOnClickListener(v -> dialog.dismiss());
|
||||
}
|
||||
|
||||
private void sendBridgeMail()
|
||||
{
|
||||
popup_instance.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET)
|
||||
.setTitle(app_context.getString(R.string.BRIDGE_MAIL_TITLE))
|
||||
.onDismissListener(dialog -> is_popup_open = false)
|
||||
.setBackgroundColor(app_context.getResources().getColor(R.color.holo_dark_gray_alpha))
|
||||
.setTextColor(app_context.getResources().getColor(R.color.black))
|
||||
.setMessage(app_context.getString(R.string.BRIDGE_MAIL_MESSAGE))
|
||||
.addButton(app_context.getString(R.string.BRIDGE_MAIL_POSITIVE), -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.END, (dialog, which) ->
|
||||
{
|
||||
onFinish();
|
||||
final Handler handler = new Handler();
|
||||
Runnable runnable = () ->
|
||||
{
|
||||
try
|
||||
{
|
||||
helperMethod.sendBridgeEmail(app_context);
|
||||
onFinish();
|
||||
}catch (Exception ex){
|
||||
createMessage(app_context,Collections.singletonList(app_context.getString(R.string.NOT_SUPPORTED_MESSAGE)),enums.etype.on_not_support);
|
||||
}
|
||||
};
|
||||
handler.postDelayed(runnable, 250);
|
||||
});
|
||||
}
|
||||
|
||||
private void versionWarning()
|
||||
{
|
||||
popup_instance.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET)
|
||||
.onDismissListener(dialog -> is_popup_open = false)
|
||||
.setTitle(app_context.getString(R.string.VERSION_TITLE))
|
||||
.setBackgroundColor(app_context.getResources().getColor(R.color.holo_dark_gray_alpha))
|
||||
.setTextColor(app_context.getResources().getColor(R.color.black))
|
||||
.setMessage(app_context.getString(R.string.VERSION_DESC))
|
||||
.addButton(app_context.getString(R.string.VERSION_BT_1), -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.END, (tempDialog, which) ->
|
||||
{
|
||||
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(constants.GENESIS_UPDATE_URL + data.get(0)));
|
||||
app_context.startActivity(browserIntent);
|
||||
});
|
||||
initializeDialog(R.layout.popup_bridge_mail, Gravity.CENTER);
|
||||
dialog.findViewById(R.id.pDismiss).setOnClickListener(v -> dialog.dismiss());
|
||||
dialog.findViewById(R.id.pNext).setOnClickListener(v -> {
|
||||
dialog.dismiss();
|
||||
final Handler handler = new Handler();
|
||||
Runnable runnable = () -> {
|
||||
try{
|
||||
helperMethod.sendBridgeEmail(app_context);
|
||||
}
|
||||
catch (Exception ex){
|
||||
createMessage(app_context,Collections.singletonList(app_context.getString(R.string.NOT_SUPPORTED_MESSAGE)),enums.etype.on_not_support);
|
||||
}
|
||||
};
|
||||
handler.postDelayed(runnable, 1000);
|
||||
});
|
||||
}
|
||||
|
||||
void onReset(){
|
||||
onFinish();
|
||||
dialog_main = null;
|
||||
}
|
||||
|
||||
private void onFinish(){
|
||||
if(dialog_main!=null && dialog_main.isShowing() && !app_context.isFinishing() && !app_context.isFinishing()){
|
||||
dialog_main.dismiss();
|
||||
if(dialog!=null){
|
||||
dialog.dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -576,88 +397,72 @@ class messageManager
|
|||
{
|
||||
this.app_context = app_context;
|
||||
this.data = data;
|
||||
if (!is_popup_open && !app_context.isDestroyed())
|
||||
|
||||
switch (type)
|
||||
{
|
||||
is_popup_open = true;
|
||||
popup_instance = new CFAlertDialog.Builder(app_context);
|
||||
case welcome:
|
||||
welcomeMessage();
|
||||
break;
|
||||
|
||||
onDismissListener();
|
||||
switch (type)
|
||||
{
|
||||
case welcome:
|
||||
welcomeMessage();
|
||||
break;
|
||||
case abi_error:
|
||||
abiError();
|
||||
break;
|
||||
|
||||
case abi_error:
|
||||
abiError();
|
||||
break;
|
||||
case rate_failure:
|
||||
rateFailure();
|
||||
break;
|
||||
|
||||
case rate_success:
|
||||
ratedSuccessfully();
|
||||
break;
|
||||
case reported_success:
|
||||
reportedSuccessfully();
|
||||
break;
|
||||
|
||||
case reported_success:
|
||||
reportedSuccessfully();
|
||||
break;
|
||||
case bookmark:
|
||||
bookmark();
|
||||
break;
|
||||
|
||||
case bookmark:
|
||||
bookmark();
|
||||
break;
|
||||
case clear_history:
|
||||
clearHistory();
|
||||
break;
|
||||
|
||||
case clear_history:
|
||||
clearHistory();
|
||||
break;
|
||||
case clear_bookmark:
|
||||
clearBookmark();
|
||||
break;
|
||||
|
||||
case clear_tab:
|
||||
clearTabs();
|
||||
break;
|
||||
case report_url:
|
||||
reportURL();
|
||||
break;
|
||||
|
||||
case clear_bookmark:
|
||||
clearBookmark();
|
||||
break;
|
||||
case rate_app:
|
||||
rateApp();
|
||||
break;
|
||||
|
||||
case report_url:
|
||||
reportURL();
|
||||
break;
|
||||
case download_file:
|
||||
downloadFile();
|
||||
break;
|
||||
|
||||
case rate_app:
|
||||
rateApp();
|
||||
break;
|
||||
case start_orbot:
|
||||
startingOrbotInfo();
|
||||
break;
|
||||
|
||||
case download_file:
|
||||
downloadFile();
|
||||
break;
|
||||
case download_file_long_press:
|
||||
downloadFileLongPress();
|
||||
break;
|
||||
|
||||
case start_orbot:
|
||||
startingOrbotInfo();
|
||||
break;
|
||||
case on_long_press_url:
|
||||
openURLLongPress();
|
||||
break;
|
||||
|
||||
case version_warning:
|
||||
versionWarning();
|
||||
break;
|
||||
case on_long_press_with_link:
|
||||
popupDownloadFull();
|
||||
break;
|
||||
|
||||
case download_file_long_press:
|
||||
downloadFileLongPress();
|
||||
break;
|
||||
case on_bridge_mail:
|
||||
sendBridgeMail();
|
||||
break;
|
||||
|
||||
case on_long_press_url:
|
||||
openURLLongPress();
|
||||
break;
|
||||
|
||||
case on_long_press_with_link:
|
||||
popupDownloadFull();
|
||||
break;
|
||||
|
||||
case on_bridge_mail:
|
||||
sendBridgeMail();
|
||||
break;
|
||||
|
||||
case on_not_support:
|
||||
notSupportMessage();
|
||||
break;
|
||||
}
|
||||
|
||||
dialog_main = popup_instance.show();
|
||||
case on_not_support:
|
||||
notSupportMessage();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,14 +37,14 @@ class orbotManager
|
|||
}
|
||||
|
||||
public void initialize(AppCompatActivity app_context, eventObserver.eventListener event){
|
||||
initNotification((Integer) dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_INT, Arrays.asList(keys.NOTIFICATION_STATUS,1)));
|
||||
initNotification((Integer) dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_INT, Arrays.asList(keys.SETTING_NOTIFICATION_STATUS,1)));
|
||||
}
|
||||
|
||||
void startOrbot(Context context){
|
||||
orbotLocalConstants.bridges = status.sCustomBridge;
|
||||
orbotLocalConstants.sIsManualBridge = status.sGatewayManual;
|
||||
orbotLocalConstants.bridges = status.sBridgeCustomBridge;
|
||||
orbotLocalConstants.sIsManualBridge = status.sBridgeGatewayManual;
|
||||
this.mAppContext = context;
|
||||
Prefs.putBridgesEnabled(status.sGatewayManual|status.sGatewayAuto);
|
||||
Prefs.putBridgesEnabled(status.sBridgeGatewayManual |status.sBridgeGatewayAuto);
|
||||
Intent mServiceIntent = new Intent(context, OrbotService.class);
|
||||
mServiceIntent.setAction(ACTION_START);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
|
@ -96,10 +96,10 @@ class orbotManager
|
|||
}
|
||||
else {
|
||||
PrefsHelper.setPref(keys.PROXY_TYPE, 1);
|
||||
PrefsHelper.setPref(keys.PROXY_SOCKS,constants.PROXY_SOCKS);
|
||||
PrefsHelper.setPref(keys.PROXY_SOCKS,constants.CONST_PROXY_SOCKS);
|
||||
PrefsHelper.setPref(keys.PROXY_SOCKS_PORT, 9050);
|
||||
PrefsHelper.setPref(keys.PROXY_SOCKS_VERSION,constants.PROXY_SOCKS_VERSION);
|
||||
PrefsHelper.setPref(keys.PROXY_SOCKS_REMOTE_DNS,constants.PROXY_SOCKS_REMOTE_DNS);
|
||||
PrefsHelper.setPref(keys.PROXY_SOCKS_VERSION,constants.CONST_PROXY_SOCKS_VERSION);
|
||||
PrefsHelper.setPref(keys.PROXY_SOCKS_REMOTE_DNS,constants.CONST_PROXY_SOCKS_REMOTE_DNS);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -112,15 +112,15 @@ class orbotManager
|
|||
PrefsHelper.setPref(keys.PROXY_SOCKS_REMOTE_DNS,null);
|
||||
|
||||
PrefsHelper.setPref(keys.PROXY_TYPE, 1);
|
||||
PrefsHelper.setPref(keys.PROXY_SOCKS,constants.PROXY_SOCKS);
|
||||
PrefsHelper.setPref(keys.PROXY_SOCKS,constants.CONST_PROXY_SOCKS);
|
||||
PrefsHelper.setPref(keys.PROXY_SOCKS_PORT, 9050);
|
||||
PrefsHelper.setPref(keys.PROXY_SOCKS_VERSION,constants.PROXY_SOCKS_VERSION);
|
||||
PrefsHelper.setPref(keys.PROXY_SOCKS_REMOTE_DNS,constants.PROXY_SOCKS_REMOTE_DNS);
|
||||
PrefsHelper.setPref(keys.PROXY_SOCKS_VERSION,constants.CONST_PROXY_SOCKS_VERSION);
|
||||
PrefsHelper.setPref(keys.PROXY_SOCKS_REMOTE_DNS,constants.CONST_PROXY_SOCKS_REMOTE_DNS);
|
||||
|
||||
PrefsHelper.setPref(keys.PROXY_CACHE,constants.PROXY_CACHE);
|
||||
PrefsHelper.setPref(keys.PROXY_MEMORY,constants.PROXY_MEMORY);
|
||||
PrefsHelper.setPref(keys.PROXY_DO_NOT_TRACK_HEADER_ENABLED,constants.PROXY_DO_NOT_TRACK_HEADER_ENABLED);
|
||||
PrefsHelper.setPref(keys.PROXY_DO_NOT_TRACK_HEADER_VALUE,constants.PROXY_DO_NOT_TRACK_HEADER_VALUE);
|
||||
PrefsHelper.setPref(keys.PROXY_CACHE,constants.CONST_PROXY_CACHE);
|
||||
PrefsHelper.setPref(keys.PROXY_MEMORY,constants.CONST_PROXY_MEMORY);
|
||||
PrefsHelper.setPref(keys.PROXY_DO_NOT_TRACK_HEADER_ENABLED,constants.CONST_PROXY_DO_NOT_TRACK_HEADER_ENABLED);
|
||||
PrefsHelper.setPref(keys.PROXY_DO_NOT_TRACK_HEADER_VALUE,constants.CONST_PROXY_DO_NOT_TRACK_HEADER_VALUE);
|
||||
|
||||
PrefsHelper.setPref("browser.cache.disk.enable",true);
|
||||
PrefsHelper.setPref("browser.cache.memory.enable",true);
|
||||
|
@ -135,14 +135,14 @@ class orbotManager
|
|||
PrefsHelper.setPref("browser.cache.memory.enable",true);
|
||||
PrefsHelper.setPref("browser.cache.disk.capacity",0);
|
||||
PrefsHelper.setPref("privacy.resistFingerprinting",true);
|
||||
PrefsHelper.setPref("privacy.clearOnShutdown.cache",status.sHistoryStatus);
|
||||
PrefsHelper.setPref("privacy.clearOnShutdown.downloads",status.sHistoryStatus);
|
||||
PrefsHelper.setPref("privacy.clearOnShutdown.formdata",status.sHistoryStatus);
|
||||
PrefsHelper.setPref("privacy.clearOnShutdown.history",status.sHistoryStatus);
|
||||
PrefsHelper.setPref("privacy.clearOnShutdown.offlineApps",status.sHistoryStatus);
|
||||
PrefsHelper.setPref("privacy.clearOnShutdown.passwords",status.sHistoryStatus);
|
||||
PrefsHelper.setPref("privacy.clearOnShutdown.sessions",status.sHistoryStatus);
|
||||
PrefsHelper.setPref("privacy.clearOnShutdown.siteSettings",status.sHistoryStatus);
|
||||
PrefsHelper.setPref("privacy.clearOnShutdown.cache",status.sSettingHistoryStatus);
|
||||
PrefsHelper.setPref("privacy.clearOnShutdown.downloads",status.sSettingHistoryStatus);
|
||||
PrefsHelper.setPref("privacy.clearOnShutdown.formdata",status.sSettingHistoryStatus);
|
||||
PrefsHelper.setPref("privacy.clearOnShutdown.history",status.sSettingHistoryStatus);
|
||||
PrefsHelper.setPref("privacy.clearOnShutdown.offlineApps",status.sSettingHistoryStatus);
|
||||
PrefsHelper.setPref("privacy.clearOnShutdown.passwords",status.sSettingHistoryStatus);
|
||||
PrefsHelper.setPref("privacy.clearOnShutdown.sessions",status.sSettingHistoryStatus);
|
||||
PrefsHelper.setPref("privacy.clearOnShutdown.siteSettings",status.sSettingHistoryStatus);
|
||||
PrefsHelper.setPref("privacy.donottrackheader.enabled",false);
|
||||
PrefsHelper.setPref("privacy.donottrackheader.value",1);
|
||||
PrefsHelper.setPref("network.http.sendRefererHeader", 0);
|
||||
|
@ -168,7 +168,7 @@ class orbotManager
|
|||
}
|
||||
|
||||
|
||||
if(!logs.equals(strings.EMPTY_STR))
|
||||
if(!logs.equals(strings.GENERIC_EMPTY_STR))
|
||||
{
|
||||
String Logs = logs;
|
||||
Logs="Installing | " + Logs.replace("FAILED","Securing");
|
||||
|
|
|
@ -58,7 +58,7 @@ public class pluginController
|
|||
|
||||
public void preInitialize(homeController context){
|
||||
mLangManager = new langManager(context,new langCallback());
|
||||
mLangManager.setDefaultLanguage(new Locale(status.sLanguage));
|
||||
mLangManager.setDefaultLanguage(new Locale(status.sSettingLanguage));
|
||||
|
||||
mFabricManager = new fabricManager(context,new fabricCallback());
|
||||
}
|
||||
|
@ -217,7 +217,7 @@ public class pluginController
|
|||
|
||||
/*Lang Manager*/
|
||||
public void setLanguage(AppCompatActivity context){
|
||||
mLangManager.setDefaultLanguage(new Locale(status.sLanguage));
|
||||
mLangManager.setDefaultLanguage(new Locale(status.sSettingLanguage));
|
||||
}
|
||||
public void onCreate(Activity activity) {
|
||||
mLangManager.onCreate(activity);
|
||||
|
@ -236,7 +236,7 @@ public class pluginController
|
|||
mHomeController.onLoadURL(data.get(0).toString());
|
||||
}
|
||||
else if(event_type.equals(enums.etype.cancel_welcome)){
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.IS_WELCOME_ENABLED,false));
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_IS_WELCOME_ENABLED,false));
|
||||
}
|
||||
else if(event_type.equals(enums.etype.ignore_abi)){
|
||||
//mHomeController.ignoreAbiError();
|
||||
|
@ -255,23 +255,23 @@ public class pluginController
|
|||
mContextManager.getHistoryController().onclearData();
|
||||
mHomeController.onClearSession();
|
||||
dataController.getInstance().clearTabs();
|
||||
mHomeController.initTab();
|
||||
mHomeController.initTab(false);
|
||||
}
|
||||
else if(event_type.equals(enums.etype.clear_bookmark)){
|
||||
dataController.getInstance().clearBookmark();
|
||||
dataController.getInstance().invokeBookmark(dataEnums.eBookmarkCommands.M_CLEAR_BOOKMARK ,data);
|
||||
mContextManager.getBookmarkController().onclearData();
|
||||
}
|
||||
else if(event_type.equals(enums.etype.bookmark)){
|
||||
String [] dataParser = data.get(0).toString().split("split");
|
||||
if(dataParser.length>1){
|
||||
logEvent(strings.URL_BOOKMARKED);
|
||||
dataController.getInstance().addBookmark(dataParser[0],dataParser[1]);
|
||||
logEvent(strings.EVENT_URL_BOOKMARKED);
|
||||
dataController.getInstance().invokeBookmark(dataEnums.eBookmarkCommands.M_ADD_BOOKMARK ,Arrays.asList(dataParser[0],dataParser[1]));
|
||||
}else {
|
||||
dataController.getInstance().addBookmark(dataParser[0],"");
|
||||
dataController.getInstance().invokeBookmark(dataEnums.eBookmarkCommands.M_ADD_BOOKMARK ,Arrays.asList(dataParser[0],""));
|
||||
}
|
||||
}
|
||||
else if(event_type.equals(enums.etype.app_rated)){
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.IS_APP_RATED,true));
|
||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.PROXY_IS_APP_RATED,true));
|
||||
}
|
||||
else if(event_type.equals(enums.etype.download_file)){
|
||||
mHomeController.onDownloadFile();
|
||||
|
@ -293,7 +293,7 @@ public class pluginController
|
|||
}
|
||||
else if(event_type.equals(enums.etype.clear_tab)){
|
||||
dataController.getInstance().clearTabs();
|
||||
mHomeController.initTab();
|
||||
mHomeController.initTab(true);
|
||||
activityContextManager.getInstance().getTabController().finish();
|
||||
}
|
||||
return null;
|
||||
|
|
|
@ -1,146 +0,0 @@
|
|||
# Copyright (C) 2009 The Android Open Source Project
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
#
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
ROOT_PATH := $(LOCAL_PATH)
|
||||
EXTERN_PATH := $(LOCAL_PATH)/../../../../external
|
||||
|
||||
########################################################
|
||||
## pdnsd library
|
||||
########################################################
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
PDNSD_SOURCES := $(wildcard $(LOCAL_PATH)/pdnsd/src/*.c)
|
||||
|
||||
LOCAL_MODULE := pdnsd
|
||||
LOCAL_SRC_FILES := $(PDNSD_SOURCES:$(LOCAL_PATH)/%=%)
|
||||
LOCAL_CFLAGS := -Wall -O2 -I$(LOCAL_PATH)/pdnsd -DHAVE_STPCPY
|
||||
|
||||
|
||||
include $(BUILD_EXECUTABLE)
|
||||
|
||||
########################################################
|
||||
## libancillary
|
||||
########################################################
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
ANCILLARY_SOURCE := fd_recv.c fd_send.c
|
||||
|
||||
LOCAL_MODULE := libancillary
|
||||
LOCAL_CFLAGS := -O2 -I$(LOCAL_PATH)/libancillary
|
||||
|
||||
LOCAL_SRC_FILES := $(addprefix libancillary/, $(ANCILLARY_SOURCE))
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
|
||||
########################################################
|
||||
## tun2socks
|
||||
########################################################
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_CFLAGS := -std=gnu99
|
||||
LOCAL_CFLAGS += -DBADVPN_THREADWORK_USE_PTHREAD -DBADVPN_LINUX -DBADVPN_BREACTOR_BADVPN -D_GNU_SOURCE
|
||||
LOCAL_CFLAGS += -DBADVPN_USE_SELFPIPE -DBADVPN_USE_EPOLL
|
||||
LOCAL_CFLAGS += -DBADVPN_LITTLE_ENDIAN -DBADVPN_THREAD_SAFE
|
||||
LOCAL_CFLAGS += -DNDEBUG -DANDROID
|
||||
LOCAL_CFLAGS += -DTUN2SOCKS_JNI
|
||||
LOCAL_CFLAGS += -DPSIPHON
|
||||
|
||||
LOCAL_STATIC_LIBRARIES := libancillary
|
||||
|
||||
LOCAL_C_INCLUDES:= \
|
||||
$(LOCAL_PATH)/libancillary \
|
||||
$(EXTERN_PATH)/badvpn/ \
|
||||
$(EXTERN_PATH)/badvpn/lwip/src/include/ipv4 \
|
||||
$(EXTERN_PATH)/badvpn/lwip/src/include/ipv6 \
|
||||
$(EXTERN_PATH)/badvpn/lwip/src/include \
|
||||
$(EXTERN_PATH)/badvpn/lwip/custom \
|
||||
|
||||
TUN2SOCKS_SOURCES := \
|
||||
base/BLog_syslog.c \
|
||||
system/BReactor_badvpn.c \
|
||||
system/BSignal.c \
|
||||
system/BConnection_unix.c \
|
||||
system/BTime.c \
|
||||
system/BUnixSignal.c \
|
||||
system/BNetwork.c \
|
||||
flow/StreamRecvInterface.c \
|
||||
flow/PacketRecvInterface.c \
|
||||
flow/PacketPassInterface.c \
|
||||
flow/StreamPassInterface.c \
|
||||
flow/SinglePacketBuffer.c \
|
||||
flow/BufferWriter.c \
|
||||
flow/PacketBuffer.c \
|
||||
flow/PacketStreamSender.c \
|
||||
flow/PacketPassConnector.c \
|
||||
flow/PacketProtoFlow.c \
|
||||
flow/PacketPassFairQueue.c \
|
||||
flow/PacketProtoEncoder.c \
|
||||
flow/PacketProtoDecoder.c \
|
||||
socksclient/BSocksClient.c \
|
||||
tuntap/BTap.c \
|
||||
lwip/src/core/timers.c \
|
||||
lwip/src/core/udp.c \
|
||||
lwip/src/core/memp.c \
|
||||
lwip/src/core/init.c \
|
||||
lwip/src/core/pbuf.c \
|
||||
lwip/src/core/tcp.c \
|
||||
lwip/src/core/tcp_out.c \
|
||||
lwip/src/core/netif.c \
|
||||
lwip/src/core/def.c \
|
||||
lwip/src/core/mem.c \
|
||||
lwip/src/core/tcp_in.c \
|
||||
lwip/src/core/stats.c \
|
||||
lwip/src/core/inet_chksum.c \
|
||||
lwip/src/core/ipv4/icmp.c \
|
||||
lwip/src/core/ipv4/igmp.c \
|
||||
lwip/src/core/ipv4/ip4_addr.c \
|
||||
lwip/src/core/ipv4/ip_frag.c \
|
||||
lwip/src/core/ipv4/ip4.c \
|
||||
lwip/src/core/ipv4/autoip.c \
|
||||
lwip/src/core/ipv6/ethip6.c \
|
||||
lwip/src/core/ipv6/inet6.c \
|
||||
lwip/src/core/ipv6/ip6_addr.c \
|
||||
lwip/src/core/ipv6/mld6.c \
|
||||
lwip/src/core/ipv6/dhcp6.c \
|
||||
lwip/src/core/ipv6/icmp6.c \
|
||||
lwip/src/core/ipv6/ip6.c \
|
||||
lwip/src/core/ipv6/ip6_frag.c \
|
||||
lwip/src/core/ipv6/nd6.c \
|
||||
lwip/custom/sys.c \
|
||||
tun2socks/tun2socks.c \
|
||||
base/DebugObject.c \
|
||||
base/BLog.c \
|
||||
base/BPending.c \
|
||||
system/BDatagram_unix.c \
|
||||
flowextra/PacketPassInactivityMonitor.c \
|
||||
tun2socks/SocksUdpGwClient.c \
|
||||
udpgw_client/UdpGwClient.c
|
||||
|
||||
LOCAL_MODULE := tun2socks
|
||||
|
||||
LOCAL_LDLIBS := -ldl -llog
|
||||
|
||||
LOCAL_SRC_FILES := $(addprefix ../../../../external/badvpn/, $(TUN2SOCKS_SOURCES))
|
||||
|
||||
##include $(BUILD_EXECUTABLE)
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
# Import cpufeatures
|
||||
$(call import-module,android/cpufeatures)
|
|
@ -1,3 +0,0 @@
|
|||
APP_ABI := armeabi-v7a x86 arm64-v8a x86_64
|
||||
APP_PLATFORM := android-16
|
||||
APP_STL := c++_static
|
|
@ -1,139 +0,0 @@
|
|||
This library provide an easy interface to the black magic that can be done
|
||||
on Unix domain sockets, like passing file descriptors from one process to
|
||||
another.
|
||||
|
||||
Programs that uses this library should include the ancillary.h header file.
|
||||
Nothing else is required.
|
||||
|
||||
All functions of this library require the following header:
|
||||
|
||||
#include <ancillary.h>
|
||||
|
||||
At this time, the only ancillary data defined by the Single Unix
|
||||
Specification (v3) is file descriptors.
|
||||
|
||||
Passing file descriptors
|
||||
|
||||
int ancil_send_fd(socket, file_descriptor)
|
||||
int socket: the Unix socket
|
||||
int file_descriptor: the file descriptor
|
||||
Return value: 0 for success, -1 for failure.
|
||||
|
||||
Sends one file descriptor on a socket.
|
||||
In case of failure, errno is set; the possible values are the ones of the
|
||||
sendmsg(2) system call.
|
||||
|
||||
|
||||
int ancil_recv_fd(socket, file_descriptor)
|
||||
int socket: the Unix socket
|
||||
int *file_descriptor: pointer to the returned file descriptor
|
||||
Return value: 0 for success, -1 for failure
|
||||
|
||||
Receives one file descriptor from a socket.
|
||||
In case of success, the file descriptor is stored in the integer pointed
|
||||
to by file_descriptor.
|
||||
In case of failure, errno is set; the possible values are the ones of the
|
||||
recvmsg(2) system call.
|
||||
The behavior is undefined if the recv_fd does not match a send_fd* on the
|
||||
other side.
|
||||
|
||||
|
||||
int ancil_send_fds(socket, file_descriptors, num_file_descriptors)
|
||||
int socket: the Unix socket
|
||||
const int *file_descriptors: array of file descriptors
|
||||
unsigned num_file_descriptors: number of file descriptors
|
||||
Return value: 0 for success, -1 for failure
|
||||
|
||||
Sends several file descriptors on a socket.
|
||||
In case of failure, errno is set; the possible values are the ones of the
|
||||
sendmsg(2) system call.
|
||||
The maximum number of file descriptors that can be sent using this
|
||||
function is ANCIL_MAX_N_FDS; the behavior is undefined in case of
|
||||
overflow, probably a stack corruption.
|
||||
|
||||
|
||||
int ancil_recv_fds(socket, file_descriptors, num_file_descriptors)
|
||||
int socket: the Unix socket
|
||||
int *file_descriptors: return array of file descriptors
|
||||
unsigned num_file_descriptors: number of file descriptors
|
||||
Return value: number of received fd for success, -1 for failure
|
||||
|
||||
Receives several file descriptors from a socket, no more than
|
||||
num_file_descriptors.
|
||||
In case of success, the received file descriptors are stored in the array
|
||||
pointed to by file_descriptors.
|
||||
In case of failure, errno is set; the possible values are the ones of the
|
||||
recvmsg(2) system call.
|
||||
The maximum number of file descriptors that can be received using this
|
||||
function is ANCIL_MAX_N_FDS; the behavior is undefined in case of
|
||||
overflow, probably a stack corruption.
|
||||
The behavior is undefined if the recv_fds does not match a send_fd* on
|
||||
the other side, or if the number of received file descriptors is more than
|
||||
num_file_descriptors.
|
||||
|
||||
|
||||
int ancil_send_fds_with_buffer(socket, fds, num, buffer)
|
||||
int socket: the Unix socket
|
||||
const int *fds: array of file descriptors
|
||||
unsigned num: number of file descriptors
|
||||
void *buffer: buffer to hold the system data structures
|
||||
Return value: 0 for success, -1 for failure
|
||||
|
||||
Sends several file descriptors on a socket.
|
||||
In case of failure, errno is set; the possible values are the ones of the
|
||||
sendmsg(2) system call.
|
||||
The buffer argument must point to a memory area large enough to hold the
|
||||
system data structures, see ANCIL_FD_BUFFER.
|
||||
|
||||
|
||||
int ancil_send_fds_with_buffer(socket, fds, num, buffer)
|
||||
int socket: the Unix socket
|
||||
int *fds: return array of file descriptors
|
||||
unsigned num: number of file descriptors
|
||||
void *buffer: buffer to hold the system data structures
|
||||
Return value: number of received fd for success, -1 for failure
|
||||
|
||||
Receives several file descriptors from a socket, no more than
|
||||
num_file_descriptors.
|
||||
In case of success, the received file descriptors are stored in the array
|
||||
pointed to by file_descriptors.
|
||||
In case of failure, errno is set; the possible values are the ones of the
|
||||
recvmsg(2) system call.
|
||||
The behavior is undefined if the recv_fds does not match a send_fd* on
|
||||
the other side, or if the number of received file descriptors is more than
|
||||
num_file_descriptors.
|
||||
The buffer argument must point to a memory area large enough to hold the
|
||||
system data structures, see ANCIL_FD_BUFFER.
|
||||
|
||||
|
||||
ANCIL_MAX_N_FDS
|
||||
|
||||
Maximum number of file descriptors that can be sent with the sent_fds and
|
||||
recv_fds functions. If you have to send more at once, use the
|
||||
*_with_buffer versions. The value is enough to send "quite a few" file
|
||||
descriptors.
|
||||
|
||||
|
||||
ANCIL_FD_BUFFER(n)
|
||||
int n: number of file descriptors
|
||||
|
||||
Expands to a structure data type large enough to hold the system data
|
||||
structures for n file descriptors. So the address of a variable declared
|
||||
of type ANCIL_FD_BUFFER(n) is suitable as the buffer argument for
|
||||
*_with_buffer on n file descriptors.
|
||||
To use this macro, you need <sys/types.h> and <sys/socket.h>. Bevare: with
|
||||
Solaris, the _XPG4_2 macro must be defined before sys/socket is included.
|
||||
|
||||
|
||||
Tuning the compilation
|
||||
|
||||
This library is designed to be included in projects, not installed in
|
||||
/usr/lib. If your project does not use some of the functions, the
|
||||
TUNE_OPTS variable in the Makefile allows not to build them. It is a list
|
||||
of proprocessor options:
|
||||
|
||||
-DNDEBUG: turn assertions off (see assert(3))
|
||||
-DSPARE_SEND_FDS: do not build ancil_send_fds
|
||||
-DSPARE_SEND_FD: do not build ancil_send_fd
|
||||
-DSPARE_RECV_FDS: do not build ancil_recv_fds
|
||||
-DSPARE_RECV_FD: do not build ancil_recv_fd
|
|
@ -1,21 +0,0 @@
|
|||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
3. The name of the author may not be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@ -1,73 +0,0 @@
|
|||
###########################################################################
|
||||
# libancillary - black magic on Unix domain sockets
|
||||
# (C) Nicolas George
|
||||
# Makefile - guess what
|
||||
###########################################################################
|
||||
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. The name of the author may not be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
CC=gcc
|
||||
CFLAGS=-Wall -g -O2
|
||||
LDFLAGS=
|
||||
LIBS=
|
||||
AR=ar
|
||||
RANLIB=ranlib
|
||||
RM=rm
|
||||
CP=cp
|
||||
MKDIR=mkdir
|
||||
TAR=tar
|
||||
GZIP=gzip -9
|
||||
|
||||
NAME=libancillary
|
||||
DISTRIBUTION=API COPYING Makefile ancillary.h fd_send.c fd_recv.c test.c
|
||||
VERSION=0.9.1
|
||||
|
||||
OBJECTS=fd_send.o fd_recv.o
|
||||
|
||||
TUNE_OPTS=-DNDEBUG
|
||||
#TUNE_OPTS=-DNDEBUG \
|
||||
-DSPARE_SEND_FDS -DSPARE_SEND_FD -DSPARE_RECV_FDS -DSPARE_RECV_FD
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(CFLAGS) $(TUNE_OPTS) $<
|
||||
|
||||
all: libancillary.a
|
||||
|
||||
libancillary.a: $(OBJECTS)
|
||||
$(AR) cr $@ $(OBJECTS)
|
||||
$(RANLIB) $@
|
||||
|
||||
fd_send.o: ancillary.h
|
||||
fd_recv.o: ancillary.h
|
||||
|
||||
test: test.c libancillary.a
|
||||
$(CC) -o $@ $(CFLAGS) $(LDFLAGS) -L. test.c -lancillary $(LIBS)
|
||||
|
||||
clean:
|
||||
-$(RM) -f *.o *.a test
|
||||
|
||||
dist:
|
||||
$(MKDIR) $(NAME)-$(VERSION)
|
||||
$(CP) $(DISTRIBUTION) $(NAME)-$(VERSION)
|
||||
$(TAR) -cf - $(NAME)-$(VERSION) | $(GZIP) > $(NAME)-$(VERSION).tar.gz
|
||||
$(RM) -rf $(NAME)-$(VERSION)
|
|
@ -1,131 +0,0 @@
|
|||
/***************************************************************************
|
||||
* libancillary - black magic on Unix domain sockets
|
||||
* (C) Nicolas George
|
||||
* ancillary.c - public header
|
||||
***************************************************************************/
|
||||
|
||||
/*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef ANCILLARY_H__
|
||||
#define ANCILLARY_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/***************************************************************************
|
||||
* Start of the readable part.
|
||||
***************************************************************************/
|
||||
|
||||
#define ANCIL_MAX_N_FDS 960
|
||||
/*
|
||||
* Maximum number of fds that can be sent or received using the "esay"
|
||||
* functions; this is so that all can fit in one page.
|
||||
*/
|
||||
|
||||
extern int
|
||||
ancil_send_fds_with_buffer(int, const int *, unsigned, void *);
|
||||
/*
|
||||
* ancil_send_fds_with_buffer(sock, n_fds, fds, buffer)
|
||||
*
|
||||
* Sends the file descriptors in the array pointed by fds, of length n_fds
|
||||
* on the socket sock.
|
||||
* buffer is a writeable memory area large enough to hold the required data
|
||||
* structures.
|
||||
* Returns: -1 and errno in case of error, 0 in case of success.
|
||||
*/
|
||||
|
||||
extern int
|
||||
ancil_recv_fds_with_buffer(int, int *, unsigned, void *);
|
||||
/*
|
||||
* ancil_recv_fds_with_buffer(sock, n_fds, fds, buffer)
|
||||
*
|
||||
* Receives *n_fds file descriptors into the array pointed by fds
|
||||
* from the socket sock.
|
||||
* buffer is a writeable memory area large enough to hold the required data
|
||||
* structures.
|
||||
* Returns: -1 and errno in case of error, the actual number of received fd
|
||||
* in case of success
|
||||
*/
|
||||
|
||||
#define ANCIL_FD_BUFFER(n) \
|
||||
struct { \
|
||||
struct cmsghdr h; \
|
||||
int fd[n]; \
|
||||
}
|
||||
/* ANCIL_FD_BUFFER(n)
|
||||
*
|
||||
* A structure type suitable to be used as buffer for n file descriptors.
|
||||
* Requires <sys/socket.h>.
|
||||
* Example:
|
||||
* ANCIL_FD_BUFFER(42) buffer;
|
||||
* ancil_recv_fds_with_buffer(sock, 42, my_fds, &buffer);
|
||||
*/
|
||||
|
||||
extern int
|
||||
ancil_send_fds(int, const int *, unsigned);
|
||||
/*
|
||||
* ancil_send_fds(sock, n_fds, fds)
|
||||
*
|
||||
* Sends the file descriptors in the array pointed by fds, of length n_fds
|
||||
* on the socket sock.
|
||||
* n_fds must not be greater than ANCIL_MAX_N_FDS.
|
||||
* Returns: -1 and errno in case of error, 0 in case of success.
|
||||
*/
|
||||
|
||||
extern int
|
||||
ancil_recv_fds(int, int *, unsigned);
|
||||
/*
|
||||
* ancil_recv_fds(sock, n_fds, fds)
|
||||
*
|
||||
* Receives *n_fds file descriptors into the array pointed by fds
|
||||
* from the socket sock.
|
||||
* *n_fds must not be greater than ANCIL_MAX_N_FDS.
|
||||
* Returns: -1 and errno in case of error, the actual number of received fd
|
||||
* in case of success.
|
||||
*/
|
||||
|
||||
|
||||
extern int
|
||||
ancil_send_fd(int, int);
|
||||
/* ancil_recv_fd(sock, fd);
|
||||
*
|
||||
* Sends the file descriptor fd on the socket sock.
|
||||
* Returns : -1 and errno in case of error, 0 in case of success.
|
||||
*/
|
||||
|
||||
extern int
|
||||
ancil_recv_fd(int, int *);
|
||||
/* ancil_send_fd(sock, &fd);
|
||||
*
|
||||
* Receives the file descriptor fd from the socket sock.
|
||||
* Returns : -1 and errno in case of error, 0 in case of success.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ANCILLARY_H__ */
|
|
@ -1,98 +0,0 @@
|
|||
/***************************************************************************
|
||||
* libancillary - black magic on Unix domain sockets
|
||||
* (C) Nicolas George
|
||||
* fd_send.c - receiving file descriptors
|
||||
***************************************************************************/
|
||||
|
||||
/*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _XPG4_2 /* Solaris sucks */
|
||||
# define _XPG4_2
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/uio.h>
|
||||
#include <assert.h>
|
||||
#if defined(__FreeBSD__)
|
||||
# include <sys/param.h> /* FreeBSD sucks */
|
||||
#endif
|
||||
|
||||
#include "ancillary.h"
|
||||
|
||||
int
|
||||
ancil_recv_fds_with_buffer(int sock, int *fds, unsigned n_fds, void *buffer)
|
||||
{
|
||||
struct msghdr msghdr;
|
||||
char nothing;
|
||||
struct iovec nothing_ptr;
|
||||
struct cmsghdr *cmsg;
|
||||
int i;
|
||||
|
||||
nothing_ptr.iov_base = ¬hing;
|
||||
nothing_ptr.iov_len = 1;
|
||||
msghdr.msg_name = NULL;
|
||||
msghdr.msg_namelen = 0;
|
||||
msghdr.msg_iov = ¬hing_ptr;
|
||||
msghdr.msg_iovlen = 1;
|
||||
msghdr.msg_flags = 0;
|
||||
msghdr.msg_control = buffer;
|
||||
msghdr.msg_controllen = sizeof(struct cmsghdr) + sizeof(int) * n_fds;
|
||||
cmsg = CMSG_FIRSTHDR(&msghdr);
|
||||
cmsg->cmsg_len = msghdr.msg_controllen;
|
||||
cmsg->cmsg_level = SOL_SOCKET;
|
||||
cmsg->cmsg_type = SCM_RIGHTS;
|
||||
for(i = 0; i < n_fds; i++)
|
||||
((int *)CMSG_DATA(cmsg))[i] = -1;
|
||||
|
||||
if(recvmsg(sock, &msghdr, 0) < 0)
|
||||
return(-1);
|
||||
for(i = 0; i < n_fds; i++)
|
||||
fds[i] = ((int *)CMSG_DATA(cmsg))[i];
|
||||
n_fds = (msghdr.msg_controllen - sizeof(struct cmsghdr)) / sizeof(int);
|
||||
return(n_fds);
|
||||
}
|
||||
|
||||
#ifndef SPARE_RECV_FDS
|
||||
int
|
||||
ancil_recv_fds(int sock, int *fd, unsigned n_fds)
|
||||
{
|
||||
ANCIL_FD_BUFFER(ANCIL_MAX_N_FDS) buffer;
|
||||
|
||||
assert(n_fds <= ANCIL_MAX_N_FDS);
|
||||
return(ancil_recv_fds_with_buffer(sock, fd, n_fds, &buffer));
|
||||
}
|
||||
#endif /* SPARE_RECV_FDS */
|
||||
|
||||
#ifndef SPARE_RECV_FD
|
||||
int
|
||||
ancil_recv_fd(int sock, int *fd)
|
||||
{
|
||||
ANCIL_FD_BUFFER(1) buffer;
|
||||
|
||||
return(ancil_recv_fds_with_buffer(sock, fd, 1, &buffer) == 1 ? 0 : -1);
|
||||
}
|
||||
#endif /* SPARE_RECV_FD */
|
|
@ -1,92 +0,0 @@
|
|||
/***************************************************************************
|
||||
* libancillary - black magic on Unix domain sockets
|
||||
* (C) Nicolas George
|
||||
* fd_send.c - sending file descriptors
|
||||
***************************************************************************/
|
||||
|
||||
/*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _XPG4_2 /* Solaris sucks */
|
||||
# define _XPG4_2
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/uio.h>
|
||||
#include <assert.h>
|
||||
#if defined(__FreeBSD__)
|
||||
# include <sys/param.h> /* FreeBSD sucks */
|
||||
#endif
|
||||
|
||||
#include "ancillary.h"
|
||||
|
||||
int
|
||||
ancil_send_fds_with_buffer(int sock, const int *fds, unsigned n_fds, void *buffer)
|
||||
{
|
||||
struct msghdr msghdr;
|
||||
char nothing = '!';
|
||||
struct iovec nothing_ptr;
|
||||
struct cmsghdr *cmsg;
|
||||
int i;
|
||||
|
||||
nothing_ptr.iov_base = ¬hing;
|
||||
nothing_ptr.iov_len = 1;
|
||||
msghdr.msg_name = NULL;
|
||||
msghdr.msg_namelen = 0;
|
||||
msghdr.msg_iov = ¬hing_ptr;
|
||||
msghdr.msg_iovlen = 1;
|
||||
msghdr.msg_flags = 0;
|
||||
msghdr.msg_control = buffer;
|
||||
msghdr.msg_controllen = sizeof(struct cmsghdr) + sizeof(int) * n_fds;
|
||||
cmsg = CMSG_FIRSTHDR(&msghdr);
|
||||
cmsg->cmsg_len = msghdr.msg_controllen;
|
||||
cmsg->cmsg_level = SOL_SOCKET;
|
||||
cmsg->cmsg_type = SCM_RIGHTS;
|
||||
for(i = 0; i < n_fds; i++)
|
||||
((int *)CMSG_DATA(cmsg))[i] = fds[i];
|
||||
return(sendmsg(sock, &msghdr, 0) >= 0 ? 0 : -1);
|
||||
}
|
||||
|
||||
#ifndef SPARE_SEND_FDS
|
||||
int
|
||||
ancil_send_fds(int sock, const int *fds, unsigned n_fds)
|
||||
{
|
||||
ANCIL_FD_BUFFER(ANCIL_MAX_N_FDS) buffer;
|
||||
|
||||
assert(n_fds <= ANCIL_MAX_N_FDS);
|
||||
return(ancil_send_fds_with_buffer(sock, fds, n_fds, &buffer));
|
||||
}
|
||||
#endif /* SPARE_SEND_FDS */
|
||||
|
||||
#ifndef SPARE_SEND_FD
|
||||
int
|
||||
ancil_send_fd(int sock, int fd)
|
||||
{
|
||||
ANCIL_FD_BUFFER(1) buffer;
|
||||
|
||||
return(ancil_send_fds_with_buffer(sock, &fd, 1, &buffer));
|
||||
}
|
||||
#endif /* SPARE_SEND_FD */
|
|
@ -1,112 +0,0 @@
|
|||
/***************************************************************************
|
||||
* libancillary - black magic on Unix domain sockets
|
||||
* (C) Nicolas George
|
||||
* test.c - testing and example program
|
||||
***************************************************************************/
|
||||
|
||||
/*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/socket.h>
|
||||
#include "ancillary.h"
|
||||
|
||||
void child_process(int sock)
|
||||
{
|
||||
int fd;
|
||||
int fds[3], nfds;
|
||||
char b[] = "This is on the received fd!\n";
|
||||
|
||||
if(ancil_recv_fd(sock, &fd)) {
|
||||
perror("ancil_recv_fd");
|
||||
exit(1);
|
||||
} else {
|
||||
printf("Received fd: %d\n", fd);
|
||||
}
|
||||
write(fd, b, sizeof(b));
|
||||
close(fd);
|
||||
sleep(2);
|
||||
|
||||
nfds = ancil_recv_fds(sock, fds, 3);
|
||||
if(nfds < 0) {
|
||||
perror("ancil_recv_fds");
|
||||
exit(1);
|
||||
} else {
|
||||
printf("Received %d/3 fds : %d %d %d.\n", nfds,
|
||||
fds[0], fds[1], fds[2]);
|
||||
}
|
||||
}
|
||||
|
||||
void parent_process(int sock)
|
||||
{
|
||||
int fds[2] = { 1, 2 };
|
||||
|
||||
if(ancil_send_fd(sock, 1)) {
|
||||
perror("ancil_send_fd");
|
||||
exit(1);
|
||||
} else {
|
||||
printf("Sent fd.\n");
|
||||
}
|
||||
sleep(1);
|
||||
|
||||
if(ancil_send_fds(sock, fds, 2)) {
|
||||
perror("ancil_send_fds");
|
||||
exit(1);
|
||||
} else {
|
||||
printf("Sent two fds.\n");
|
||||
}
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int sock[2];
|
||||
|
||||
if(socketpair(PF_UNIX, SOCK_STREAM, 0, sock)) {
|
||||
perror("socketpair");
|
||||
exit(1);
|
||||
} else {
|
||||
printf("Established socket pair: (%d, %d)\n", sock[0], sock[1]);
|
||||
}
|
||||
|
||||
switch(fork()) {
|
||||
case 0:
|
||||
close(sock[0]);
|
||||
child_process(sock[1]);
|
||||
break;
|
||||
case -1:
|
||||
perror("fork");
|
||||
exit(1);
|
||||
default:
|
||||
close(sock[1]);
|
||||
parent_process(sock[0]);
|
||||
wait(NULL);
|
||||
break;
|
||||
}
|
||||
return(0);
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
Most of pdnsd was written by Thomas Moestl (tmoestl@gmx.net).
|
||||
In the "par" versions large parts of the code have been revised
|
||||
and several features have been added by Paul Rombouts.
|
||||
|
||||
Small parts of this program are based on code that was taken from nmap (IP
|
||||
checksumming), the isdn4k-utils (ippp interface uptest), glibc 2.1.2 (some
|
||||
definitions for kernel 2.2.x missing in 2.0 glibcs) and FreeBSD
|
||||
(SIZEOF_ADDR_IFREQ in netdev.c).
|
||||
nmap was written by Fyodor. The insd4k-utils were written by Fritz Elfert and
|
||||
others. The GNU C library (glibc) is copyright by the Free Software
|
||||
Foundation.
|
||||
|
||||
The following people have contributed code:
|
||||
Andrew M. Bishop contributed support for server labels
|
||||
Carsten Block contributed 'configure'-able rc scripts
|
||||
Stephan Boettcher contributed the SCHEME= option.
|
||||
P.J. Bostley contributed patches to get pdnsd working on
|
||||
alpha
|
||||
Frank Elsner contributed rc script fixes
|
||||
Christian Engstler contributed patches for SuSE compatability
|
||||
Bjoern Fischer contributed code to make pdnsd leave the case of names
|
||||
in the cache unchanged
|
||||
Torben Janssen contributed RedHat rc scripts
|
||||
Olaf Kirch contributed a security fix for the run_as()
|
||||
function
|
||||
Bernd Leibing contributed fixes to the spec file.
|
||||
Sourav K. Mandal contributed the autoconf/automake code, gdbm
|
||||
caching facility and many suggestions
|
||||
Markus Mohr contributed Debian rc scripts
|
||||
Alexandre Nunes contributed autoconf fixes
|
||||
Wolfgang Ocker contributed the server_ip option
|
||||
Soenke J. Peters contributed patches and suggestions for RedHat
|
||||
compatability
|
||||
Roman Shterenzon contributed many helpful hints and patches for
|
||||
FreeBSD compatability.
|
||||
Andreas Steinmetz contributed the code for the query_port_start and
|
||||
query_port_end options (which I changed slightly,
|
||||
so blame any breakage on me ;)
|
||||
Marko Stolle contributed the contrib/pdnsd_update.pl script that
|
||||
makes pdnsd usable in a DHCP setup.
|
||||
Lyonel Vincent extended the serve_aliases option to support an
|
||||
arbitrary number of aliases
|
||||
Paul Wagland contributed a patches for bind9-compatability
|
||||
and for some memory leaks on error paths.
|
||||
Sverker Wiberg contributed IPv6 build fixes
|
||||
Michael Wiedmann contributed the pdnsd-ctl.8 man page.
|
||||
Ron Yorston contributed the dev-uptest for Linux ppp dial-
|
||||
on-demand devices
|
||||
Nikita V. Youshchenko contributed extensions to the "if" uptest
|
||||
Mahesh T. Pai contributed the pdnsd.8 man page.
|
||||
Nikola Kotur contributed the Slackware start-up script.
|
||||
Kiyo Kelvin Lee contributed a patch for Cygwin support.
|
||||
Rodney Brown contributed a patch for Darwin (Apple Mac OS X) support.
|
||||
Jan-Marek Glogowski contributed a patch implementing the "use_nss" option.
|
||||
|
||||
Please look into the THANKS file for people who helped me in various ways on
|
||||
this project.
|
||||
If this list is incomplete, pease drop me a mail!
|
|
@ -1,674 +0,0 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
|
@ -1,26 +0,0 @@
|
|||
A small part of the pdnsd source is licensed under the following BSD-style
|
||||
license:
|
||||
|
||||
Copyright (C) 2001 Thomas Moestl
|
||||
|
||||
This file is part of the pdnsd package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
File diff suppressed because it is too large
Load Diff
|
@ -1,161 +0,0 @@
|
|||
2000-02-15
|
||||
Version 0.2. First working alpha with the extended feature set.
|
||||
|
||||
2000-02-16
|
||||
Version 0.3 with many bugfixes, better standard conformity and
|
||||
some new features.
|
||||
|
||||
2000-02-17
|
||||
Did a lint on the code, implemented soft timeouts, again bugfixes,
|
||||
drastically reduced cache memory requirements, implemented local
|
||||
records.
|
||||
Version 0.4 released.
|
||||
|
||||
2000-02-19
|
||||
Recursive query finally implemented. Version 0.5 out.
|
||||
|
||||
2000-02-20
|
||||
Various bugfixes. The server now always tries to get an AA answer
|
||||
if possible; this implies recursion. This is to deal better with
|
||||
caching servers that may return incomplete results on * queries.
|
||||
This may be a little sub-optimal since it may not take the full
|
||||
effect of caching, but it is the only real possibility of getting
|
||||
complete records.
|
||||
Redid the deps in the makefile for now.
|
||||
Version is now 0.6.
|
||||
|
||||
2000-02-21
|
||||
Another set of bugfixes. Version is 0.6.1.
|
||||
|
||||
2000-02-22
|
||||
Another set of bugfixes. It should stabilize by now. Answer compression
|
||||
is there finally. Version is therefore up again, 0.7 by now.
|
||||
|
||||
2000-02-23
|
||||
Minor bugfixes, isdn interface uptest added. The new record types as of
|
||||
rfc1700 are implemented, but as a compile-time option, since normally
|
||||
there is no need to waste space for them.
|
||||
Version is 0.7.1.
|
||||
|
||||
2000-02-24
|
||||
Version 0.7.2 with all rrs up to KX (36). #define DNS_NEW_RRS in
|
||||
config.h and (re)compile if you want to use them. Delete the cache
|
||||
file before using a version with this option changed!
|
||||
NSAP-PTR does NOT WORK (any incoming answer containing it may cause
|
||||
a format error) because it is ill-designed (see TODO). Never mind, it
|
||||
is officially deprecated anyway.
|
||||
The secure DNS extension record types defined in RFC 2065 (KEY, SIG,
|
||||
NXT) are cached only and therefore useless.
|
||||
|
||||
2000-02-26
|
||||
Version 0.8 with parallel query (and probably new bugs) introduced.
|
||||
|
||||
2000-02-27
|
||||
Version 0.8.1 with minor bugfixes on the new features.
|
||||
|
||||
2000-02-27
|
||||
Version 0.8.5 with authority support and the usual bugifxes. Some issues
|
||||
with standard conformity were also fixed (wow, two versions a day).
|
||||
|
||||
2000-02-28
|
||||
Implemented caching of non-authoritative records. This allows better
|
||||
usage of other caching name servers. This may return non-authoritative
|
||||
records to any non-wildcard query. If a wildcard query arrives, we
|
||||
always look for authoritative records, so we do if the non-authoritative
|
||||
answer does not contain at least one answering record to the query.
|
||||
This fixes the sub-optimal behaviour since 0.6.
|
||||
Version is therefore up to 0.8.7 (0.8.6 was also released today
|
||||
containing bugfixes)
|
||||
|
||||
2000-02-29
|
||||
Better thread support, avoiding deadlocks in signal handling. The cost
|
||||
is unfortunately one more thread.
|
||||
New option server_port in config file.
|
||||
Version is 0.8.8.
|
||||
|
||||
2000-03-01
|
||||
Nailed a renitent memory leak bug to the wall (shame, what a trivial
|
||||
mistake). Also improved handling of error conditions slightly.
|
||||
Version is 0.8.9.
|
||||
|
||||
2000-03-01
|
||||
Cache code cleanup. The development of the non-parallel query code
|
||||
is discontinued, although it still works. If you want serial query,
|
||||
just set PAR_QUERIES to 1.
|
||||
Additional information finally implemented.
|
||||
We are up to 0.9.
|
||||
|
||||
2000-03-02
|
||||
Fixed a DoS possibility.
|
||||
More rfc compatability fixups and a smarter resolver logic.
|
||||
Version 0.9.1
|
||||
|
||||
2000-03-02
|
||||
Added the source section to the config file handling. This allows to
|
||||
source your /etc/hosts file. Version 0.9.2.
|
||||
|
||||
2000-03-02
|
||||
Avoiding double additional records now. Version 0.9.3.
|
||||
|
||||
2000-03-09
|
||||
Fixed some REALLY STUPID bugs. Uuummph, thought it was finished.
|
||||
However, the number of bugs remaining is always n+1...
|
||||
Anyway, we are up to 0.9.4. Hope that there are no mean bugs left.
|
||||
|
||||
2000-03-14
|
||||
Added another uptest, exec. See README for details. Also grained the
|
||||
cache size finer (it's now specified in kB). Version 0.9.5
|
||||
|
||||
2000-04-07
|
||||
Fixed some really stupid bugs, what else? Version is 0.9.6
|
||||
To be more exact: fixed misc bugs, cleaned up hash.c and cache.c
|
||||
|
||||
2000-04-20
|
||||
Again fixed some bugs, version is now 0.9.7.
|
||||
|
||||
2000-04-29
|
||||
Fixed a build problem caused by some missing #defines in glibc2.0 and a
|
||||
minor bug.
|
||||
Version is up to 0.9.8
|
||||
|
||||
2000-04-30
|
||||
Fixed some unclean C code and did a general C lint. Thanks to Byrial
|
||||
Jensen for pointing out some issues. Now using stricter compiler flags.
|
||||
Also replaced the daemon() call in main.c for improved portability.
|
||||
Pre-Released 0.9.9p1
|
||||
|
||||
2000-05-03
|
||||
Released 0.9.9p2 with the changes of 0.9.9p1, Documentation updates,
|
||||
bugfixes, and the Red Hat rc scripts contributed by Torben Janssen.
|
||||
Also, the meaning of the command line option -v has changed.
|
||||
There is a new config file option "lean_query" that is on by
|
||||
default. It is an optimization, so please look in the docs when
|
||||
updating whether you want it switched on or not.
|
||||
Removed the long-dead serial query code from the distribution tree.
|
||||
Some resolvers seem to be broken somehow in a respect that it cares
|
||||
about order in which the records appear. In particular, it wants
|
||||
cname to appear before other records. Ok, so it be...
|
||||
|
||||
|
||||
2000-05-04
|
||||
Save all names in lower case in the rrs.
|
||||
Tidying up the source tree.
|
||||
The long-awaited cache structure changes have been started. Please
|
||||
delete you cache files before using this new release.
|
||||
|
||||
2000-05-05
|
||||
Fixed several bugs in the old and in the new source tree.
|
||||
Use time_t instead of long for internal time storage for compatibility.
|
||||
|
||||
|
||||
2000-05-06
|
||||
Version 0.9.10.
|
||||
This fixes a bug in uptest=if. Red Hat and configuration fixes
|
||||
suggested by Soeren J. Peters were included.
|
||||
|
||||
2000-05-08
|
||||
Version 0.9.11
|
||||
This fixes a locally exploitable security problem (pdnsd.cache was
|
||||
world-writeable). This is actually a one-line fix; for a description of
|
||||
possible dangers, please refer to the html documentation.
|
||||
Thanks to Alan Swanson for reporting.
|
|
@ -1,190 +0,0 @@
|
|||
The installation instructions are in doc/html/doc.html and doc/txt/manual.txt.
|
||||
The system requirements are listed in doc/html/index.html and doc/txt/intro.txt.
|
||||
I recommend using the html version.
|
||||
Following are generic installation instructions for autoconf programs.
|
||||
I strongly recommend to read the Installation section in the docs!
|
||||
|
||||
|
||||
Basic Installation
|
||||
==================
|
||||
|
||||
These are generic installation instructions.
|
||||
|
||||
The `configure' shell script attempts to guess correct values for
|
||||
various system-dependent variables used during compilation. It uses
|
||||
those values to create a `Makefile' in each directory of the package.
|
||||
It may also create one or more `.h' files containing system-dependent
|
||||
definitions. Finally, it creates a shell script `config.status' that
|
||||
you can run in the future to recreate the current configuration, a file
|
||||
`config.cache' that saves the results of its tests to speed up
|
||||
reconfiguring, and a file `config.log' containing compiler output
|
||||
(useful mainly for debugging `configure').
|
||||
|
||||
If you need to do unusual things to compile the package, please try
|
||||
to figure out how `configure' could check whether to do them, and mail
|
||||
diffs or instructions to the address given in the `README' so they can
|
||||
be considered for the next release. If at some point `config.cache'
|
||||
contains results you don't want to keep, you may remove or edit it.
|
||||
|
||||
The file `configure.in' is used to create `configure' by a program
|
||||
called `autoconf'. You only need `configure.in' if you want to change
|
||||
it or regenerate `configure' using a newer version of `autoconf'.
|
||||
|
||||
The simplest way to compile this package is:
|
||||
|
||||
1. `cd' to the directory containing the package's source code and type
|
||||
`./configure' to configure the package for your system. If you're
|
||||
using `csh' on an old version of System V, you might need to type
|
||||
`sh ./configure' instead to prevent `csh' from trying to execute
|
||||
`configure' itself.
|
||||
|
||||
Running `configure' takes awhile. While running, it prints some
|
||||
messages telling which features it is checking for.
|
||||
|
||||
2. Type `make' to compile the package.
|
||||
|
||||
3. Optionally, type `make check' to run any self-tests that come with
|
||||
the package.
|
||||
|
||||
4. Type `make install' to install the programs and any data files and
|
||||
documentation.
|
||||
|
||||
5. You can remove the program binaries and object files from the
|
||||
source code directory by typing `make clean'. To also remove the
|
||||
files that `configure' created (so you can compile the package for
|
||||
a different kind of computer), type `make distclean'. There is
|
||||
also a `make maintainer-clean' target, but that is intended mainly
|
||||
for the package's developers. If you use it, you may have to get
|
||||
all sorts of other programs in order to regenerate files that came
|
||||
with the distribution.
|
||||
|
||||
Compilers and Options
|
||||
=====================
|
||||
|
||||
Some systems require unusual options for compilation or linking that
|
||||
the `configure' script does not know about. You can give `configure'
|
||||
initial values for variables by setting them in the environment. Using
|
||||
a Bourne-compatible shell, you can do that on the command line like
|
||||
this:
|
||||
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
|
||||
|
||||
Or on systems that have the `env' program, you can do it like this:
|
||||
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
|
||||
|
||||
Compiling For Multiple Architectures
|
||||
====================================
|
||||
|
||||
You can compile the package for more than one kind of computer at the
|
||||
same time, by placing the object files for each architecture in their
|
||||
own directory. To do this, you must use a version of `make' that
|
||||
supports the `VPATH' variable, such as GNU `make'. `cd' to the
|
||||
directory where you want the object files and executables to go and run
|
||||
the `configure' script. `configure' automatically checks for the
|
||||
source code in the directory that `configure' is in and in `..'.
|
||||
|
||||
If you have to use a `make' that does not supports the `VPATH'
|
||||
variable, you have to compile the package for one architecture at a time
|
||||
in the source code directory. After you have installed the package for
|
||||
one architecture, use `make distclean' before reconfiguring for another
|
||||
architecture.
|
||||
|
||||
Installation Names
|
||||
==================
|
||||
|
||||
By default, `make install' will install the package's files in
|
||||
`/usr/local/bin', `/usr/local/man', etc. You can specify an
|
||||
installation prefix other than `/usr/local' by giving `configure' the
|
||||
option `--prefix=PATH'.
|
||||
|
||||
You can specify separate installation prefixes for
|
||||
architecture-specific files and architecture-independent files. If you
|
||||
give `configure' the option `--exec-prefix=PATH', the package will use
|
||||
PATH as the prefix for installing programs and libraries.
|
||||
Documentation and other data files will still use the regular prefix.
|
||||
|
||||
In addition, if you use an unusual directory layout you can give
|
||||
options like `--bindir=PATH' to specify different values for particular
|
||||
kinds of files. Run `configure --help' for a list of the directories
|
||||
you can set and what kinds of files go in them.
|
||||
|
||||
If the package supports it, you can cause programs to be installed
|
||||
with an extra prefix or suffix on their names by giving `configure' the
|
||||
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
|
||||
|
||||
Optional Features
|
||||
=================
|
||||
|
||||
Some packages pay attention to `--enable-FEATURE' options to
|
||||
`configure', where FEATURE indicates an optional part of the package.
|
||||
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
|
||||
is something like `gnu-as' or `x' (for the X Window System). The
|
||||
`README' should mention any `--enable-' and `--with-' options that the
|
||||
package recognizes.
|
||||
|
||||
For packages that use the X Window System, `configure' can usually
|
||||
find the X include and library files automatically, but if it doesn't,
|
||||
you can use the `configure' options `--x-includes=DIR' and
|
||||
`--x-libraries=DIR' to specify their locations.
|
||||
|
||||
Specifying the System Type
|
||||
==========================
|
||||
|
||||
There may be some features `configure' can not figure out
|
||||
automatically, but needs to determine by the type of host the package
|
||||
will run on. Usually `configure' can figure that out, but if it prints
|
||||
a message saying it can not guess the host type, give it the
|
||||
`--host=TYPE' option. TYPE can either be a short name for the system
|
||||
type, such as `sun4', or a canonical name with three fields:
|
||||
CPU-COMPANY-SYSTEM
|
||||
|
||||
See the file `config.sub' for the possible values of each field. If
|
||||
`config.sub' isn't included in this package, then this package doesn't
|
||||
need to know the host type.
|
||||
|
||||
If you are building compiler tools for cross-compiling, you can also
|
||||
use the `--target=TYPE' option to select the type of system they will
|
||||
produce code for and the `--build=TYPE' option to select the type of
|
||||
system on which you are compiling the package.
|
||||
|
||||
Sharing Defaults
|
||||
================
|
||||
|
||||
If you want to set default values for `configure' scripts to share,
|
||||
you can create a site shell script called `config.site' that gives
|
||||
default values for variables like `CC', `cache_file', and `prefix'.
|
||||
`configure' looks for `PREFIX/share/config.site' if it exists, then
|
||||
`PREFIX/etc/config.site' if it exists. Or, you can set the
|
||||
`CONFIG_SITE' environment variable to the location of the site script.
|
||||
A warning: not all `configure' scripts look for a site script.
|
||||
|
||||
Operation Controls
|
||||
==================
|
||||
|
||||
`configure' recognizes the following options to control how it
|
||||
operates.
|
||||
|
||||
`--cache-file=FILE'
|
||||
Use and save the results of the tests in FILE instead of
|
||||
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
|
||||
debugging `configure'.
|
||||
|
||||
`--help'
|
||||
Print a summary of the options to `configure', and exit.
|
||||
|
||||
`--quiet'
|
||||
`--silent'
|
||||
`-q'
|
||||
Do not print messages saying which checks are being made. To
|
||||
suppress all normal output, redirect it to `/dev/null' (any error
|
||||
messages will still be shown).
|
||||
|
||||
`--srcdir=DIR'
|
||||
Look for the package's source code in directory DIR. Usually
|
||||
`configure' can determine that directory automatically.
|
||||
|
||||
`--version'
|
||||
Print the version of Autoconf used to generate the `configure'
|
||||
script, and exit.
|
||||
|
||||
`configure' also accepts some other, not widely useful, options.
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
|
||||
SUBDIRS = src doc contrib
|
||||
|
||||
EXTRA_DIST = version ChangeLog.old COPYING.BSD README.par README.par.old PKGBUILD
|
||||
|
||||
# The sample configuration is handled in doc/Makefile.am
|
||||
install-data-hook:
|
||||
$(mkinstalldirs) "$(DESTDIR)$(cachedir)"
|
||||
test -f "$(DESTDIR)$(cachedir)/pdnsd.cache" || \
|
||||
touch "$(DESTDIR)$(cachedir)/pdnsd.cache"
|
||||
if test `whoami` = "root"; then \
|
||||
chown $(def_id) "$(DESTDIR)$(cachedir)/pdnsd.cache"; \
|
||||
chown $(def_id) "$(DESTDIR)$(cachedir)"; \
|
||||
fi
|
||||
chmod 0640 "$(DESTDIR)$(cachedir)/pdnsd.cache"
|
||||
chmod 0750 "$(DESTDIR)$(cachedir)"
|
||||
|
||||
dist-hook: $(PACKAGE).spec.in
|
||||
sed -e '/^%{!?distro: %define distro /c\
|
||||
%if 0%{!?distro:1}\
|
||||
%if "%{_vendor}" == "redhat"\
|
||||
%define distro RedHat\
|
||||
%else\
|
||||
%if "%{_vendor}" == "suse"\
|
||||
%define distro SuSE\
|
||||
%else\
|
||||
%if "%{_vendor}" == "SuSE"\
|
||||
%define distro SuSE\
|
||||
%endif\
|
||||
%endif\
|
||||
%endif\
|
||||
%endif' \
|
||||
-e 's:[@]PACKAGE[@]:$(PACKAGE):g' \
|
||||
-e 's:[@]VERSION[@]:$(VERSION):g' \
|
||||
-e 's:[@]fullversion[@]:$(fullversion):g' \
|
||||
-e 's:[@]packagerelease[@]:$(packagerelease):g' \
|
||||
-e 's:[@]cachedir[@]:/var/cache/$(PACKAGE):g' \
|
||||
-e 's:[@]def_id[@]:$(PACKAGE):g' \
|
||||
$(PACKAGE).spec.in > $(distdir)/$(PACKAGE).spec
|
||||
|
|
@ -1,734 +0,0 @@
|
|||
# Makefile.in generated by automake 1.11.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
|
||||
# Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
subdir = .
|
||||
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
|
||||
$(srcdir)/Makefile.in $(srcdir)/PKGBUILD.in \
|
||||
$(srcdir)/config.h.in $(srcdir)/file-list.base.in \
|
||||
$(srcdir)/pdnsd.spec.in $(top_srcdir)/configure AUTHORS \
|
||||
COPYING ChangeLog INSTALL NEWS THANKS TODO acconfig.h compile \
|
||||
depcomp install-sh missing
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.in
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
|
||||
configure.lineno config.status.lineno
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = config.h
|
||||
CONFIG_CLEAN_FILES = pdnsd.spec file-list.base PKGBUILD
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
SOURCES =
|
||||
DIST_SOURCES =
|
||||
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
|
||||
html-recursive info-recursive install-data-recursive \
|
||||
install-dvi-recursive install-exec-recursive \
|
||||
install-html-recursive install-info-recursive \
|
||||
install-pdf-recursive install-ps-recursive install-recursive \
|
||||
installcheck-recursive installdirs-recursive pdf-recursive \
|
||||
ps-recursive uninstall-recursive
|
||||
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
|
||||
distclean-recursive maintainer-clean-recursive
|
||||
AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
|
||||
$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
|
||||
distdir dist dist-all distcheck
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DIST_SUBDIRS = $(SUBDIRS)
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
distdir = $(PACKAGE)-$(VERSION)
|
||||
top_distdir = $(distdir)
|
||||
am__remove_distdir = \
|
||||
{ test ! -d "$(distdir)" \
|
||||
|| { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
|
||||
&& rm -fr "$(distdir)"; }; }
|
||||
am__relativize = \
|
||||
dir0=`pwd`; \
|
||||
sed_first='s,^\([^/]*\)/.*$$,\1,'; \
|
||||
sed_rest='s,^[^/]*/*,,'; \
|
||||
sed_last='s,^.*/\([^/]*\)$$,\1,'; \
|
||||
sed_butlast='s,/*[^/]*$$,,'; \
|
||||
while test -n "$$dir1"; do \
|
||||
first=`echo "$$dir1" | sed -e "$$sed_first"`; \
|
||||
if test "$$first" != "."; then \
|
||||
if test "$$first" = ".."; then \
|
||||
dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
|
||||
dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
|
||||
else \
|
||||
first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
|
||||
if test "$$first2" = "$$first"; then \
|
||||
dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
|
||||
else \
|
||||
dir2="../$$dir2"; \
|
||||
fi; \
|
||||
dir0="$$dir0"/"$$first"; \
|
||||
fi; \
|
||||
fi; \
|
||||
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
|
||||
done; \
|
||||
reldir="$$dir2"
|
||||
DIST_ARCHIVES = $(distdir).tar.gz
|
||||
GZIP_ENV = --best
|
||||
distuninstallcheck_listfiles = find . -type f -print
|
||||
distcleancheck_listfiles = find . -type f -print
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ALLOCA = @ALLOCA@
|
||||
AMTAR = @AMTAR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
GREP = @GREP@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build_alias = @build_alias@
|
||||
builddir = @builddir@
|
||||
cachedir = @cachedir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
def_id = @def_id@
|
||||
distribution = @distribution@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
fullversion = @fullversion@
|
||||
host_alias = @host_alias@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
packagerelease = @packagerelease@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
specbuild = @specbuild@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
thread_CFLAGS = @thread_CFLAGS@
|
||||
threadlib = @threadlib@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
SUBDIRS = src doc contrib
|
||||
EXTRA_DIST = version ChangeLog.old COPYING.BSD README.par README.par.old PKGBUILD
|
||||
all: config.h
|
||||
$(MAKE) $(AM_MAKEFLAGS) all-recursive
|
||||
|
||||
.SUFFIXES:
|
||||
am--refresh:
|
||||
@:
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \
|
||||
$(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \
|
||||
&& exit 0; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
echo ' $(SHELL) ./config.status'; \
|
||||
$(SHELL) ./config.status;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
$(SHELL) ./config.status --recheck
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
$(am__cd) $(srcdir) && $(AUTOCONF)
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
|
||||
$(am__aclocal_m4_deps):
|
||||
|
||||
config.h: stamp-h1
|
||||
@if test ! -f $@; then \
|
||||
rm -f stamp-h1; \
|
||||
$(MAKE) $(AM_MAKEFLAGS) stamp-h1; \
|
||||
else :; fi
|
||||
|
||||
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
|
||||
@rm -f stamp-h1
|
||||
cd $(top_builddir) && $(SHELL) ./config.status config.h
|
||||
$(srcdir)/config.h.in: $(am__configure_deps) $(top_srcdir)/acconfig.h
|
||||
($(am__cd) $(top_srcdir) && $(AUTOHEADER))
|
||||
rm -f stamp-h1
|
||||
touch $@
|
||||
|
||||
distclean-hdr:
|
||||
-rm -f config.h stamp-h1
|
||||
pdnsd.spec: $(top_builddir)/config.status $(srcdir)/pdnsd.spec.in
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $@
|
||||
file-list.base: $(top_builddir)/config.status $(srcdir)/file-list.base.in
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $@
|
||||
PKGBUILD: $(top_builddir)/config.status $(srcdir)/PKGBUILD.in
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $@
|
||||
|
||||
# This directory's subdirectories are mostly independent; you can cd
|
||||
# into them and run `make' without going through this Makefile.
|
||||
# To change the values of `make' variables: instead of editing Makefiles,
|
||||
# (1) if the variable is set in `config.status', edit `config.status'
|
||||
# (which will cause the Makefiles to be regenerated when you run `make');
|
||||
# (2) otherwise, pass the desired values on the `make' command line.
|
||||
$(RECURSIVE_TARGETS):
|
||||
@fail= failcom='exit 1'; \
|
||||
for f in x $$MAKEFLAGS; do \
|
||||
case $$f in \
|
||||
*=* | --[!k]*);; \
|
||||
*k*) failcom='fail=yes';; \
|
||||
esac; \
|
||||
done; \
|
||||
dot_seen=no; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
dot_seen=yes; \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| eval $$failcom; \
|
||||
done; \
|
||||
if test "$$dot_seen" = "no"; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
|
||||
fi; test -z "$$fail"
|
||||
|
||||
$(RECURSIVE_CLEAN_TARGETS):
|
||||
@fail= failcom='exit 1'; \
|
||||
for f in x $$MAKEFLAGS; do \
|
||||
case $$f in \
|
||||
*=* | --[!k]*);; \
|
||||
*k*) failcom='fail=yes';; \
|
||||
esac; \
|
||||
done; \
|
||||
dot_seen=no; \
|
||||
case "$@" in \
|
||||
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
|
||||
*) list='$(SUBDIRS)' ;; \
|
||||
esac; \
|
||||
rev=''; for subdir in $$list; do \
|
||||
if test "$$subdir" = "."; then :; else \
|
||||
rev="$$subdir $$rev"; \
|
||||
fi; \
|
||||
done; \
|
||||
rev="$$rev ."; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
for subdir in $$rev; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| eval $$failcom; \
|
||||
done && test -z "$$fail"
|
||||
tags-recursive:
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
|
||||
done
|
||||
ctags-recursive:
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
|
||||
done
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
mkid -fID $$unique
|
||||
tags: TAGS
|
||||
|
||||
TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
|
||||
include_option=--etags-include; \
|
||||
empty_fix=.; \
|
||||
else \
|
||||
include_option=--include; \
|
||||
empty_fix=; \
|
||||
fi; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test ! -f $$subdir/TAGS || \
|
||||
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
|
||||
fi; \
|
||||
done; \
|
||||
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
shift; \
|
||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
if test $$# -gt 0; then \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
"$$@" $$unique; \
|
||||
else \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$unique; \
|
||||
fi; \
|
||||
fi
|
||||
ctags: CTAGS
|
||||
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
$(am__remove_distdir)
|
||||
test -d "$(distdir)" || mkdir "$(distdir)"
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test -d "$(distdir)/$$subdir" \
|
||||
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
|
||||
$(am__relativize); \
|
||||
new_distdir=$$reldir; \
|
||||
dir1=$$subdir; dir2="$(top_distdir)"; \
|
||||
$(am__relativize); \
|
||||
new_top_distdir=$$reldir; \
|
||||
echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
|
||||
echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
|
||||
($(am__cd) $$subdir && \
|
||||
$(MAKE) $(AM_MAKEFLAGS) \
|
||||
top_distdir="$$new_top_distdir" \
|
||||
distdir="$$new_distdir" \
|
||||
am__remove_distdir=: \
|
||||
am__skip_length_check=: \
|
||||
am__skip_mode_fix=: \
|
||||
distdir) \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
$(MAKE) $(AM_MAKEFLAGS) \
|
||||
top_distdir="$(top_distdir)" distdir="$(distdir)" \
|
||||
dist-hook
|
||||
-test -n "$(am__skip_mode_fix)" \
|
||||
|| find "$(distdir)" -type d ! -perm -755 \
|
||||
-exec chmod u+rwx,go+rx {} \; -o \
|
||||
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
|
||||
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
|
||||
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
|
||||
|| chmod -R a+r "$(distdir)"
|
||||
dist-gzip: distdir
|
||||
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-bzip2: distdir
|
||||
tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-lzma: distdir
|
||||
tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-xz: distdir
|
||||
tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-tarZ: distdir
|
||||
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-shar: distdir
|
||||
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-zip: distdir
|
||||
-rm -f $(distdir).zip
|
||||
zip -rq $(distdir).zip $(distdir)
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist dist-all: distdir
|
||||
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
|
||||
$(am__remove_distdir)
|
||||
|
||||
# This target untars the dist file and tries a VPATH configuration. Then
|
||||
# it guarantees that the distribution is self-contained by making another
|
||||
# tarfile.
|
||||
distcheck: dist
|
||||
case '$(DIST_ARCHIVES)' in \
|
||||
*.tar.gz*) \
|
||||
GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
|
||||
*.tar.bz2*) \
|
||||
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
|
||||
*.tar.lzma*) \
|
||||
lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
|
||||
*.tar.xz*) \
|
||||
xz -dc $(distdir).tar.xz | $(am__untar) ;;\
|
||||
*.tar.Z*) \
|
||||
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
|
||||
*.shar.gz*) \
|
||||
GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
|
||||
*.zip*) \
|
||||
unzip $(distdir).zip ;;\
|
||||
esac
|
||||
chmod -R a-w $(distdir); chmod a+w $(distdir)
|
||||
mkdir $(distdir)/_build
|
||||
mkdir $(distdir)/_inst
|
||||
chmod a-w $(distdir)
|
||||
test -d $(distdir)/_build || exit 0; \
|
||||
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
|
||||
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
|
||||
&& am__cwd=`pwd` \
|
||||
&& $(am__cd) $(distdir)/_build \
|
||||
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
|
||||
$(DISTCHECK_CONFIGURE_FLAGS) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) check \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) install \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
|
||||
distuninstallcheck \
|
||||
&& chmod -R a-w "$$dc_install_base" \
|
||||
&& ({ \
|
||||
(cd ../.. && umask 077 && mkdir "$$dc_destdir") \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
|
||||
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
|
||||
} || { rm -rf "$$dc_destdir"; exit 1; }) \
|
||||
&& rm -rf "$$dc_destdir" \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dist \
|
||||
&& rm -rf $(DIST_ARCHIVES) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
|
||||
&& cd "$$am__cwd" \
|
||||
|| exit 1
|
||||
$(am__remove_distdir)
|
||||
@(echo "$(distdir) archives ready for distribution: "; \
|
||||
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
|
||||
sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
|
||||
distuninstallcheck:
|
||||
@$(am__cd) '$(distuninstallcheck_dir)' \
|
||||
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|
||||
|| { echo "ERROR: files left after uninstall:" ; \
|
||||
if test -n "$(DESTDIR)"; then \
|
||||
echo " (check DESTDIR support)"; \
|
||||
fi ; \
|
||||
$(distuninstallcheck_listfiles) ; \
|
||||
exit 1; } >&2
|
||||
distcleancheck: distclean
|
||||
@if test '$(srcdir)' = . ; then \
|
||||
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
|
||||
exit 1 ; \
|
||||
fi
|
||||
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|
||||
|| { echo "ERROR: files left in build directory after distclean:" ; \
|
||||
$(distcleancheck_listfiles) ; \
|
||||
exit 1; } >&2
|
||||
check-am: all-am
|
||||
check: check-recursive
|
||||
all-am: Makefile config.h
|
||||
installdirs: installdirs-recursive
|
||||
installdirs-am:
|
||||
install: install-recursive
|
||||
install-exec: install-exec-recursive
|
||||
install-data: install-data-recursive
|
||||
uninstall: uninstall-recursive
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-recursive
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-recursive
|
||||
|
||||
clean-am: clean-generic mostlyclean-am
|
||||
|
||||
distclean: distclean-recursive
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-generic distclean-hdr distclean-tags
|
||||
|
||||
dvi: dvi-recursive
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-recursive
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-recursive
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
@$(NORMAL_INSTALL)
|
||||
$(MAKE) $(AM_MAKEFLAGS) install-data-hook
|
||||
install-dvi: install-dvi-recursive
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-recursive
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-recursive
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-recursive
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-recursive
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-recursive
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
-rm -rf $(top_srcdir)/autom4te.cache
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-recursive
|
||||
|
||||
mostlyclean-am: mostlyclean-generic
|
||||
|
||||
pdf: pdf-recursive
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-recursive
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am:
|
||||
|
||||
.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \
|
||||
ctags-recursive install-am install-data-am install-strip \
|
||||
tags-recursive
|
||||
|
||||
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
|
||||
all all-am am--refresh check check-am clean clean-generic \
|
||||
ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \
|
||||
dist-hook dist-lzma dist-shar dist-tarZ dist-xz dist-zip \
|
||||
distcheck distclean distclean-generic distclean-hdr \
|
||||
distclean-tags distcleancheck distdir distuninstallcheck dvi \
|
||||
dvi-am html html-am info info-am install install-am \
|
||||
install-data install-data-am install-data-hook install-dvi \
|
||||
install-dvi-am install-exec install-exec-am install-html \
|
||||
install-html-am install-info install-info-am install-man \
|
||||
install-pdf install-pdf-am install-ps install-ps-am \
|
||||
install-strip installcheck installcheck-am installdirs \
|
||||
installdirs-am maintainer-clean maintainer-clean-generic \
|
||||
mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \
|
||||
tags-recursive uninstall uninstall-am
|
||||
|
||||
|
||||
# The sample configuration is handled in doc/Makefile.am
|
||||
install-data-hook:
|
||||
$(mkinstalldirs) "$(DESTDIR)$(cachedir)"
|
||||
test -f "$(DESTDIR)$(cachedir)/pdnsd.cache" || \
|
||||
touch "$(DESTDIR)$(cachedir)/pdnsd.cache"
|
||||
if test `whoami` = "root"; then \
|
||||
chown $(def_id) "$(DESTDIR)$(cachedir)/pdnsd.cache"; \
|
||||
chown $(def_id) "$(DESTDIR)$(cachedir)"; \
|
||||
fi
|
||||
chmod 0640 "$(DESTDIR)$(cachedir)/pdnsd.cache"
|
||||
chmod 0750 "$(DESTDIR)$(cachedir)"
|
||||
|
||||
dist-hook: $(PACKAGE).spec.in
|
||||
sed -e '/^%{!?distro: %define distro /c\
|
||||
%if 0%{!?distro:1}\
|
||||
%if "%{_vendor}" == "redhat"\
|
||||
%define distro RedHat\
|
||||
%else\
|
||||
%if "%{_vendor}" == "suse"\
|
||||
%define distro SuSE\
|
||||
%else\
|
||||
%if "%{_vendor}" == "SuSE"\
|
||||
%define distro SuSE\
|
||||
%endif\
|
||||
%endif\
|
||||
%endif\
|
||||
%endif' \
|
||||
-e 's:[@]PACKAGE[@]:$(PACKAGE):g' \
|
||||
-e 's:[@]VERSION[@]:$(VERSION):g' \
|
||||
-e 's:[@]fullversion[@]:$(fullversion):g' \
|
||||
-e 's:[@]packagerelease[@]:$(packagerelease):g' \
|
||||
-e 's:[@]cachedir[@]:/var/cache/$(PACKAGE):g' \
|
||||
-e 's:[@]def_id[@]:$(PACKAGE):g' \
|
||||
$(PACKAGE).spec.in > $(distdir)/$(PACKAGE).spec
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
|
@ -1,324 +0,0 @@
|
|||
Version 1.2.9a fixes a bug in the 1.2.9 release that causes a build failure when
|
||||
pdnsd is configured with --enable-strict-rfc2181. Unless you use this option to
|
||||
compile pdnsd, there is no need to upgrade from 1.2.9 to 1.2.9a.
|
||||
|
||||
Version 1.2.9 has support for many additional RR types, in particular those
|
||||
needed for DNSSEC (though no support for the DNSSEC protocol itself yet in
|
||||
pdnsd). Caching data structures are now more efficient when they only store the
|
||||
most commonly used RR types. Fine-grained configurability over which RR-types
|
||||
are cache-able. Pdnsd now has support for EDNS (Extension mechanisms for DNS),
|
||||
although its usefulness is currently limited to enabling UDP messages larger
|
||||
than 512 bytes. Defining local TXT records in the configuration file is now
|
||||
supported. A new configuration option provides a fix in case the query uptest
|
||||
fails due to remote servers ignoring empty queries. Several bugs have been fixed
|
||||
including a UDP socket descriptor leak that affected the FreeBSD platform, and
|
||||
an IPv6 port binding bug.
|
||||
|
||||
Version 1.2.8 implements support for automatic discovery of root servers.
|
||||
There are also some improvements in the resolver and a new default setting for
|
||||
the neg_rrs_pol configuration option.
|
||||
|
||||
Version 1.2.7-par fixes some security problems. It contains a fix for a
|
||||
"dangling pointer" bug that could cause pdnsd to crash when it received a long
|
||||
reply. It also addresses some of the issues raised in the CERT vulnerability
|
||||
note VU#800113 by making the default of query_port_start equal to 1024, thereby
|
||||
ensuring that source ports are randomly selected by the pdnsd resolver in the
|
||||
range 1024-65535. This release also fixes problems with compiling pdnsd for the
|
||||
ARM architecture and for the Darwin platform (Max OS X). There are a number of
|
||||
(minor) new features. pdnsd now supports "include" files, essentially
|
||||
configuration files that only contain definitions for local records. It is now
|
||||
possible to define interactively, using pdnsd-ctl, any local record that can be
|
||||
defined in a configuration file.
|
||||
|
||||
Version 1.2.6-par has an upgraded license: GPL version 3.
|
||||
A bug has been fixed which which caused pdnsd to handle NXDOMAIN replies
|
||||
inefficiently when configured with neg_domain_pol=on. Also the code for the
|
||||
ping test has been fixed, which was broken for 64-bit systems. A new option
|
||||
randomize_servers can be used to give each server in a section of the
|
||||
configuration file an equal chance of being queried. The new options reject,
|
||||
reject_policy and reject_recursively make it possible to check for the presence
|
||||
of certain IP addresses in the replies of name servers and to correct some types
|
||||
of unwanted replies or to censor these IP addresses.
|
||||
The pdnsd-ctl 'add a' and 'add aaaa' commands now allow multiple IP addresses to
|
||||
be specified for the same name. There are some further improvements to pdnsd's
|
||||
recursive resolver.
|
||||
|
||||
Version 1.2.5-par introduces a new query method: udp_tcp. With this method a UDP
|
||||
query is tried first and, if the UDP answer is truncated, the query is repeated
|
||||
using TCP, which is the behaviour that seems to be recommended by the DNS
|
||||
standards. There is a new configuration option use_nss, which can be turned off
|
||||
to prevent lengthy timeouts and stalls in certain situations. A bug has been
|
||||
fixed which could cause pdnsd to crash if debug output was generated before the
|
||||
debug output stream was properly initialized.
|
||||
|
||||
In version 1.2.4-par a memory leak and a minor buffer-overflow problem have been
|
||||
fixed. There is now a fix for some situations that would previously cause pdnsd
|
||||
to exit prematurely (such as ACPI S3 sleep or trying to attach strace to pdnsd).
|
||||
Time intervals specified in the configuration file can now be expressed in
|
||||
minutes, hours, days and weeks as well as seconds. Support for Apple Mac OS X
|
||||
v10.4 Tiger has been improved. The "pdnsd-ctl status" command now also provides
|
||||
some information about the status of the running threads. There are some further
|
||||
improvements in the debugging information provided by pdnsd.
|
||||
TCP-query support is now compiled in by default (but can still be disabled using
|
||||
the configure option --disable-tcp-queries).
|
||||
|
||||
In version 1.2.3-par the "pdnsd-ctl empty-cache" command can be provided with an
|
||||
include/exclude list, allowing the user to specify a selection of names to be
|
||||
removed, instead of emptying the cache completely.
|
||||
Additional improvements: pdnsd should now remain responsive while executing the
|
||||
"pdnsd-ctl empty-cache" command. With the query_method=tcp_udp option pdnsd will
|
||||
now also try a UDP query after a TCP connection times out, which should allow
|
||||
pdnsd to resolve the same names with query_method=tcp_udp as with
|
||||
query_method=udp_only, although perhaps with an occasional delay.
|
||||
"pdnsd-ctl config" or "pdnsd-ctl server" commands should now run without delays,
|
||||
even if pdnsd is performing ping or query uptests at the time. A problem with
|
||||
resolving certain names using root servers has been fixed.
|
||||
|
||||
Version 1.2.2-par has a number of important portability improvements. A bug has
|
||||
been fixed that prevented pdnsd from compiling successfully on some 64 bit
|
||||
architectures. The code for determining endianness (most significant or least
|
||||
significant byte first) should now be more portable. This release has
|
||||
(experimental) support for the Darwin (Apple Mac OS X) platform. On Linux
|
||||
systems, the configure script will now try to detect automatically whether the
|
||||
system implements the Native POSIX Thread Library, but the method used may not
|
||||
necessarily be foolproof. In addition, the debug features have been improved and
|
||||
should make it easier to find out why pdnsd considers some queries or replies
|
||||
malformed.
|
||||
|
||||
Version 1.2.1-par has improved support for non-Linux platforms. This release has
|
||||
(experimental) support for the Cygwin platform, and should also fix some
|
||||
compilation glitches that have been reported by FreeBSD users.
|
||||
|
||||
Version 1.2-par is a new and improved version of pdnsd! Most of the changes
|
||||
effect the internal workings of pdnsd, but there are also a number of
|
||||
interesting new features (well, I think they are interesting). Among the bugs
|
||||
fixed are two rather nasty ones which involve the handling of NXT and NAPTR
|
||||
records and which can cause pdnsd to crash or abort. The new features include a
|
||||
new server availability test which can be specified with uptest=query, support
|
||||
for reading the DNS configuration from resolv.conf files, a new option for
|
||||
optimizing the use of root servers, a new option that makes defining local
|
||||
records for reverse resolving easier, support for defining wildcard records, a
|
||||
new pdnsd-ctl command for reloading the config file without restarting pdnsd,
|
||||
and a new pdnsd-ctl command for dumping information about the names stored in
|
||||
the cache.
|
||||
The documentation has also been updated: there is now a pdnsd.conf man page. For
|
||||
a more complete list of the changes I'll have to refer you to README.par and the
|
||||
ChangeLog.
|
||||
|
||||
Version 1.1.11a-par contains a fix for FreeBSD users that bypasses a problem
|
||||
with the macro ENONET, which can cause a compilation failure when it is
|
||||
undefined. Linux users will notice no difference between 1.1.11a-par and
|
||||
1.1.11-par.
|
||||
|
||||
Version 1.1.11-par has a rather large number of small changes, which are rather
|
||||
difficult to summarize. Among the bugs fixed are a race condition in the cache
|
||||
lookup code, a flaw in the code that caused a busy spin when a remote server
|
||||
answered with "Not Implemented", and problems with the -4 and -6 command-line
|
||||
options. Among the improvements are an alternative sorting algorithm which
|
||||
should allow pdnsd to start up faster when reading a large cache file from disk,
|
||||
automatic mapping of IPv4 to IPv6 addresses when running in IPv6 mode, somewhat
|
||||
more efficient memory use, better compression of the replies and changes in the
|
||||
parallel querying algorithm that should improve the chances of catching a reply
|
||||
from a remote server. For a more complete list of the changes I'll have to
|
||||
refer you to README.par and the ChangeLog.
|
||||
|
||||
Version 1.1.10-par has a new parser for configuration files, completely
|
||||
rewritten from scratch in C. The main advantages are: (f)lex and yacc/bison are
|
||||
no longer needed to build pdnsd, more informative error messages instead of
|
||||
merely "parse error", and string literals no longer need to be enclosed in
|
||||
quotes in most cases. Furthermore, a bug has been fixed that caused incorrect
|
||||
IPV6-type PTR records to be generated when sourcing /etc/hosts like files.
|
||||
There have been other small changes, more details can be found in the ChangeLog.
|
||||
|
||||
Version 1.1.9-par adds some missing pieces to the documentation (the pdnsd
|
||||
manual and the man page for pdnsd-ctl). The changes to the code consist mostly
|
||||
of optimizations, removal of some size limits due to fixed-size buffers, and
|
||||
some cleaning up. I've also tried to make the error responses of pdnsd-ctl more
|
||||
helpful. More details can be found in the ChangeLog.
|
||||
|
||||
Version 1.1.8b1-par8 introduces a "delegation-only" feature that may be useful
|
||||
for blocking Verisign's Sitefinder. The parser for the configuration file now
|
||||
tolerates domain names missing a dot at the end. I have provided alternative
|
||||
implementations for some GNU extensions that I used in an effort to make the
|
||||
code more portable. In particular, the code should build on FreeBSD again. More
|
||||
details can be found in the README.par file.
|
||||
|
||||
Version 1.1.8b1-par7 fixing a number of bugs. I have also reworked some of the
|
||||
code for adding and removing entries in the cache in an effort to improve
|
||||
efficiency and stability. More details can be found in the ChangeLog.
|
||||
|
||||
Version 1.1.8b1-par6 introduces some further code cleanup. In addition the
|
||||
documentation has been revised.
|
||||
|
||||
Version 1.1.8b1-par5 fixes a troublesome allocation size error that has been
|
||||
discovered in Thomas Moestl's code. In practice this bug only wastes memory but
|
||||
it could also potentially lead to memory corruption. Upgrading is
|
||||
recommended. More details can be found in the ChangeLog.
|
||||
|
||||
Version 1.1.8b1-par4 has been released. Due to incompatibilities between
|
||||
various implementations of the pthread library on Linux systems, problems can
|
||||
occur with signal handling in pdnsd. The usual symptom is failure by pdnsd to
|
||||
save the cache to disk, and /var/cache/pdnsd/pdnsd.cache remaining empty. If you
|
||||
experience this kind of trouble, try reconfiguring with different values for the
|
||||
new --with-thread-lib option. The allowable values are described in the
|
||||
documentation.
|
||||
|
||||
pdnsd is no longer maintained by Thomas Moestl: I have not had time to maintain
|
||||
pdnsd for quite a while now, and have been very slow to respond to issues, or
|
||||
did not respond at all. It is time that I officially announce that pdnsd is no
|
||||
longer actively maintained; I apologize to all those who reported bugs or asked
|
||||
questions without receiving any reply. However, Paul A. Rombouts has published a
|
||||
patch set against the last released version at
|
||||
http://www.phys.uu.nl/~rombouts/pdnsd.html, which cleans up a lot of code fixes
|
||||
many bugs.
|
||||
|
||||
Version 1.1.7a fixes a reversed assertion that would cause pdnsd to terminate
|
||||
if used with the ping uptest. No other changes were made.
|
||||
|
||||
Version 1.1.7 fixes some problems that might be remotely exploitable to
|
||||
gain access as the user pdnsd runs as (an unprivileged user by default). To do
|
||||
this, an attacker needs to control a name server that is queried by pdnsd, and
|
||||
send a malicious reply to such a query. Upgrading is strongly recommended!
|
||||
There are also minor bug fixes and stability improvements.
|
||||
|
||||
Version 1.1.6 adds the query_port_start and query_port_end options (contributed
|
||||
by Andreas Steinmetz), that allow confining the ports pdnsd uses for outgoing
|
||||
queries to a certain range. It also fixes numerous bugs, one of which could
|
||||
cause pdnsd to hang; update is therefore recommended.
|
||||
|
||||
Version 1.1.5 contains a fix for a security bug that would allow local users
|
||||
that are allowed to use pdnsd-ctl on a running pdnsd server to execute
|
||||
arbitrary code as the user that pdnsd runs as (or on Linux, when strict_setuid
|
||||
is not enabled, as the user that started pdnsd). The danger of this is usually
|
||||
quite limited; the status socket is not enabled by default, it's default
|
||||
permissions do only allow the user pdnsd runs as to use the socket,
|
||||
strict_setuid is enabled by default and pdnsd runs as an unprivileged user.
|
||||
There is also a new configure option, --enable-underscores, that will make
|
||||
pdnsd allow underscores in domain names. Furthermore, the SRV record handling
|
||||
has been fixed to allow underscores in any case (this was not allowed
|
||||
previously, but is required by the RFC). SOA records are not put in the
|
||||
answer section any more if no answers are found (this violates the RFC's).
|
||||
It may be put in the authority section in a later version.
|
||||
There are also various bugfixes in this release.
|
||||
Upgrade is recommended.
|
||||
|
||||
Version 1.1.4 fixes various smaller bugs, and should also improve the cache
|
||||
write performance especially for larger caches. There are also two new
|
||||
features: servers can now be given a label (using the label server option)
|
||||
which can be used to identify them for the pdnsd-ctl server command
|
||||
(contributed by Andrew M. Bishop), and local records can be marked to make
|
||||
the domain record authoritative in pdnsd's cache (which means that pdnsd will
|
||||
assume that records that are not present in the cache for that domain are
|
||||
non-existent); this is on by default now, and can be controlled using the new
|
||||
authrec server option).
|
||||
|
||||
Version 1.1.3 added contrib/ and had a lot of robustness fixes.
|
||||
This release addresses a security hole that affects only Linux systems. Due to
|
||||
a bug in glibc, pdnsd could crash during a port scan. This release contains
|
||||
a workaround for this, as well as a fix for a deadlock under heavy load
|
||||
conditions. It also fixes a possible problem that could be triggered by
|
||||
malicious servers, and contains numerous bug fixes.
|
||||
A script, contributed by Marko Stolle, makes pdnsd useful in a DHCP setup.
|
||||
pdnsd also preservers the case of names in the cache, and should work much
|
||||
better on alpha machines (thanks for the contributions by Bjoern Fischer
|
||||
and P.J. Bostley that made this possible). New types were dded for rr
|
||||
sections and pdnsd-ctl.
|
||||
Upgrade is recommended.
|
||||
|
||||
Version 1.1.2 has a fix for a bug that could cause SERVFAIL to be
|
||||
returned when NXDOMAIN would be appropriate. The bug surfaced only when
|
||||
pdnsd queried name servers with a behaviour different from BIND's in the
|
||||
NXDOMAIN case, e.g. pdnsd querying another pdnsd or e.g. djbdns.
|
||||
|
||||
Version 1.1.1 fixes a possible race condition in status socket creation.
|
||||
This race might be used by a local attacker to change the access
|
||||
permissions of a certain file in /tmp. The risk of this is probably
|
||||
negligible. The default setup uses a non-privileged user, default mode
|
||||
0600, and the status socket is disabled normally, so this should be
|
||||
relatively safe. I don't see any possibility to exploit this, it is
|
||||
more of a paranoia fix.
|
||||
There are also some other minor fixes and documentation improvements.
|
||||
Upgrade is recommended.
|
||||
|
||||
Version 1.1.0 introduces negative cacheing, pdnsd-ctl enhancements and
|
||||
a much improved FreeBSD support. The cache file format has changed from
|
||||
prior releases. Some configuration defaults have changed, too.
|
||||
|
||||
Version 1.0.15 is mostly a bugfix release. It also has a new option:
|
||||
randomize_recs in the global section.
|
||||
|
||||
Version 1.0.14 has a fix in icmp.c that will make it build properly
|
||||
on FreeBSD and older Linux systems.
|
||||
|
||||
Version 1.0.13 has some code cleanup, a fix for the Debian rc install,
|
||||
and a security fix (contributed by Olaf Kirch): when changing
|
||||
user and group id, pdnsd did not drop supplementary group IDs that
|
||||
the original user was member of.
|
||||
|
||||
Version 1.0.12 is a bugfix release and contains some security
|
||||
enhancements. There are also inclusion/exclusion lists for servers
|
||||
(new options include=, exclude=, policy= in the server
|
||||
section).
|
||||
|
||||
Version 1.0.11 fixes two bugs that might be used for denial-of-service
|
||||
attacks, upgrading is recommended.
|
||||
|
||||
Versions 1.0.9 and 1.0.10 are bugfix releases.
|
||||
|
||||
Version 1.0.8 introduces special linux ppp device support contributed
|
||||
by Ron Yorston, and has some bugfixes.
|
||||
|
||||
Version 1.0.7 introduces autoconf support, many new config file options and
|
||||
the new pdnsd-ctl run-time configuration program.
|
||||
|
||||
Version 1.0.6 has another set of bugfixes, in addition to higher compile-
|
||||
time configurability and UDP query support. It also contains Debian rc
|
||||
scripts contributed by Markus Mohr.
|
||||
|
||||
Version 1.0.5 has some bugfixes and the new "server_ip" option
|
||||
contributed by Wolfgang Ocker.
|
||||
|
||||
Version 1.0.4 introduces the new options run_as, strict_setuid and
|
||||
paranoid. These new options are optional security enhancements.
|
||||
|
||||
Versions 1.0.1, 1.0.2 and 1.0.3 are bugfix releases.
|
||||
|
||||
Version 1.0.0 has a lot of changes compared to the 0.9.x tree, but much of
|
||||
them "under the hood":
|
||||
- IPv6 support (experimental; compile- and run-time configurable)
|
||||
- FreeBSD (and such hopefully *BSD) support
|
||||
- better rfc2181 compatability
|
||||
- new options:
|
||||
- serve_aliases in source section
|
||||
- linkdown_kluge in global section
|
||||
- max_ttl in global section
|
||||
- cache-code reorganization, only one unified hash (of variable depth)
|
||||
- Optimizations & cleanups
|
||||
- Automatic deps (only interesting for developers ;-)
|
||||
|
||||
Version 0.9.11 fixes a locally exploitable security hole (the cache file was
|
||||
world writeable by default). Please see ChangeLog.old for details.
|
||||
|
||||
Version 0.9.10 fixes some bugs and improves build on Red Hat.
|
||||
|
||||
Version 0.9.9 contains the rc scripts for Red Hat Linux contributed by Torben
|
||||
Janssen, in addition to code cleanups and bugfixes.
|
||||
The meaning of the option -v has changed in this release.
|
||||
There is also a new config file option "lean_query" that is on by default. It
|
||||
is an optimization, so please look in the docs when updating whether you want
|
||||
it switched on or not.
|
||||
|
||||
When compiling versions after 0.9.8, you will probably get more
|
||||
compiler warningsthan before. This is because the C compiler settings
|
||||
have been made stricter.
|
||||
|
||||
Version 0.9.8 fixes a minor bug some build problems with glibc2.0 systems.
|
||||
|
||||
The versions 0.9.6 and 0.9.7 are bugfix releases.
|
||||
|
||||
Version 0.9.5 introduces uptest=exec, and a modified config file syntax (cache
|
||||
sizes are now specified in kB).
|
||||
|
||||
Version 0.9.4 was the first to be released to the public. For information on
|
||||
changes, see ChangeLog.
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
# Package build script for Arch Linux,
|
||||
# contributed by Alexander Drozdov.
|
||||
|
||||
pkgname=@PACKAGE@
|
||||
pkgver=@VERSION@
|
||||
pkgrel=@packagerelease@
|
||||
pkgdesc="pdnsd is a proxy DNS server with permanent caching (the cache contents are written to hard disk on exit) that is designed to cope with unreachable or down DNS servers."
|
||||
url="http://members.home.nl/p.a.rombouts/pdnsd.html"
|
||||
license="GPLv3"
|
||||
depends=()
|
||||
makedepends=(glibc)
|
||||
conflicts=()
|
||||
replaces=()
|
||||
backup=()
|
||||
install=
|
||||
source=(http://members.home.nl/p.a.rombouts/pdnsd/releases/$pkgname-$pkgver-$pkgrel.tar.gz)
|
||||
md5sums=()
|
||||
|
||||
build() {
|
||||
cd $startdir/src/$pkgname-$pkgver
|
||||
./configure --prefix=/usr --enable-ipv6 --sysconfdir=/etc --with-distribution=ArchLinux
|
||||
make || return 1
|
||||
make DESTDIR=$startdir/pkg install
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
You can find the documentation for pdnsd in the doc/ directory. The html
|
||||
documentation (which I recommend) is in the doc/html/ subdirectory.
|
||||
The pure text documentation (which is generated automatically from the
|
||||
html documentation) is in doc/txt/.
|
||||
The following documents are available:
|
||||
|
||||
index.html / intro.txt Overview, system requirements
|
||||
doc.html / manual.txt Building, installation and usage instructions
|
||||
faq.html / faq.txt The FAQ
|
||||
|
||||
Share and enjoy!
|
||||
Thomas <tmoestl@gmx.net>
|
||||
|
||||
|
||||
For news about recent changes in pdnsd the following files may be of
|
||||
interest to you:
|
||||
|
||||
README.par
|
||||
ChangeLog
|
||||
NEWS
|
||||
|
||||
Last revised: 08 July 2007 by Paul Rombouts
|
|
@ -1,216 +0,0 @@
|
|||
pdnsd version 1.2.9a by Paul Rombouts
|
||||
=====================================
|
||||
|
||||
This file describes the version of pdnsd that I maintain personally and am
|
||||
making available so other people can enjoy the latest features and fixes. Thomas
|
||||
Moestl no longer maintains pdnsd himself, so I am effectively the new
|
||||
maintainer. This README describes the new features in version 1.2. This version
|
||||
has a rather large number of internal changes and also some new features, which
|
||||
I am rather pleased with, even if I say so myself. I think the changes are
|
||||
significant enough to warrant increasing the minor version number from 1.1 to
|
||||
1.2. The differences between my previous "official" release 1.1.11 and Thomas'
|
||||
last release 1.1.7a are described in my previous README, which I have renamed
|
||||
REAME.par.old. In this README I restrict myself to describing changes between
|
||||
1.1.11 and 1.2.
|
||||
The main difference between versions 1.2 and 1.2.1, aside from some minor
|
||||
changes, is that 1.2.1 has (experimental) support for the Cygwin platform.
|
||||
Version 1.2.2 has further improvements in portability and should in
|
||||
particular now also compile on the Darwin (Apple Mac OS X) platform.
|
||||
Version 1.2.4 has some important fixes for a memory leak, a minor buffer-
|
||||
overflow problem and some situations which could cause pdnsd to exit
|
||||
prematurely. Note that TCP-query support is now compiled in by default, but can
|
||||
still be disabled using a configure option.
|
||||
The main new feature of version 1.2.5 is the new query method "udp_tcp".
|
||||
Version 1.2.6 has an updated license: GPL version 3. The main new feature of
|
||||
version 1.2.6 is the "reject" option, which makes it possible to censor or
|
||||
correct for unwanted IP addresses in replies.
|
||||
Version 1.2.7 contains an important fix for a "dangling pointer" bug and
|
||||
attempts to make pdnsd less vulnerable to the issues raised in CERT
|
||||
vulnerability note VU#800113. It also contains some improvements for defining
|
||||
local records interactively using the pdnsd-ctl utility.
|
||||
The main new feature of version 1.2.8 is automatic discovery of root servers,
|
||||
as well as some minor improvements in the resolver.
|
||||
Version 1.2.9 among other things supports many addtional RR types, uses data
|
||||
structures that should be more slightly more memory efficient and has support
|
||||
for EDNS, which allows DNS UDP messages to be larger than 512 bytes.
|
||||
Version 1.2.9a is a simple bugfix release that fixes a problem with compiling
|
||||
1.2.9 after configuring with --enable-strict-rfc2181. Unless you use this option
|
||||
to compile pdnsd, there is no need to upgrade from 1.2.9 to 1.2.9a.
|
||||
|
||||
For instructions how to compile and install pdnsd see doc/html/doc.html or
|
||||
doc/txt/manual.txt. Note that I am no longer distributing a patch w.r.t. Thomas'
|
||||
version because the (compressed) patch file is barely smaller than the
|
||||
(compressed) tar archive.
|
||||
|
||||
Here follows a list of some of changes in version 1.2 from a user's perspective.
|
||||
For a more technical description of some of the changes in the code see the ChangeLog.
|
||||
For a short history about recent releases have a look at NEWS or doc/html/index.html.
|
||||
|
||||
- First of all, two potentially rather nasty bugs have been fixed in the code
|
||||
for the handling of NXT and NAPTR records. A response from a remote server
|
||||
containing NXT records (even well-formed ones) will very likely cause pdnsd to
|
||||
crash. The code for handling NAPTR records contained incorrect ASSERT
|
||||
statements, which could cause pdnsd to abort in a controlled fashion, but
|
||||
completely unnecessarily.
|
||||
|
||||
- Sampo Lehtinen has remarked that pdnsd sometimes failed to resolve classless
|
||||
reversed-delegated IP addresses, and that this has something to do with the
|
||||
fact that pdnsd didn't accept '/' characters in domain names. After reading
|
||||
some of the relevant RFCs I decided to remove all restrictions on the types
|
||||
of characters that pdnsd accepts in domain names. Of course for most
|
||||
applications, there are many characters which don't make sense in domain
|
||||
names, but I feel that it is the responsibility of the client application to
|
||||
reject these, not the proxy server.
|
||||
|
||||
- At the suggestion of Dan Tihelka, I have expanded to the server_ip= option to
|
||||
allow the name of an interface to be specified instead of an IP address.
|
||||
Presently this has been tested on Linux only. Can someone running pdnsd on
|
||||
*BSD tell me if the code for getting the address of an interface is different
|
||||
for Linux and BSD-type systems?
|
||||
|
||||
- At the suggestion of Juliusz Chroboczek I've added an new server availability
|
||||
test which can be specified with uptest=query. This can be useful as an
|
||||
alternative to "uptest=ping" in case the remote server does not respond to
|
||||
ICMP_ECHO requests at all, which unfortunately is quite common these days.
|
||||
"uptest=query" causes pdnsd to send an empty query to remote name servers. Any
|
||||
well-formed response (apart from SERVFAIL) within the timeout period will be
|
||||
interpreted as a sign that the server is "up".
|
||||
|
||||
- Instead of specifying the IP addresses of the name servers that pdnsd should
|
||||
query in a server section of the config file, you may also specify a
|
||||
resolv.conf-style file. Preferably this should not be /etc/resolv.conf. If the
|
||||
contents of the resolv.conf type file changes while pdnsd is running, you can
|
||||
make pdnsd aware of the changes with the "pdnsd-ctl config" command, see
|
||||
below. Example:
|
||||
|
||||
server {
|
||||
label=myisp;
|
||||
file=/etc/ppp/resolv.conf;
|
||||
timeout=10;
|
||||
}
|
||||
|
||||
- There is a new option for "server" sections in the config file:
|
||||
root_server=on/off.
|
||||
In case a server section contains only addresses of root servers, which
|
||||
usually only give the name servers of top level domains in their reply,
|
||||
setting root_server=on will enable certain optimizations. This involves using
|
||||
cached information to reduce queries to the root servers, thus speeding up the
|
||||
resolving of new names.
|
||||
|
||||
- New option for "rr" sections in the config file: reverse=on/off.
|
||||
If you want a locally defined name to resolve to a numeric address and vice
|
||||
versa, you can now achieve this by setting reverse=on before defining the A
|
||||
record, making it unnecessary to define a separate PTR record for the reverse
|
||||
resolving.
|
||||
Example:
|
||||
|
||||
rr {
|
||||
name = localhost;
|
||||
reverse = on;
|
||||
a = 127.0.0.1;
|
||||
}
|
||||
|
||||
has the same effect as:
|
||||
|
||||
rr {
|
||||
name = localhost;
|
||||
a = 127.0.0.1;
|
||||
}
|
||||
rr {
|
||||
name = 1.0.0.127.in-addr.arpa;
|
||||
ptr = localhost;
|
||||
}
|
||||
|
||||
- In rr sections it is now possible to specify a wildcard name, i.e. a name
|
||||
starting with the label *. The * in a wildcard can match one or more labels in
|
||||
a queried name, but only whole labels. For example, *.mydomain will match
|
||||
a.mydomain or www.a.mydomain, but not mydomain. Before you can specify an rr
|
||||
section with name=*.mydomain you must define some records for mydomain,
|
||||
typically NS and/or SOA records.
|
||||
Example:
|
||||
|
||||
rr {
|
||||
name = mydomain;
|
||||
ns = localhost;
|
||||
soa = localhost, root.localhost, 42, 86400, 900, 86400, 86400;
|
||||
}
|
||||
rr {
|
||||
name = *.mydomain;
|
||||
a = 192.168.1.10;
|
||||
}
|
||||
|
||||
- There is a slight backwards compatibility problem which involves the name= and
|
||||
owner= options in rr sections. The new version does not allow you to place
|
||||
owner= before name=. On the other hand, you may now freely mix the owner
|
||||
option with the a,ptr,cname,mx and soa options and define as many records of
|
||||
this type as you like (including zero).
|
||||
|
||||
- pdnsd-ctl has three new commands:
|
||||
|
||||
config: Reloads pdnsd's configuration file. This is more efficient than
|
||||
restarting pdnsd, and should not cause only noticeable interruption in DNS
|
||||
service. However, some types of configuration changes cannot be put into
|
||||
effect this way, and you will be prompted to restart pdnsd instead.
|
||||
|
||||
empty-cache: Empties the cache completely, freeing all existing entries.
|
||||
In version 1.2.3 you can specify a selection of entries to delete by providing
|
||||
a list of include/exclude patterns.
|
||||
|
||||
dump: Prints information about all the names stored in the cached. This is
|
||||
mainly useful for diagnostic purposes.
|
||||
|
||||
- There is now a pdnsd.conf(5) man page, describing pdnsd's configuration file.
|
||||
The man page has been generated from the html documentation using a customized
|
||||
Perl script.
|
||||
|
||||
- New in version 1.2.4: Time intervals in the configuration files can now be
|
||||
expressed in seconds, minutes, hours, days and weeks, using the suffixes
|
||||
s,m,h,d,and w.
|
||||
Example: 2h30m is interpreted as 2*60*60 + 30*60 = 9000 seconds.
|
||||
|
||||
- Version 1.2.5 introduces a new configuration option, contributed by Jan-Marek
|
||||
Glogowski, called "use_nss" which can be turned off to prevent nasty delays in
|
||||
certain situations.
|
||||
Besides the query methods "udp_only", "tcp_only" and "tcp_udp" you can now
|
||||
also specify "udp_tcp", which more closely adheres to the behaviour
|
||||
recommended by DNS standards.
|
||||
|
||||
- Version 1.2.6 introduces the "randomize_servers" and "reject" options. By
|
||||
setting "randomize_servers" on you can give each server in a server section an
|
||||
equal chance of being queried, which is useful when resolving from root
|
||||
servers, for instance. The "reject" option can be used to censor certain IP
|
||||
addresses or correct for unwanted replies from servers you don't completely
|
||||
trust.
|
||||
|
||||
- Version 1.2.7 contains support for "include" files which can be referenced
|
||||
from configuration files or read interactively using pdnsd-ctl. These files
|
||||
can be used to add local definitions to the cache without reconfiguring pdnsd.
|
||||
The new "pdnsd-ctl eval" command can be used to interactively define local
|
||||
records that could previously only be defined in configuration files but not
|
||||
with the "pdnsd-ctl add" command.
|
||||
|
||||
- Version 1.2.8 contains support for automatic discovery of root servers.
|
||||
Instead of supplying a complete list of IP addresses of root servers in a
|
||||
server section of the configuration file, you need only enter one or two
|
||||
addresses of name servers which know the names and addresses of the root
|
||||
servers and set "root_server=discover".
|
||||
The "neg_rrs_pol" option has a new default setting, which should allow
|
||||
sensible negative caching of RRs in most situations, even if "proxy_only=on".
|
||||
|
||||
- Version 1.2.9 contains support for EDNS (Extension mechanisms for DNS), which
|
||||
allows UDP messages to be larger than 512 bytes. Whether pdnsd uses EDNS in
|
||||
outgoing queries is determined by the configuration option "edns_query". If
|
||||
pdnsd receives a query using EDNS, it will reply using EDNS regardless of the
|
||||
configuration settings.
|
||||
Local TXT records can now be defined in the configuration file.
|
||||
If the query uptest fails due to remote servers ignoring empty queries, this
|
||||
can now be remedied using the new "query_test_name" config option.
|
||||
|
||||
The new features are described in greater detail in the manual doc/html/doc.html
|
||||
or doc/txt/manual.txt.
|
||||
|
||||
Enjoy!
|
||||
|
||||
If you have any questions about my version of pdnsd, you can send these
|
||||
to <p.a.rombouts@home.nl>. Questions about the original (unmaintained) pdnsd
|
||||
version should be sent to <tmoestl@gmx.net> or <t.moestl@tu-bs.de>.
|
|
@ -1,249 +0,0 @@
|
|||
pdnsd maintenance version 1.1.11-par by Paul Rombouts
|
||||
=======================================================
|
||||
|
||||
This file describes the version of pdnsd that I maintain personally and am
|
||||
making available so other people can enjoy the latest features and fixes.
|
||||
Thomas Moestl no longer maintains pdnsd himself, so I am effectively the new
|
||||
maintainer. The current version is 1.1.11-par, which has a rather large number
|
||||
of small changes. Among the bugs fixed are a race condition in the cache lookup
|
||||
code, a flaw in the code that caused a busy spin when a remote server answered
|
||||
with "Not Implemented", and problems with the -4 and -6 command-line options.
|
||||
Among the improvements are an alternative sorting algorithm which should allow
|
||||
pdnsd to start up faster when reading a large cache file from disk, automatic
|
||||
mapping of IPv4 to IPv6 addresses when running in IPv6 mode, somewhat more
|
||||
efficient memory use, and better compression of the replies. Some of the new
|
||||
features are described in the second half of this file (look for "new in version
|
||||
1.1.11"). For the rest of the changes I will have to refer you to the ChangeLog.
|
||||
For a short history about recent releases have a look at doc/html/index.html.
|
||||
|
||||
Since version 1.1.9 I've added some missing pieces to the documentation (the
|
||||
manual doc/html/doc.html,doc/txt/manual.txt and the man page doc/pdnsd-ctl.8).
|
||||
Version 1.1.11 finally has a man page doc/pdnsd.8, thanks to a contribution by
|
||||
Mahesh T. Pai.
|
||||
|
||||
The first part of this file describes how to patch, compile, install and run
|
||||
pdnsd. The second part describes some of the changes I've made to Thomas
|
||||
Moestl's code.
|
||||
|
||||
Unless you're using the pre-patched source archive pdnsd-1.1.11-par.tar.gz you
|
||||
must first apply my patch file pdnsd-1.1.11-par.diff.gz before compiling and
|
||||
installing pdnsd according to Thomas Moestl's instructions described in the the
|
||||
documentation. Use a freshly untarred copy of Thomas Moestl's original version
|
||||
1.1.7a source, cd into the source directory pdnsd-1.1.7a and apply the command:
|
||||
|
||||
gzip -cd <path_to_patch>/pdnsd-1.1.11-par.diff.gz | patch -p2 -N -Z
|
||||
|
||||
Note: I have used GNU extensions so there may be some portability issues. I have
|
||||
supplied alternatives for some of the less portable functions. There should be no
|
||||
problem with most Linux distributions.
|
||||
|
||||
That's it! You should now be able to compile, install and run pdnsd. See the
|
||||
documentation in doc/html/doc.html or doc/txt/manual.txt for more detailed
|
||||
instructions.
|
||||
|
||||
Some people may want change the compiler optimization flag. I use the -O2 flag,
|
||||
but it might be safer to use a lower level of optimization or no optimization at
|
||||
all. In that case prefix the configure command with the desired compiler flags
|
||||
like this (assuming you're using a bash shell):
|
||||
|
||||
CFLAGS="-O1 -g -Wall" ./configure ...
|
||||
|
||||
I have added a new configuration option "--with-thread-lib=<lib>", which you
|
||||
should use if you experience problems with signal handling under Linux. The
|
||||
usual symptom is failure by pdnsd to save the cache to disk, and
|
||||
/var/cache/pdnsd/pdnsd.cache remaining empty. If you experience this kind of
|
||||
trouble, try reconfiguring with different values for the --with-thread-lib
|
||||
option. The allowable values are "linuxthreads" (the default), "linuxthreads2"
|
||||
(or "lt2" for short), and "nptl". I recommend that you first configure and
|
||||
compile without the --with-thread-lib option, then if you experience trouble try
|
||||
again with --with-thread-lib=lt2 and recompile.
|
||||
If your Linux system has an implementation of the Native POSIX Thread Library,
|
||||
which is the case with Red Hat 9 for instance, you should use
|
||||
--with-thread-lib=nptl .
|
||||
Ideally, I would like to write a configure script which automatically detects
|
||||
which kind of thread library is being used on a Linux system, but I don't have a
|
||||
clue yet how to do this. If you can help me with this please write to me at the
|
||||
email address listed at the end of this file.
|
||||
|
||||
The rest of this file describes some of the modifications I've made, but you
|
||||
don't have to read it if you simply want to run pdnsd as you're used to.
|
||||
|
||||
|
||||
- The main new feature I've added enables you to change the server addresses
|
||||
that pdnsd uses at run-time using pdnsd-ctl. I've done this because the ISPs I
|
||||
use do not specify fixed DNS server addresses, but expect their clients to use
|
||||
dynamic DNS configuration (DHCP in the case of the cable connection, RFC1877
|
||||
in case of isdn). I've extended the options that can be given with the
|
||||
"server" command to pdnsd-ctl, to allow IP addresses to be specified as an
|
||||
additional argument after "up|down|retest". This allows me to put something
|
||||
like this in my ifup-local script:
|
||||
|
||||
pdnsd-ctl server isp-label up "$DNS1 $DNS2"
|
||||
|
||||
For more details how to use pdnsd-ctl read the updated documentation in
|
||||
the doc/html directory. There is also a manpage for pdnsd-ctl.
|
||||
This was quite tricky to implement because there might be pending queries
|
||||
while the addresses are being changed. It certainly was an interesting
|
||||
exercise in writing multi-threaded code for me.
|
||||
|
||||
|
||||
- I've implemented a feature which allowed me to specify multiple IP addresses
|
||||
per server section in the configuration file. This allowed for a much more
|
||||
compact configuration file (3 server sections instead of 7 in my case),
|
||||
because most configuration options are identical for servers belonging to the
|
||||
same ISP. It also made the output of "pdnsd-ctl status" more compact. And it
|
||||
was necessary to enable a satisfactory implementation of the previous feature.
|
||||
Example of the new syntax:
|
||||
|
||||
ip = 123.456.789.001, 123.456.789.002, 123.456.789.003;
|
||||
|
||||
At the suggestion of Greg Norris server sections no longer have to specify IP
|
||||
addresses. A server section without IP addresses will remain inactive until it
|
||||
is assigned one more addresses at run-time with pdnsd-ctl.
|
||||
|
||||
- I've changed the implementation of dynamic arrays to make it slightly more
|
||||
efficient, and improve type safety. I also got rid of several arrays of fixed
|
||||
size in favor of dynamically allocated arrays. In particular, I got rid of
|
||||
all occurrences of MAXPATH. I also made several static variables "automatic".
|
||||
|
||||
- The output of the "status" command of pdnsd-ctl now gives more meaningful
|
||||
constant names "ping|none|if|exec" instead of numbers for the "uptest" option.
|
||||
I've also added some information that was previously missing.
|
||||
|
||||
- I've fixed I a problem that caused pdnsd to use up a lot of CPU time and slow
|
||||
down my system considerably when it received a query that took a long time to
|
||||
resolve. It turned out that pdnsd can get into a "busy spin" when one of the
|
||||
DNS servers pdnsd is querying refuses the connection. Apart from fixing this
|
||||
bug, to speed things up additionally, I thought it would be a good idea to
|
||||
mark a server down (without retesting it) after detecting errno==ECONNREFUSED.
|
||||
This gives me very satisfactory performance, with the problematic server being
|
||||
tried only once during every testing interval.
|
||||
|
||||
New in version 1.1.11: An additional busy spin condition, triggered when a
|
||||
remote server answers with "Not Implemented", has been discovered and fixed.
|
||||
In case there are remaining bugs in the multiplexing code, I've added a test
|
||||
that checks if the number of events reported by poll/select matches the number
|
||||
of events handled by pdnsd. If not, pdnsd will log an error message and give
|
||||
up. Although the bugs still need to be reported and fixed, at least this
|
||||
should prevent pdnsd from wasting CPU cycles.
|
||||
|
||||
- Due to a bug in Thomas' code, pdnsd tries, but fails, to remove the control
|
||||
socket "pdnsd.status" before exiting. This has also been fixed. In version
|
||||
1.1.8b1-par6 I have cleaned this up some more so that pdnsd will handle
|
||||
situations where it can't open or bind the control socket more gracefully.
|
||||
|
||||
- I've rewritten some of the code that saves the contents of the cache to the
|
||||
file "pdnsd.cache" just before pdnsd exits. This is because I noticed in my
|
||||
logfiles that pdnsd occasionally had problems reading this file back at
|
||||
startup. I eliminated the use of fseek() in Thomas' code. I could not find
|
||||
anything that was demonstrably incorrect about his use of fseek(), but it
|
||||
seemed better to me to do without it and write the file in a strictly
|
||||
sequential order. Anyway, it turned out my hunch paid off: no more error
|
||||
messages about "pdnsd.cache" in my logfile.
|
||||
|
||||
New in version 1.1.11: I've added some new code for sorting the queue used for
|
||||
purging stale cache entries. This should allow pdnsd to start up faster when
|
||||
reading large cache files from disk.
|
||||
|
||||
- I've extended the configuration options for policies of inclusion/exclusion
|
||||
lists in server sections. The new policies options are "simple_only" and
|
||||
"fqdn_only". Setting policy=simple_only will cause the server to used only for
|
||||
simple hostnames if no other rule matches. On the other hand, setting
|
||||
policy=fqdn_only will cause the server to be used only for fully qualified
|
||||
domain names (i.e. the name has at least one dot in-between). I find these
|
||||
options useful for controlling which name servers (if any) will be used by
|
||||
pdnsd for simple host names.
|
||||
|
||||
- I've added a new "delegation_only" option that can be used to undo the
|
||||
unwanted effects of DNS "wildcards". It works roughly as the feature by the
|
||||
same name in BIND. It is turned off by default. To block Verisign's
|
||||
Sitefinder, add the following line to the global section of the configuration
|
||||
file:
|
||||
|
||||
delegation_only= com, net;
|
||||
|
||||
If you find that this feature blocks some legitimate domain names, you will
|
||||
probably need to add the address of a nameserver that provides good authority
|
||||
information. More information can be found at
|
||||
http://www.phys.uu.nl/~rombouts/pdnsd/delegationonly.html
|
||||
|
||||
- It is no longer mandatory that domain names in the configuration file end in a
|
||||
dot.
|
||||
|
||||
- The parser for configuration files has been rewritten purely in C, so (f)lex
|
||||
and yacc/bison are no longer needed to build pdnsd.
|
||||
It is no longer necessary to place strings between quotes in the configuration
|
||||
file, unless a string contains a special character such as whitespace, a token
|
||||
that normally starts a comment, or one of the characters ",;{}". Note that
|
||||
these special characters are illegal in domain names anyway.
|
||||
|
||||
- New in version 1.1.11: Negating whole domains with a neg section in the
|
||||
config file will result in all the subdomains being negated as well.
|
||||
For example, adding the lines
|
||||
|
||||
neg {name=doubleclick.com; types=domain;}
|
||||
neg {name=doubleclick.net; types=domain;}
|
||||
|
||||
will also negate ad.doubleclick.com, ad.fr.doubleclick.net, etc.
|
||||
|
||||
- New in version 1.1.11: When running in IPv6 mode, pdnsd will now automatically
|
||||
map any IPv4 addresses it reads in the config file to IPv6 addresses.
|
||||
When pdnsd has been compiled with IPv6 support and runs in IPv4 mode, it will
|
||||
skip IPv6 addresses with a warning message. This may result in certain server
|
||||
sections becoming inactive, though.
|
||||
|
||||
The -4 and -6 options should now work as advertised.
|
||||
I've added two new command-line options, "-a" and "-i <prefix>".
|
||||
With the -a flag pdnsd will try to detect automatically if IPv6 support is
|
||||
available on a system, and fall back to IPv4 if not. The -a flag can be used
|
||||
instead of -4 or -6.
|
||||
The -i option can be used to specify a prefix for mapping IPv4 to IPv6
|
||||
address. The default is ::ffff.0.0.0.0. There is also a corresponding
|
||||
ipv4_6_prefix= option for the config file.
|
||||
|
||||
- New in version 1.1.11: I've slightly changed the way pdnsd does parallel
|
||||
queries. Active queries or not canceled until we have received a useful
|
||||
response from a remote name server, or all the queries have failed or timed
|
||||
out. Thus the par_queries parameter is no longer the maximum number of
|
||||
parallel queries, but rather the increment with which the number of parallel
|
||||
queries is increased when the previous set has timed out. In the worst case
|
||||
there will be pending queries to all the servers in the list of available
|
||||
servers simultaneously. We may be wasting more system resources this way, but
|
||||
the advantage is that we have a greater chance of catching a reply. After all,
|
||||
if we wait longer anyway, why not for more servers.
|
||||
I've also introduced a global timeout parameter. This is the minimum period of
|
||||
time pdnsd will wait after sending the first query to a remote server before
|
||||
giving up without having received a reply. The timeout options in the
|
||||
configuration file are now only minimum timeout intervals. Setting the global
|
||||
timeout option makes it possible to specify quite short timeout intervals in
|
||||
the server sections. This will have the effect that pdnsd will start querying
|
||||
additional servers fairly quickly if the first servers are slow to respond
|
||||
(but will still continue to listen for responses from the first ones). This
|
||||
may allow pdnsd to get an answer more quickly in certain situations.
|
||||
|
||||
After receiving a reply from a remote server the server is marked up and its
|
||||
time stamp is updated. This will have the effect that pdnsd doesn't bother
|
||||
testing this server for availability for a period of time, and thus the
|
||||
overhead caused by testing is reduced. After server timeouts, uptests are
|
||||
performed by the separate server status thread, not by threads that have to
|
||||
answer queries. Unresponsive servers with uptest=ping will not be marked down
|
||||
immediately any more, but only after the ping test has definitely failed.
|
||||
|
||||
I've also included a number of bug-fixes contained in a patch file supplied to
|
||||
me by Thomas Moestl. In addition to the things I had already fixed, the
|
||||
following issues are addressed: some memory leaks, dropping of root privileges
|
||||
before calling uptest scripts in case pdnsd was started setuid root (which is a
|
||||
bad idea anyway), passing on open fd's to uptests, integer overruns in the
|
||||
status reporting code, fixing string passing from the lexer, more consistent
|
||||
treatment of underscores in domain names.
|
||||
|
||||
In addition to the things I've listed above, I've made various little changes to
|
||||
fix minor bugs, improve efficiency or elegance, or simply to suit my my own
|
||||
coding style. These changes are too numerous to list here, but some of them are
|
||||
listed in the ChangeLog. Of course if you are really interested in the
|
||||
nitty-gritty you can always compare the source of my version with Thomas'
|
||||
original code.
|
||||
|
||||
If you have any questions about the modifications I've made, you can send these
|
||||
to <p.a.rombouts@home.nl>. Questions about the original pdnsd version should
|
||||
be sent to <tmoestl@gmx.net> or <t.moestl@tu-bs.de>.
|
|
@ -1,66 +0,0 @@
|
|||
This is a (hopefully complete) list of people I have to thank for helping me
|
||||
develop and improve pdnsd:
|
||||
|
||||
David G. Andersen
|
||||
Andrew M. Bishop
|
||||
Daniel Black
|
||||
Carsten Block
|
||||
Stephan Boettcher
|
||||
P.J. Bostley
|
||||
Rodney Brown
|
||||
Kevin A. Burton
|
||||
Juliusz Chroboczek
|
||||
Joachim Dorner
|
||||
Frank Elsner
|
||||
Christian Engstler
|
||||
Stefan Erhardt
|
||||
Bjoern Fischer
|
||||
Stefan Förster
|
||||
Bert Frederiks
|
||||
Mike Hammer
|
||||
Jonathan Hudson
|
||||
Torben Janssen
|
||||
Byrial Jensen
|
||||
Olaf Kirch
|
||||
Nikola Kotur
|
||||
Kiyo Kelvin Lee
|
||||
Bernd Leibing
|
||||
Patrick Loschmidt
|
||||
James MacLean
|
||||
Sourav K. Mandal
|
||||
Fraser McCrossan
|
||||
Markus Mohr
|
||||
Michael Müller
|
||||
Gustavo Niemeyer
|
||||
Alexandre Nunes
|
||||
Wolfgang Ocker
|
||||
Mahesh T. Pai
|
||||
Bernhard Pelz
|
||||
Soenke J. Peters
|
||||
Erich Reitz
|
||||
Paul A. Rombouts
|
||||
Brian Schroeder
|
||||
Roman Shterenzon
|
||||
Daniel Smolik
|
||||
Milan P. Stanic
|
||||
Michael Steiner
|
||||
Norbert Steinl
|
||||
Andreas Steinmetz
|
||||
Marko Stolle
|
||||
Markus Storm
|
||||
Michael Ströder
|
||||
Thomas Stromberg
|
||||
Alan Swanson
|
||||
Lyonel Vincent
|
||||
Eelco Vriezekolk
|
||||
Paul Wagland
|
||||
Sverker Wiberg
|
||||
Michael Wiedmann
|
||||
Ron Yorston
|
||||
Nikita V. Youshchenko
|
||||
Jan-Marek Glogowski
|
||||
Thomas Cort
|
||||
Pierre Habouzit
|
||||
Dirk Armbrust
|
||||
Georg Schwarz
|
||||
Ashish Shukla
|
|
@ -1,20 +0,0 @@
|
|||
- Implement a reference counter to ensure that newly entered records are not
|
||||
purged immediately (really needed?)
|
||||
- Perhaps do a two-step form of recursive query: first query those servers we
|
||||
have got cached, then (if unsuccessful) look the others up and query again.
|
||||
The impact of this optimisation may not be very big, because all sane servers
|
||||
give A records for NS records if possible.
|
||||
- Test for compatibility on other Unix-like Systems other than the BSDs and
|
||||
Linux; rewrite the functions in netdev.c and icmp.c for those OSs if
|
||||
necessary. Also try to get compatibility for other compilers than gcc.
|
||||
- Write an install rule for the Slackware start-up script.
|
||||
- Update the FAQ.
|
||||
- Implement DNSSEC support. Since version 1.2.9, pdnsd is able to cache the RR
|
||||
types necessary for DNSSEC, but the resolver is not yet security aware.
|
||||
- Implement a lookup table (hash table) for queries in progress. This would
|
||||
enable a thread that is resolving a query that is already being handled by
|
||||
another thread to wait for that other thread to finish and copy its result
|
||||
rather than independently query remote servers. It is very common for
|
||||
resolvers to resend UDP queries if they don't get a reply within a timeout
|
||||
period and if the answer is not yet cached, this will result in multiple
|
||||
threads duplicating each others work in the current implementation.
|
|
@ -1,191 +0,0 @@
|
|||
#ifndef _CONFIG_H_
|
||||
#define _CONFIG_H_
|
||||
|
||||
/* ONLY EDIT acconfig.h, NEVER config.h or config.h.in!
|
||||
* config.h MAY BE OVERWRITTEN BY make, config.h.in by autoheader! */
|
||||
|
||||
/* Define your Target here. Currently defined are TARGET_LINUX (any
|
||||
* architecture), TARGET_BSD (experimental; tested on FreeBSD, hopefully
|
||||
* works for other BSD variants) and TARGET_CYGWIN. */
|
||||
#define TARGET TARGET_LINUX
|
||||
|
||||
/* change the #undef to #define if you do not want to compile with special
|
||||
* ISDN support for Linux. Note that the ISDN support will not compile ok on
|
||||
* unpatched kernerls earlier than 2.2.12 (if you did apply newer isdn patches,
|
||||
* it may work fine). This is not on by default because it will cause compile
|
||||
* problems on some systems */
|
||||
#undef ISDN_SUPPORT
|
||||
|
||||
/* The following regulates the IP Protocol support. Supported types are IPv4
|
||||
* and IPv6 (aka IPng). You may enable either or both of these protocols.
|
||||
* Enabling in this context means that support for the respective protocol
|
||||
* will be in the binary. When running the binary, one of the protocols may
|
||||
* be activated via command line switches. Note that activating both IPv4 and
|
||||
* IPv6 is pointless (and will not work because two UDP and two TCP threads
|
||||
* will be started that concur for ports). Because of that, it is not allowed.
|
||||
* When pdnsd runs with IPv6 activated it should be able to service queries
|
||||
* from IPv6 as well as from IPv4 hosts, provided that you host is configured
|
||||
* properly.
|
||||
* For each of the protocols there are two options: ENABLE_IPV4 and ENABLE_IPV6
|
||||
* control whether support for the respective protocol is available in the
|
||||
* binary. DEFAULT_IPV4 selects which protocol is enabled on pdnsd
|
||||
* startup by default. 1 means IPv4, while 0 means IPv6. If support for
|
||||
* a protocol was included in the executable, you can specify command line
|
||||
* parameters to activate or deactivate that protocol (the options are -4 and
|
||||
* -6), but it makes more sense to use the run_ipv4=on/off option in the
|
||||
* configuration file.
|
||||
* Make your choice. Note that IPv6 support is experimental in pdnsd.
|
||||
* In normal operation, you will currently only need IPv4. */
|
||||
#undef ENABLE_IPV4
|
||||
#define DEFAULT_IPV4 1
|
||||
#undef ENABLE_IPV6
|
||||
|
||||
/* In all pdnsd versions before 1.0.6, DNS queries were always done over
|
||||
* TCP. Now, you have the choice. You can control that behaviour using
|
||||
* the -m command line switch, and you can give a preset here. There
|
||||
* are 3 different modes:
|
||||
* UDP_ONLY: This is undoubtedly the fastest query method, because
|
||||
* no TCP negotiation needs to be done.
|
||||
* TCP_ONLY: This is slower than uo, but generally more secure
|
||||
* against DNS spoofing. Note that some name servers on the
|
||||
* internet do not support TCP queries, notably dnscache.
|
||||
* TCP_UDP: TCP, then UDP. If the TCP query fails with a "connection refused"-
|
||||
* error or times out, the query is retried using UDP.
|
||||
* UDP_TCP: UDP, then TCP. If the UDP reply is truncated (i.e. the tc flag is set),
|
||||
* the query is retried using TCP. */
|
||||
#define M_PRESET UDP_ONLY
|
||||
|
||||
/* In addition to choosing the presets, you may also completely disable
|
||||
* one of the protocols (TCP for preset UDP_ONLY and UDP for preset TCP_ONLY).
|
||||
* This saves some executable space. */
|
||||
#undef NO_UDP_QUERIES
|
||||
#undef NO_TCP_QUERIES
|
||||
|
||||
/* With the following option, you can disable the TCP server functionality
|
||||
* of pdnsd. Nearly no program does TCP queries, so you probably can do
|
||||
* this safely and save some executable space and one thread.
|
||||
* You also can turn off the TCP server at runtime with the --notcp option. */
|
||||
#undef NO_TCP_SERVER
|
||||
|
||||
/* By undefining the following, you can disable the UDP source address
|
||||
* discovery code. This is not recommended, but you may need it when
|
||||
* running into compilation problems. */
|
||||
#undef SRC_ADDR_DISC
|
||||
|
||||
/* NO_POLL specifies not to use poll(2), but select(2) instead. If you are
|
||||
* unsure about what this means, just leave this as it is.*/
|
||||
#undef NO_POLL
|
||||
|
||||
/* Define this for "hard" RFC 2181 compliance: this RFC states that
|
||||
* implementations should discard answers whose RR sets have multiple
|
||||
* different time stamps. While correct answers are generated, incorrect
|
||||
* ones are normally tolerated and corrected. Full RFC compliance is
|
||||
* however only achieved by deactivating this behaviour and thus being
|
||||
* intolerant. */
|
||||
#undef RFC2181_ME_HARDER
|
||||
|
||||
/* Define this to the device you want to use for getting random numbers.
|
||||
* Leave this undefined if you wand to use the standard C library random
|
||||
* function, which basically should be sufficient.
|
||||
* Linux and FreeBSD have two random number devices: /dev/random and
|
||||
* /dev/urandom. /dev/urandom might be less secure in some cases, but
|
||||
* should still be more than sufficient. The use of /dev/random is
|
||||
* discouraged, as reading from this device blocks when new random bits
|
||||
* need to be gathered. */
|
||||
#undef RANDOM_DEVICE
|
||||
#undef R_DEFAULT
|
||||
#undef R_RANDOM
|
||||
#undef R_ARC4RANDOM
|
||||
/*#define RANDOM_DEVICE "/dev/urandom"*/
|
||||
|
||||
/* Designate which database manager to use for cacheing.
|
||||
* default: native; others: gdbm */
|
||||
#define CACHE_DBM DBM_NATIVE
|
||||
|
||||
#define CACHEDIR "/var/cache/pdnsd"
|
||||
|
||||
#define TEMPDIR "/tmp";
|
||||
|
||||
/* This is for various debugging facilities that produce debug output and
|
||||
* double-check some values. You can enable debug messages with the -g option.
|
||||
* Normally, you can switch this off safely by setting the number after DEBUG
|
||||
* to 0. This will increase speed (although only marginally), save space
|
||||
* in the executable (only about 12kB) and some stack space per thread
|
||||
* (which may be significant if you have many threads running simultaneously).
|
||||
* However, it may be an aid when debugging config files.
|
||||
* The only defined debug levels by now are in the range 0 - 9.
|
||||
* Define this to 9 if you want hex dumps of all the queries and replies pdnsd
|
||||
* receives (you must also call pdnsd with -v9 to actually see the hex dumps).
|
||||
* When in doubt, leave it defined to 1. */
|
||||
#define DEBUG 1
|
||||
|
||||
/* This defines the default verbosity of informational messages you will get.
|
||||
This has nothing to to with the debug option (-g), but may be set with -v
|
||||
option. 0 is for normal operation, up to 3 for debugging.
|
||||
Unlike the debug messages, these messages will also be written to the syslog.*/
|
||||
#define VERBOSITY 0
|
||||
|
||||
/* Redefine this if you want another hash size.
|
||||
* The number of hash buckets is computed as power of two (1<<HASH_SZ);
|
||||
* so e.g. HASH_SZ set to 10 yields 1024 hash rows.
|
||||
* HASH_SZ may not be bigger than 32 (if you set it even close to that value,
|
||||
* you are nuts.) */
|
||||
#define HASH_SZ 10
|
||||
|
||||
/* Set this to debug the hash tables. Turn this off normally, or you will get
|
||||
* flooded with diagnostic messages */
|
||||
#undef DEBUG_HASH
|
||||
|
||||
/* Define if you have working C99 Variadic macro support */
|
||||
#undef CPP_C99_VARIADIC_MACROS
|
||||
|
||||
/* Define as int if socklen_t typedef is missing */
|
||||
#undef socklen_t
|
||||
|
||||
/* Lock the UDP socket before using it? */
|
||||
#undef SOCKET_LOCKING
|
||||
|
||||
/* Default TCP timeout when receiving queries */
|
||||
#define TCP_TIMEOUT 30
|
||||
|
||||
/* Allow subsequent TCP queries on one connection? */
|
||||
#undef TCP_SUBSEQ
|
||||
|
||||
/* Default value for parallel query number */
|
||||
#define PAR_QUERIES 2
|
||||
|
||||
/* Maximum number of IP addresses used per nameserver obtained from NS records. */
|
||||
#define MAXNAMESERVIPS 3
|
||||
|
||||
/* These are the possible targets. Normally no need to touch these
|
||||
* definitions. */
|
||||
#define TARGET_LINUX 0
|
||||
#define TARGET_BSD 1
|
||||
#define TARGET_CYGWIN 2
|
||||
|
||||
/* Assume the Native POSIX Thread Library instead of LinuxThreads ? */
|
||||
#undef THREADLIB_NPTL
|
||||
|
||||
/* If we are using LinuxThreads, implement the fix needed for newer glibcs ? */
|
||||
#undef THREADLIB_LINUXTHREADS2
|
||||
|
||||
/* The following is needed for using LinuxThreads. Better don't touch. */
|
||||
#define _REENTRANT 1
|
||||
#define _THREAD_SAFE 1
|
||||
|
||||
/* It appears the newer versions of gcc won't convert a pointer to char into
|
||||
a pointer to unsigned char and vice versa without complaining.
|
||||
By using casts these warning messages can be suppressed, but at the cost
|
||||
of losing some type safety.
|
||||
Define charp and ucharp to be empty if you are a developer and find type
|
||||
safety more important.
|
||||
Leave the definitions unchanged to avoid distracting warning messages. */
|
||||
#define charp (char *)
|
||||
#define ucharp (unsigned char *)
|
||||
|
||||
|
||||
/* pdnsd version. DO NOT TOUCH THIS! It is replaced automatically by the
|
||||
* contents of ./version */
|
||||
#define VERSION "@VERSION@"
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
|
@ -1,142 +0,0 @@
|
|||
#! /bin/sh
|
||||
# Wrapper for compilers which do not understand `-c -o'.
|
||||
|
||||
scriptversion=2005-05-14.22
|
||||
|
||||
# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
# Written by Tom Tromey <tromey@cygnus.com>.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# This file is maintained in Automake, please report
|
||||
# bugs to <bug-automake@gnu.org> or send patches to
|
||||
# <automake-patches@gnu.org>.
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: compile [--help] [--version] PROGRAM [ARGS]
|
||||
|
||||
Wrapper for compilers which do not understand `-c -o'.
|
||||
Remove `-o dest.o' from ARGS, run PROGRAM with the remaining
|
||||
arguments, and rename the output as expected.
|
||||
|
||||
If you are trying to build a whole package this is not the
|
||||
right script to run: please start by reading the file `INSTALL'.
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "compile $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
|
||||
ofile=
|
||||
cfile=
|
||||
eat=
|
||||
|
||||
for arg
|
||||
do
|
||||
if test -n "$eat"; then
|
||||
eat=
|
||||
else
|
||||
case $1 in
|
||||
-o)
|
||||
# configure might choose to run compile as `compile cc -o foo foo.c'.
|
||||
# So we strip `-o arg' only if arg is an object.
|
||||
eat=1
|
||||
case $2 in
|
||||
*.o | *.obj)
|
||||
ofile=$2
|
||||
;;
|
||||
*)
|
||||
set x "$@" -o "$2"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*.c)
|
||||
cfile=$1
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
shift
|
||||
done
|
||||
|
||||
if test -z "$ofile" || test -z "$cfile"; then
|
||||
# If no `-o' option was seen then we might have been invoked from a
|
||||
# pattern rule where we don't need one. That is ok -- this is a
|
||||
# normal compilation that the losing compiler can handle. If no
|
||||
# `.c' file was seen then we are probably linking. That is also
|
||||
# ok.
|
||||
exec "$@"
|
||||
fi
|
||||
|
||||
# Name of file we expect compiler to create.
|
||||
cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'`
|
||||
|
||||
# Create the lock directory.
|
||||
# Note: use `[/.-]' here to ensure that we don't use the same name
|
||||
# that we are using for the .o file. Also, base the name on the expected
|
||||
# object file name, since that is what matters with a parallel build.
|
||||
lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d
|
||||
while true; do
|
||||
if mkdir "$lockdir" >/dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
# FIXME: race condition here if user kills between mkdir and trap.
|
||||
trap "rmdir '$lockdir'; exit 1" 1 2 15
|
||||
|
||||
# Run the compile.
|
||||
"$@"
|
||||
ret=$?
|
||||
|
||||
if test -f "$cofile"; then
|
||||
mv "$cofile" "$ofile"
|
||||
elif test -f "${cofile}bj"; then
|
||||
mv "${cofile}bj" "$ofile"
|
||||
fi
|
||||
|
||||
rmdir "$lockdir"
|
||||
exit $ret
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-end: "$"
|
||||
# End:
|
|
@ -1,437 +0,0 @@
|
|||
/* config.h. Generated from config.h.in by configure. */
|
||||
/* config.h.in. Generated from configure.in by autoheader. */
|
||||
#ifndef _CONFIG_H_
|
||||
#define _CONFIG_H_
|
||||
|
||||
/* ONLY EDIT acconfig.h, NEVER config.h or config.h.in!
|
||||
* config.h MAY BE OVERWRITTEN BY make, config.h.in by autoheader! */
|
||||
|
||||
/* Define your Target here. Currently defined are TARGET_LINUX (any
|
||||
* architecture), TARGET_BSD (experimental; tested on FreeBSD, hopefully
|
||||
* works for other BSD variants) and TARGET_CYGWIN. */
|
||||
#define TARGET TARGET_LINUX
|
||||
|
||||
/* change the #undef to #define if you do not want to compile with special
|
||||
* ISDN support for Linux. Note that the ISDN support will not compile ok on
|
||||
* unpatched kernerls earlier than 2.2.12 (if you did apply newer isdn patches,
|
||||
* it may work fine). This is not on by default because it will cause compile
|
||||
* problems on some systems */
|
||||
/* #undef ISDN_SUPPORT */
|
||||
|
||||
/* The following regulates the IP Protocol support. Supported types are IPv4
|
||||
* and IPv6 (aka IPng). You may enable either or both of these protocols.
|
||||
* Enabling in this context means that support for the respective protocol
|
||||
* will be in the binary. When running the binary, one of the protocols may
|
||||
* be activated via command line switches. Note that activating both IPv4 and
|
||||
* IPv6 is pointless (and will not work because two UDP and two TCP threads
|
||||
* will be started that concur for ports). Because of that, it is not allowed.
|
||||
* When pdnsd runs with IPv6 activated it should be able to service queries
|
||||
* from IPv6 as well as from IPv4 hosts, provided that you host is configured
|
||||
* properly.
|
||||
* For each of the protocols there are two options: ENABLE_IPV4 and ENABLE_IPV6
|
||||
* control whether support for the respective protocol is available in the
|
||||
* binary. DEFAULT_IPV4 selects which protocol is enabled on pdnsd
|
||||
* startup by default. 1 means IPv4, while 0 means IPv6. If support for
|
||||
* a protocol was included in the executable, you can specify command line
|
||||
* parameters to activate or deactivate that protocol (the options are -4 and
|
||||
* -6), but it makes more sense to use the run_ipv4=on/off option in the
|
||||
* configuration file.
|
||||
* Make your choice. Note that IPv6 support is experimental in pdnsd.
|
||||
* In normal operation, you will currently only need IPv4. */
|
||||
#define ENABLE_IPV4 1
|
||||
#define DEFAULT_IPV4 1
|
||||
#undef ENABLE_IPV6
|
||||
|
||||
/* In all pdnsd versions before 1.0.6, DNS queries were always done over
|
||||
* TCP. Now, you have the choice. You can control that behaviour using
|
||||
* the -m command line switch, and you can give a preset here. There
|
||||
* are 3 different modes:
|
||||
* UDP_ONLY: This is undoubtedly the fastest query method, because
|
||||
* no TCP negotiation needs to be done.
|
||||
* TCP_ONLY: This is slower than uo, but generally more secure
|
||||
* against DNS spoofing. Note that some name servers on the
|
||||
* internet do not support TCP queries, notably dnscache.
|
||||
* TCP_UDP: TCP, then UDP. If the TCP query fails with a "connection refused"-
|
||||
* error or times out, the query is retried using UDP.
|
||||
* UDP_TCP: UDP, then TCP. If the UDP reply is truncated (i.e. the tc flag is set),
|
||||
* the query is retried using TCP. */
|
||||
#define M_PRESET TCP_ONLY
|
||||
|
||||
/* In addition to choosing the presets, you may also completely disable
|
||||
* one of the protocols (TCP for preset UDP_ONLY and UDP for preset TCP_ONLY).
|
||||
* This saves some executable space. */
|
||||
/* #undef NO_UDP_QUERIES */
|
||||
/* #undef NO_TCP_QUERIES */
|
||||
|
||||
/* With the following option, you can disable the TCP server functionality
|
||||
* of pdnsd. Nearly no program does TCP queries, so you probably can do
|
||||
* this safely and save some executable space and one thread.
|
||||
* You also can turn off the TCP server at runtime with the --notcp option. */
|
||||
/* #undef NO_TCP_SERVER */
|
||||
|
||||
/* By undefining the following, you can disable the UDP source address
|
||||
* discovery code. This is not recommended, but you may need it when
|
||||
* running into compilation problems. */
|
||||
#define SRC_ADDR_DISC 1
|
||||
|
||||
/* NO_POLL specifies not to use poll(2), but select(2) instead. If you are
|
||||
* unsure about what this means, just leave this as it is.*/
|
||||
/* #undef NO_POLL */
|
||||
|
||||
/* Define this for "hard" RFC 2181 compliance: this RFC states that
|
||||
* implementations should discard answers whose RR sets have multiple
|
||||
* different time stamps. While correct answers are generated, incorrect
|
||||
* ones are normally tolerated and corrected. Full RFC compliance is
|
||||
* however only achieved by deactivating this behaviour and thus being
|
||||
* intolerant. */
|
||||
/* #undef RFC2181_ME_HARDER */
|
||||
|
||||
/* Define this to the device you want to use for getting random numbers.
|
||||
* Leave this undefined if you wand to use the standard C library random
|
||||
* function, which basically should be sufficient.
|
||||
* Linux and FreeBSD have two random number devices: /dev/random and
|
||||
* /dev/urandom. /dev/urandom might be less secure in some cases, but
|
||||
* should still be more than sufficient. The use of /dev/random is
|
||||
* discouraged, as reading from this device blocks when new random bits
|
||||
* need to be gathered. */
|
||||
/* #undef RANDOM_DEVICE */
|
||||
#define R_DEFAULT 1
|
||||
/* #undef R_RANDOM */
|
||||
/* #undef R_ARC4RANDOM */
|
||||
/*#define RANDOM_DEVICE "/dev/urandom"*/
|
||||
|
||||
/* Designate which database manager to use for cacheing.
|
||||
* default: native; others: gdbm */
|
||||
#define CACHE_DBM DBM_NATIVE
|
||||
|
||||
#define CONFDIR "/data/data/net.typeblog.socks"
|
||||
|
||||
#define CACHEDIR "/data/data/net.typeblog.socks"
|
||||
|
||||
#define TEMPDIR "/data/data/net.typeblog.socks/cache";
|
||||
|
||||
/* This is for various debugging facilities that produce debug output and
|
||||
* double-check some values. You can enable debug messages with the -g option.
|
||||
* Normally, you can switch this off safely by setting the number after DEBUG
|
||||
* to 0. This will increase speed (although only marginally), save space
|
||||
* in the executable (only about 12kB) and some stack space per thread
|
||||
* (which may be significant if you have many threads running simultaneously).
|
||||
* However, it may be an aid when debugging config files.
|
||||
* The only defined debug levels by now are in the range 0 - 9.
|
||||
* Define this to 9 if you want hex dumps of all the queries and replies pdnsd
|
||||
* receives (you must also call pdnsd with -v9 to actually see the hex dumps).
|
||||
* When in doubt, leave it defined to 1. */
|
||||
#define DEBUG 1
|
||||
|
||||
/* This defines the default verbosity of informational messages you will get.
|
||||
This has nothing to to with the debug option (-g), but may be set with -v
|
||||
option. 0 is for normal operation, up to 3 for debugging.
|
||||
Unlike the debug messages, these messages will also be written to the syslog.*/
|
||||
#define VERBOSITY 0
|
||||
|
||||
/* Redefine this if you want another hash size.
|
||||
* The number of hash buckets is computed as power of two (1<<HASH_SZ);
|
||||
* so e.g. HASH_SZ set to 10 yields 1024 hash rows.
|
||||
* HASH_SZ may not be bigger than 32 (if you set it even close to that value,
|
||||
* you are nuts.) */
|
||||
#define HASH_SZ 10
|
||||
|
||||
/* Set this to debug the hash tables. Turn this off normally, or you will get
|
||||
* flooded with diagnostic messages */
|
||||
/* #undef DEBUG_HASH */
|
||||
|
||||
/* Define if you have working C99 Variadic macro support */
|
||||
#define CPP_C99_VARIADIC_MACROS 1
|
||||
|
||||
/* Define as int if socklen_t typedef is missing */
|
||||
/* #undef socklen_t */
|
||||
|
||||
/* Lock the UDP socket before using it? */
|
||||
/* #undef SOCKET_LOCKING */
|
||||
|
||||
/* Default TCP timeout when receiving queries */
|
||||
#define TCP_TIMEOUT 5
|
||||
|
||||
/* Allow subsequent TCP queries on one connection? */
|
||||
/* #undef TCP_SUBSEQ */
|
||||
|
||||
/* Default value for parallel query number */
|
||||
#define PAR_QUERIES 4
|
||||
|
||||
/* Maximum number of IP addresses used per nameserver obtained from NS records. */
|
||||
#define MAXNAMESERVIPS 3
|
||||
|
||||
/* These are the possible targets. Normally no need to touch these
|
||||
* definitions. */
|
||||
#define TARGET_LINUX 0
|
||||
#define TARGET_BSD 1
|
||||
#define TARGET_CYGWIN 2
|
||||
|
||||
/* Assume the Native POSIX Thread Library instead of LinuxThreads ? */
|
||||
#define THREADLIB_NPTL 1
|
||||
|
||||
/* If we are using LinuxThreads, implement the fix needed for newer glibcs ? */
|
||||
/* #undef THREADLIB_LINUXTHREADS2 */
|
||||
|
||||
/* The following is needed for using LinuxThreads. Better don't touch. */
|
||||
#define _REENTRANT 1
|
||||
#define _THREAD_SAFE 1
|
||||
|
||||
/* It appears the newer versions of gcc won't convert a pointer to char into
|
||||
a pointer to unsigned char and vice versa without complaining.
|
||||
By using casts these warning messages can be suppressed, but at the cost
|
||||
of losing some type safety.
|
||||
Define charp and ucharp to be empty if you are a developer and find type
|
||||
safety more important.
|
||||
Leave the definitions unchanged to avoid distracting warning messages. */
|
||||
#define charp (char *)
|
||||
#define ucharp (unsigned char *)
|
||||
|
||||
|
||||
/* pdnsd version. DO NOT TOUCH THIS! It is replaced automatically by the
|
||||
* contents of ./version */
|
||||
#define VERSION "1.2.9a-par"
|
||||
|
||||
#endif
|
||||
|
||||
/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
|
||||
systems. This function is required for `alloca.c' support on those systems.
|
||||
*/
|
||||
/* #undef CRAY_STACKSEG_END */
|
||||
|
||||
/* Define to 1 if using `alloca.c'. */
|
||||
/* #undef C_ALLOCA */
|
||||
|
||||
/* Define to 1 if you have `alloca', as a function or macro. */
|
||||
#define HAVE_ALLOCA 1
|
||||
|
||||
/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
|
||||
*/
|
||||
#define HAVE_ALLOCA_H 1
|
||||
|
||||
/* Define to 1 if you have the `asprintf' function. */
|
||||
#define HAVE_ASPRINTF 1
|
||||
|
||||
/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
|
||||
/* #undef HAVE_DOPRNT */
|
||||
|
||||
/* Define to 1 if you have the <fcntl.h> header file. */
|
||||
#define HAVE_FCNTL_H 1
|
||||
|
||||
/* Define to 1 if you have the `getline' function. */
|
||||
#if defined(__aarch64__) || defined(__x86_64__)
|
||||
#define HAVE_GETLINE 1
|
||||
#endif
|
||||
|
||||
/* Define to 1 if you have the `getpwnam_r' function. */
|
||||
//#define HAVE_GETPWNAM_R 1
|
||||
|
||||
/* Define to 1 if you have the `gettimeofday' function. */
|
||||
#define HAVE_GETTIMEOFDAY 1
|
||||
|
||||
/* Define to 1 if you have the `inet_ntop' function. */
|
||||
#define HAVE_INET_NTOP 1
|
||||
|
||||
/* Define to 1 if you have the `inet_pton' function. */
|
||||
#define HAVE_INET_PTON 1
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#define HAVE_INTTYPES_H 1
|
||||
|
||||
/* Define to 1 if you have the `pthread' library (-lpthread). */
|
||||
#define HAVE_LIBPTHREAD 1
|
||||
|
||||
/* Define to 1 if you have the <malloc.h> header file. */
|
||||
#define HAVE_MALLOC_H 1
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#define HAVE_MEMORY_H 1
|
||||
|
||||
/* Define to 1 if you have the `mempcpy' function. */
|
||||
//#define HAVE_MEMPCPY 1
|
||||
|
||||
/* Define to 1 if you have the `mkfifo' function. */
|
||||
#define HAVE_MKFIFO 1
|
||||
|
||||
/* Define to 1 if you have the `nanosleep' function. */
|
||||
#define HAVE_NANOSLEEP 1
|
||||
|
||||
/* Define to 1 if you have the <netinet/in.h> header file. */
|
||||
#define HAVE_NETINET_IN_H 1
|
||||
|
||||
/* Define to 1 if you have the <net/if.h> header file. */
|
||||
#define HAVE_NET_IF_H 1
|
||||
|
||||
/* Define to 1 if you have the `poll' function. */
|
||||
#define HAVE_POLL 1
|
||||
|
||||
/* Define to 1 if you have the `select' function. */
|
||||
#define HAVE_SELECT 1
|
||||
|
||||
/* Define to 1 if you have the `snprintf' function. */
|
||||
#define HAVE_SNPRINTF 1
|
||||
|
||||
/* Define to 1 if you have the `socket' function. */
|
||||
#define HAVE_SOCKET 1
|
||||
|
||||
/* Define to 1 if the system has the type `socklen_t'. */
|
||||
#define HAVE_SOCKLEN_T 1
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#define HAVE_STDINT_H 1
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#define HAVE_STDLIB_H 1
|
||||
|
||||
/* Define to 1 if you have the `stpcpy' function. */
|
||||
#if defined(__aarch64__) || defined(__x86_64__)
|
||||
#define HAVE_STPCPY 1
|
||||
#endif
|
||||
|
||||
/* Define to 1 if you have the `stpncpy' function. */
|
||||
//#define HAVE_STPNCPY 1
|
||||
|
||||
/* Define to 1 if you have the `strdup' function. */
|
||||
#define HAVE_STRDUP 1
|
||||
|
||||
/* Define to 1 if you have the `strerror' function. */
|
||||
#define HAVE_STRERROR 1
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#define HAVE_STRINGS_H 1
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#define HAVE_STRING_H 1
|
||||
|
||||
/* Define to 1 if you have the `strlcpy' function. */
|
||||
/* #undef HAVE_STRLCPY */
|
||||
|
||||
/* Define to 1 if you have the `strndup' function. */
|
||||
#define HAVE_STRNDUP 1
|
||||
|
||||
/* Define to 1 if the system has the type `struct ifreq'. */
|
||||
#define HAVE_STRUCT_IFREQ 1
|
||||
|
||||
/* Define to 1 if the system has the type `struct in6_addr'. */
|
||||
#define HAVE_STRUCT_IN6_ADDR 1
|
||||
|
||||
/* Define to 1 if the system has the type `struct in_pktinfo'. */
|
||||
#define HAVE_STRUCT_IN_PKTINFO 1
|
||||
|
||||
/* Define to 1 if you have the <syslog.h> header file. */
|
||||
#define HAVE_SYSLOG_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/ioctl.h> header file. */
|
||||
#define HAVE_SYS_IOCTL_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/poll.h> header file. */
|
||||
#define HAVE_SYS_POLL_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/socket.h> header file. */
|
||||
#define HAVE_SYS_SOCKET_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#define HAVE_SYS_STAT_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/time.h> header file. */
|
||||
#define HAVE_SYS_TIME_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
|
||||
/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
|
||||
#define HAVE_SYS_WAIT_H 1
|
||||
|
||||
/* Define to 1 if you have the `uname' function. */
|
||||
#define HAVE_UNAME 1
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#define HAVE_UNISTD_H 1
|
||||
|
||||
/* Define to 1 if you have the `vasprintf' function. */
|
||||
#define HAVE_VASPRINTF 1
|
||||
|
||||
/* Define to 1 if you have the `vprintf' function. */
|
||||
#define HAVE_VPRINTF 1
|
||||
|
||||
/* Define to 1 if you have the `vsnprintf' function. */
|
||||
#define HAVE_VSNPRINTF 1
|
||||
|
||||
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
|
||||
/* #undef NO_MINUS_C_MINUS_O */
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#define PACKAGE_BUGREPORT ""
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#define PACKAGE_NAME ""
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#define PACKAGE_STRING ""
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#define PACKAGE_TARNAME ""
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#define PACKAGE_VERSION ""
|
||||
|
||||
/* Define as the return type of signal handlers (`int' or `void'). */
|
||||
#define RETSIGTYPE void
|
||||
|
||||
/* If using the C implementation of alloca, define if you know the
|
||||
direction of stack growth for your system; otherwise it will be
|
||||
automatically deduced at runtime.
|
||||
STACK_DIRECTION > 0 => grows toward higher addresses
|
||||
STACK_DIRECTION < 0 => grows toward lower addresses
|
||||
STACK_DIRECTION = 0 => direction of growth unknown */
|
||||
/* #undef STACK_DIRECTION */
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#define STDC_HEADERS 1
|
||||
|
||||
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
|
||||
#define TIME_WITH_SYS_TIME 1
|
||||
|
||||
/* Define to 1 if your <sys/time.h> declares `struct tm'. */
|
||||
/* #undef TM_IN_SYS_TIME */
|
||||
|
||||
/* Enable extensions on AIX 3, Interix. */
|
||||
#ifndef _ALL_SOURCE
|
||||
# define _ALL_SOURCE 1
|
||||
#endif
|
||||
/* Enable GNU extensions on systems that have them. */
|
||||
#ifndef _GNU_SOURCE
|
||||
# define _GNU_SOURCE 1
|
||||
#endif
|
||||
/* Enable threading extensions on Solaris. */
|
||||
#ifndef _POSIX_PTHREAD_SEMANTICS
|
||||
# define _POSIX_PTHREAD_SEMANTICS 1
|
||||
#endif
|
||||
/* Enable extensions on HP NonStop. */
|
||||
#ifndef _TANDEM_SOURCE
|
||||
# define _TANDEM_SOURCE 1
|
||||
#endif
|
||||
/* Enable general extensions on Solaris. */
|
||||
#ifndef __EXTENSIONS__
|
||||
# define __EXTENSIONS__ 1
|
||||
#endif
|
||||
|
||||
|
||||
/* Define to 1 if on MINIX. */
|
||||
/* #undef _MINIX */
|
||||
|
||||
/* Define to 2 if the system does not provide POSIX.1 features except with
|
||||
this defined. */
|
||||
/* #undef _POSIX_1_SOURCE */
|
||||
|
||||
/* Define to 1 if you need to in order for `stat' and other things to work. */
|
||||
/* #undef _POSIX_SOURCE */
|
||||
|
||||
/* Define to empty if `const' does not conform to ANSI C. */
|
||||
/* #undef const */
|
||||
|
||||
/* Define to `int' if <sys/types.h> does not define. */
|
||||
/* #undef pid_t */
|
||||
|
||||
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
||||
/* #undef size_t */
|
|
@ -1,430 +0,0 @@
|
|||
/* config.h.in. Generated from configure.in by autoheader. */
|
||||
#ifndef _CONFIG_H_
|
||||
#define _CONFIG_H_
|
||||
|
||||
/* ONLY EDIT acconfig.h, NEVER config.h or config.h.in!
|
||||
* config.h MAY BE OVERWRITTEN BY make, config.h.in by autoheader! */
|
||||
|
||||
/* Define your Target here. Currently defined are TARGET_LINUX (any
|
||||
* architecture), TARGET_BSD (experimental; tested on FreeBSD, hopefully
|
||||
* works for other BSD variants) and TARGET_CYGWIN. */
|
||||
#define TARGET TARGET_LINUX
|
||||
|
||||
/* change the #undef to #define if you do not want to compile with special
|
||||
* ISDN support for Linux. Note that the ISDN support will not compile ok on
|
||||
* unpatched kernerls earlier than 2.2.12 (if you did apply newer isdn patches,
|
||||
* it may work fine). This is not on by default because it will cause compile
|
||||
* problems on some systems */
|
||||
#undef ISDN_SUPPORT
|
||||
|
||||
/* The following regulates the IP Protocol support. Supported types are IPv4
|
||||
* and IPv6 (aka IPng). You may enable either or both of these protocols.
|
||||
* Enabling in this context means that support for the respective protocol
|
||||
* will be in the binary. When running the binary, one of the protocols may
|
||||
* be activated via command line switches. Note that activating both IPv4 and
|
||||
* IPv6 is pointless (and will not work because two UDP and two TCP threads
|
||||
* will be started that concur for ports). Because of that, it is not allowed.
|
||||
* When pdnsd runs with IPv6 activated it should be able to service queries
|
||||
* from IPv6 as well as from IPv4 hosts, provided that you host is configured
|
||||
* properly.
|
||||
* For each of the protocols there are two options: ENABLE_IPV4 and ENABLE_IPV6
|
||||
* control whether support for the respective protocol is available in the
|
||||
* binary. DEFAULT_IPV4 selects which protocol is enabled on pdnsd
|
||||
* startup by default. 1 means IPv4, while 0 means IPv6. If support for
|
||||
* a protocol was included in the executable, you can specify command line
|
||||
* parameters to activate or deactivate that protocol (the options are -4 and
|
||||
* -6), but it makes more sense to use the run_ipv4=on/off option in the
|
||||
* configuration file.
|
||||
* Make your choice. Note that IPv6 support is experimental in pdnsd.
|
||||
* In normal operation, you will currently only need IPv4. */
|
||||
#undef ENABLE_IPV4
|
||||
#define DEFAULT_IPV4 1
|
||||
#undef ENABLE_IPV6
|
||||
|
||||
/* In all pdnsd versions before 1.0.6, DNS queries were always done over
|
||||
* TCP. Now, you have the choice. You can control that behaviour using
|
||||
* the -m command line switch, and you can give a preset here. There
|
||||
* are 3 different modes:
|
||||
* UDP_ONLY: This is undoubtedly the fastest query method, because
|
||||
* no TCP negotiation needs to be done.
|
||||
* TCP_ONLY: This is slower than uo, but generally more secure
|
||||
* against DNS spoofing. Note that some name servers on the
|
||||
* internet do not support TCP queries, notably dnscache.
|
||||
* TCP_UDP: TCP, then UDP. If the TCP query fails with a "connection refused"-
|
||||
* error or times out, the query is retried using UDP.
|
||||
* UDP_TCP: UDP, then TCP. If the UDP reply is truncated (i.e. the tc flag is set),
|
||||
* the query is retried using TCP. */
|
||||
#define M_PRESET UDP_ONLY
|
||||
|
||||
/* In addition to choosing the presets, you may also completely disable
|
||||
* one of the protocols (TCP for preset UDP_ONLY and UDP for preset TCP_ONLY).
|
||||
* This saves some executable space. */
|
||||
#undef NO_UDP_QUERIES
|
||||
#undef NO_TCP_QUERIES
|
||||
|
||||
/* With the following option, you can disable the TCP server functionality
|
||||
* of pdnsd. Nearly no program does TCP queries, so you probably can do
|
||||
* this safely and save some executable space and one thread.
|
||||
* You also can turn off the TCP server at runtime with the --notcp option. */
|
||||
#undef NO_TCP_SERVER
|
||||
|
||||
/* By undefining the following, you can disable the UDP source address
|
||||
* discovery code. This is not recommended, but you may need it when
|
||||
* running into compilation problems. */
|
||||
#undef SRC_ADDR_DISC
|
||||
|
||||
/* NO_POLL specifies not to use poll(2), but select(2) instead. If you are
|
||||
* unsure about what this means, just leave this as it is.*/
|
||||
#undef NO_POLL
|
||||
|
||||
/* Define this for "hard" RFC 2181 compliance: this RFC states that
|
||||
* implementations should discard answers whose RR sets have multiple
|
||||
* different time stamps. While correct answers are generated, incorrect
|
||||
* ones are normally tolerated and corrected. Full RFC compliance is
|
||||
* however only achieved by deactivating this behaviour and thus being
|
||||
* intolerant. */
|
||||
#undef RFC2181_ME_HARDER
|
||||
|
||||
/* Define this to the device you want to use for getting random numbers.
|
||||
* Leave this undefined if you wand to use the standard C library random
|
||||
* function, which basically should be sufficient.
|
||||
* Linux and FreeBSD have two random number devices: /dev/random and
|
||||
* /dev/urandom. /dev/urandom might be less secure in some cases, but
|
||||
* should still be more than sufficient. The use of /dev/random is
|
||||
* discouraged, as reading from this device blocks when new random bits
|
||||
* need to be gathered. */
|
||||
#undef RANDOM_DEVICE
|
||||
#undef R_DEFAULT
|
||||
#undef R_RANDOM
|
||||
#undef R_ARC4RANDOM
|
||||
/*#define RANDOM_DEVICE "/dev/urandom"*/
|
||||
|
||||
/* Designate which database manager to use for cacheing.
|
||||
* default: native; others: gdbm */
|
||||
#define CACHE_DBM DBM_NATIVE
|
||||
|
||||
#define CACHEDIR "/var/cache/pdnsd"
|
||||
|
||||
#define TEMPDIR "/tmp";
|
||||
|
||||
/* This is for various debugging facilities that produce debug output and
|
||||
* double-check some values. You can enable debug messages with the -g option.
|
||||
* Normally, you can switch this off safely by setting the number after DEBUG
|
||||
* to 0. This will increase speed (although only marginally), save space
|
||||
* in the executable (only about 12kB) and some stack space per thread
|
||||
* (which may be significant if you have many threads running simultaneously).
|
||||
* However, it may be an aid when debugging config files.
|
||||
* The only defined debug levels by now are in the range 0 - 9.
|
||||
* Define this to 9 if you want hex dumps of all the queries and replies pdnsd
|
||||
* receives (you must also call pdnsd with -v9 to actually see the hex dumps).
|
||||
* When in doubt, leave it defined to 1. */
|
||||
#define DEBUG 1
|
||||
|
||||
/* This defines the default verbosity of informational messages you will get.
|
||||
This has nothing to to with the debug option (-g), but may be set with -v
|
||||
option. 0 is for normal operation, up to 3 for debugging.
|
||||
Unlike the debug messages, these messages will also be written to the syslog.*/
|
||||
#define VERBOSITY 0
|
||||
|
||||
/* Redefine this if you want another hash size.
|
||||
* The number of hash buckets is computed as power of two (1<<HASH_SZ);
|
||||
* so e.g. HASH_SZ set to 10 yields 1024 hash rows.
|
||||
* HASH_SZ may not be bigger than 32 (if you set it even close to that value,
|
||||
* you are nuts.) */
|
||||
#define HASH_SZ 10
|
||||
|
||||
/* Set this to debug the hash tables. Turn this off normally, or you will get
|
||||
* flooded with diagnostic messages */
|
||||
#undef DEBUG_HASH
|
||||
|
||||
/* Define if you have working C99 Variadic macro support */
|
||||
#undef CPP_C99_VARIADIC_MACROS
|
||||
|
||||
/* Define as int if socklen_t typedef is missing */
|
||||
#undef socklen_t
|
||||
|
||||
/* Lock the UDP socket before using it? */
|
||||
#undef SOCKET_LOCKING
|
||||
|
||||
/* Default TCP timeout when receiving queries */
|
||||
#define TCP_TIMEOUT 30
|
||||
|
||||
/* Allow subsequent TCP queries on one connection? */
|
||||
#undef TCP_SUBSEQ
|
||||
|
||||
/* Default value for parallel query number */
|
||||
#define PAR_QUERIES 2
|
||||
|
||||
/* Maximum number of IP addresses used per nameserver obtained from NS records. */
|
||||
#define MAXNAMESERVIPS 3
|
||||
|
||||
/* These are the possible targets. Normally no need to touch these
|
||||
* definitions. */
|
||||
#define TARGET_LINUX 0
|
||||
#define TARGET_BSD 1
|
||||
#define TARGET_CYGWIN 2
|
||||
|
||||
/* Assume the Native POSIX Thread Library instead of LinuxThreads ? */
|
||||
#undef THREADLIB_NPTL
|
||||
|
||||
/* If we are using LinuxThreads, implement the fix needed for newer glibcs ? */
|
||||
#undef THREADLIB_LINUXTHREADS2
|
||||
|
||||
/* The following is needed for using LinuxThreads. Better don't touch. */
|
||||
#define _REENTRANT 1
|
||||
#define _THREAD_SAFE 1
|
||||
|
||||
/* It appears the newer versions of gcc won't convert a pointer to char into
|
||||
a pointer to unsigned char and vice versa without complaining.
|
||||
By using casts these warning messages can be suppressed, but at the cost
|
||||
of losing some type safety.
|
||||
Define charp and ucharp to be empty if you are a developer and find type
|
||||
safety more important.
|
||||
Leave the definitions unchanged to avoid distracting warning messages. */
|
||||
#define charp (char *)
|
||||
#define ucharp (unsigned char *)
|
||||
|
||||
|
||||
/* pdnsd version. DO NOT TOUCH THIS! It is replaced automatically by the
|
||||
* contents of ./version */
|
||||
#define VERSION "@VERSION@"
|
||||
|
||||
#endif
|
||||
|
||||
/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
|
||||
systems. This function is required for `alloca.c' support on those systems.
|
||||
*/
|
||||
#undef CRAY_STACKSEG_END
|
||||
|
||||
/* Define to 1 if using `alloca.c'. */
|
||||
#undef C_ALLOCA
|
||||
|
||||
/* Define to 1 if you have `alloca', as a function or macro. */
|
||||
#undef HAVE_ALLOCA
|
||||
|
||||
/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
|
||||
*/
|
||||
#undef HAVE_ALLOCA_H
|
||||
|
||||
/* Define to 1 if you have the `asprintf' function. */
|
||||
#undef HAVE_ASPRINTF
|
||||
|
||||
/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
|
||||
#undef HAVE_DOPRNT
|
||||
|
||||
/* Define to 1 if you have the <fcntl.h> header file. */
|
||||
#undef HAVE_FCNTL_H
|
||||
|
||||
/* Define to 1 if you have the `getline' function. */
|
||||
#undef HAVE_GETLINE
|
||||
|
||||
/* Define to 1 if you have the `getpwnam_r' function. */
|
||||
#undef HAVE_GETPWNAM_R
|
||||
|
||||
/* Define to 1 if you have the `gettimeofday' function. */
|
||||
#undef HAVE_GETTIMEOFDAY
|
||||
|
||||
/* Define to 1 if you have the `inet_ntop' function. */
|
||||
#undef HAVE_INET_NTOP
|
||||
|
||||
/* Define to 1 if you have the `inet_pton' function. */
|
||||
#undef HAVE_INET_PTON
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
/* Define to 1 if you have the `pthread' library (-lpthread). */
|
||||
#undef HAVE_LIBPTHREAD
|
||||
|
||||
/* Define to 1 if you have the <malloc.h> header file. */
|
||||
#undef HAVE_MALLOC_H
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Define to 1 if you have the `mempcpy' function. */
|
||||
#undef HAVE_MEMPCPY
|
||||
|
||||
/* Define to 1 if you have the `mkfifo' function. */
|
||||
#undef HAVE_MKFIFO
|
||||
|
||||
/* Define to 1 if you have the `nanosleep' function. */
|
||||
#undef HAVE_NANOSLEEP
|
||||
|
||||
/* Define to 1 if you have the <netinet/in.h> header file. */
|
||||
#undef HAVE_NETINET_IN_H
|
||||
|
||||
/* Define to 1 if you have the <net/if.h> header file. */
|
||||
#undef HAVE_NET_IF_H
|
||||
|
||||
/* Define to 1 if you have the `poll' function. */
|
||||
#undef HAVE_POLL
|
||||
|
||||
/* Define to 1 if you have the `select' function. */
|
||||
#undef HAVE_SELECT
|
||||
|
||||
/* Define to 1 if you have the `snprintf' function. */
|
||||
#undef HAVE_SNPRINTF
|
||||
|
||||
/* Define to 1 if you have the `socket' function. */
|
||||
#undef HAVE_SOCKET
|
||||
|
||||
/* Define to 1 if the system has the type `socklen_t'. */
|
||||
#undef HAVE_SOCKLEN_T
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#undef HAVE_STDINT_H
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
/* Define to 1 if you have the `stpcpy' function. */
|
||||
#undef HAVE_STPCPY
|
||||
|
||||
/* Define to 1 if you have the `stpncpy' function. */
|
||||
#undef HAVE_STPNCPY
|
||||
|
||||
/* Define to 1 if you have the `strdup' function. */
|
||||
#undef HAVE_STRDUP
|
||||
|
||||
/* Define to 1 if you have the `strerror' function. */
|
||||
#undef HAVE_STRERROR
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#undef HAVE_STRINGS_H
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#undef HAVE_STRING_H
|
||||
|
||||
/* Define to 1 if you have the `strlcpy' function. */
|
||||
#undef HAVE_STRLCPY
|
||||
|
||||
/* Define to 1 if you have the `strndup' function. */
|
||||
#undef HAVE_STRNDUP
|
||||
|
||||
/* Define to 1 if the system has the type `struct ifreq'. */
|
||||
#undef HAVE_STRUCT_IFREQ
|
||||
|
||||
/* Define to 1 if the system has the type `struct in6_addr'. */
|
||||
#undef HAVE_STRUCT_IN6_ADDR
|
||||
|
||||
/* Define to 1 if the system has the type `struct in_pktinfo'. */
|
||||
#undef HAVE_STRUCT_IN_PKTINFO
|
||||
|
||||
/* Define to 1 if you have the <syslog.h> header file. */
|
||||
#undef HAVE_SYSLOG_H
|
||||
|
||||
/* Define to 1 if you have the <sys/ioctl.h> header file. */
|
||||
#undef HAVE_SYS_IOCTL_H
|
||||
|
||||
/* Define to 1 if you have the <sys/poll.h> header file. */
|
||||
#undef HAVE_SYS_POLL_H
|
||||
|
||||
/* Define to 1 if you have the <sys/socket.h> header file. */
|
||||
#undef HAVE_SYS_SOCKET_H
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#undef HAVE_SYS_STAT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/time.h> header file. */
|
||||
#undef HAVE_SYS_TIME_H
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#undef HAVE_SYS_TYPES_H
|
||||
|
||||
/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
|
||||
#undef HAVE_SYS_WAIT_H
|
||||
|
||||
/* Define to 1 if you have the `uname' function. */
|
||||
#undef HAVE_UNAME
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define to 1 if you have the `vasprintf' function. */
|
||||
#undef HAVE_VASPRINTF
|
||||
|
||||
/* Define to 1 if you have the `vprintf' function. */
|
||||
#undef HAVE_VPRINTF
|
||||
|
||||
/* Define to 1 if you have the `vsnprintf' function. */
|
||||
#undef HAVE_VSNPRINTF
|
||||
|
||||
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
|
||||
#undef NO_MINUS_C_MINUS_O
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#undef PACKAGE_BUGREPORT
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#undef PACKAGE_NAME
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#undef PACKAGE_STRING
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
/* Define as the return type of signal handlers (`int' or `void'). */
|
||||
#undef RETSIGTYPE
|
||||
|
||||
/* If using the C implementation of alloca, define if you know the
|
||||
direction of stack growth for your system; otherwise it will be
|
||||
automatically deduced at runtime.
|
||||
STACK_DIRECTION > 0 => grows toward higher addresses
|
||||
STACK_DIRECTION < 0 => grows toward lower addresses
|
||||
STACK_DIRECTION = 0 => direction of growth unknown */
|
||||
#undef STACK_DIRECTION
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
|
||||
#undef TIME_WITH_SYS_TIME
|
||||
|
||||
/* Define to 1 if your <sys/time.h> declares `struct tm'. */
|
||||
#undef TM_IN_SYS_TIME
|
||||
|
||||
/* Enable extensions on AIX 3, Interix. */
|
||||
#ifndef _ALL_SOURCE
|
||||
# undef _ALL_SOURCE
|
||||
#endif
|
||||
/* Enable GNU extensions on systems that have them. */
|
||||
#ifndef _GNU_SOURCE
|
||||
# undef _GNU_SOURCE
|
||||
#endif
|
||||
/* Enable threading extensions on Solaris. */
|
||||
#ifndef _POSIX_PTHREAD_SEMANTICS
|
||||
# undef _POSIX_PTHREAD_SEMANTICS
|
||||
#endif
|
||||
/* Enable extensions on HP NonStop. */
|
||||
#ifndef _TANDEM_SOURCE
|
||||
# undef _TANDEM_SOURCE
|
||||
#endif
|
||||
/* Enable general extensions on Solaris. */
|
||||
#ifndef __EXTENSIONS__
|
||||
# undef __EXTENSIONS__
|
||||
#endif
|
||||
|
||||
|
||||
/* Define to 1 if on MINIX. */
|
||||
#undef _MINIX
|
||||
|
||||
/* Define to 2 if the system does not provide POSIX.1 features except with
|
||||
this defined. */
|
||||
#undef _POSIX_1_SOURCE
|
||||
|
||||
/* Define to 1 if you need to in order for `stat' and other things to work. */
|
||||
#undef _POSIX_SOURCE
|
||||
|
||||
/* Define to empty if `const' does not conform to ANSI C. */
|
||||
#undef const
|
||||
|
||||
/* Define to `int' if <sys/types.h> does not define. */
|
||||
#undef pid_t
|
||||
|
||||
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
||||
#undef size_t
|
File diff suppressed because it is too large
Load Diff
|
@ -1,548 +0,0 @@
|
|||
dnl Process this file with autoconf to produce a configure script.
|
||||
AC_INIT(src)
|
||||
|
||||
package="pdnsd"
|
||||
version=`cut -d - -f 1 "$srcdir"/version`
|
||||
fullversion=`cat "$srcdir"/version`
|
||||
packagerelease=`cut -d - -f 2- "$srcdir"/version`
|
||||
|
||||
distribution="Generic"
|
||||
target="autodetect"
|
||||
cachedir="/var/cache/$package"
|
||||
ipv4_default=1
|
||||
have_ipv4="yes"
|
||||
#newrrs="yes"
|
||||
query_m="udponly"
|
||||
have_tcp_server="yes"
|
||||
adisc="default"
|
||||
slock="no";
|
||||
def_id="nobody"
|
||||
#have_rcsids="no"
|
||||
udp_queries="yes"
|
||||
tcp_queries="yes"
|
||||
tempdir="/tmp"
|
||||
randomdev=default
|
||||
freebsd_pthread="4"
|
||||
specbuild=no
|
||||
threadlib=default
|
||||
|
||||
AM_INIT_AUTOMAKE($package, $version, [no-define])
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
AC_GNU_SOURCE
|
||||
AC_DEFINE_UNQUOTED(VERSION,"$fullversion")
|
||||
AC_SUBST(fullversion)
|
||||
AC_SUBST(packagerelease)
|
||||
|
||||
AC_ARG_WITH(distribution,
|
||||
[ --with-distribution=distro Specify target distribution (default=Generic;
|
||||
others: RedHat, SuSE, Debian, ArchLinux)],
|
||||
distribution=$withval)
|
||||
AC_SUBST(distribution)
|
||||
|
||||
AC_ARG_WITH(target,
|
||||
[ --with-target=platform Change compilation target platform (default:
|
||||
autodetect; others: Linux, BSD, Cygwin)],
|
||||
target=$withval)
|
||||
case $target in
|
||||
Linux|linux)
|
||||
AC_DEFINE(TARGET, TARGET_LINUX)
|
||||
target="Linux"
|
||||
;;
|
||||
BSD| bsd)
|
||||
AC_DEFINE(TARGET, TARGET_BSD)
|
||||
target="BSD"
|
||||
;;
|
||||
Cygwin|CYGWIN|cygwin)
|
||||
AC_DEFINE(TARGET, TARGET_CYGWIN)
|
||||
target="cygwin"
|
||||
;;
|
||||
autodetect)
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([--with-target must have Linux, BSD or Cygwin as parameter.])
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_ARG_WITH(cachedir,
|
||||
[ --with-cachedir=dir Default directory for pdnsd cache
|
||||
(default=/var/cache/pdnsd)],
|
||||
cachedir=$withval)
|
||||
AC_DEFINE_UNQUOTED(CACHEDIR, "$cachedir")
|
||||
AC_SUBST(cachedir)
|
||||
|
||||
AC_ARG_ENABLE(isdn,
|
||||
[ --enable-isdn Enable ISDN support (may cause problems on
|
||||
some systems; only for Linux)],
|
||||
test $enableval = "yes" && AC_DEFINE(ISDN_SUPPORT))
|
||||
|
||||
AC_ARG_ENABLE(ipv4,
|
||||
[ --disable-ipv4 Disable IPv4 networking support
|
||||
(default=enabled)],
|
||||
have_ipv4=$enableval)
|
||||
|
||||
test $have_ipv4 = "yes" && AC_DEFINE(ENABLE_IPV4)
|
||||
|
||||
AC_ARG_ENABLE(ipv6,
|
||||
[ --enable-ipv6 Enable IPv6 networking support],
|
||||
[ if test $enableval = "yes" ; then
|
||||
AC_DEFINE(ENABLE_IPV6)
|
||||
if test $have_ipv4 != "yes" ; then
|
||||
ipv4_default=0
|
||||
fi
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(ipv4-startup,
|
||||
[ --disable-ipv4-startup Disable IPv4 on pdnsd startup by default
|
||||
(default=enabled)],
|
||||
[ if test $enableval = "yes" ; then
|
||||
ipv4_default=1
|
||||
else
|
||||
ipv4_default=0
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(ipv6-startup,
|
||||
[ --enable-ipv6-startup Enable IPV6 on pdnsd startup by default
|
||||
(default=IPv4)],
|
||||
[ if test $enableval = "yes" ; then
|
||||
ipv4_default=0
|
||||
else
|
||||
ipv4_default=1
|
||||
fi])
|
||||
|
||||
AC_DEFINE_UNQUOTED(DEFAULT_IPV4, $ipv4_default)
|
||||
|
||||
AC_ARG_ENABLE(udp-queries,
|
||||
[ --disable-udp-queries Disable udp as query method.],
|
||||
udp_queries=$enableval)
|
||||
|
||||
AC_ARG_ENABLE(tcp-queries,
|
||||
[ --disable-tcp-queries Disable tcp as query method.],
|
||||
tcp_queries=$enableval)
|
||||
|
||||
AC_ARG_WITH(query-method,
|
||||
[ --with-query-method=qm Specify the query method (default=udponly;
|
||||
others: tcponly, tcpudp, udptcp)],
|
||||
query_m=$withval)
|
||||
case $query_m in
|
||||
udponly|UDPonly)
|
||||
AC_DEFINE(M_PRESET, UDP_ONLY)
|
||||
udp_queries=yes;
|
||||
;;
|
||||
tcponly|TCPonly)
|
||||
AC_DEFINE(M_PRESET, TCP_ONLY)
|
||||
tcp_queries=yes;
|
||||
;;
|
||||
tcpudp|TCPUDP)
|
||||
AC_DEFINE(M_PRESET, TCP_UDP)
|
||||
udp_queries=yes;
|
||||
tcp_queries=yes;
|
||||
;;
|
||||
udptcp|UDPTCP)
|
||||
AC_DEFINE(M_PRESET, UDP_TCP)
|
||||
udp_queries=yes;
|
||||
tcp_queries=yes;
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([--with-query-method must have udponly, tcponly, tcpudp or udptcp as parameter.])
|
||||
;;
|
||||
esac
|
||||
|
||||
test $udp_queries != "yes" && AC_DEFINE(NO_UDP_QUERIES)
|
||||
test $tcp_queries != "yes" && AC_DEFINE(NO_TCP_QUERIES)
|
||||
|
||||
AC_ARG_ENABLE(tcp-server,
|
||||
[ --disable-tcp-server Disable the TCP serving ability of pdnsd],
|
||||
have_tcp_server=$enableval)
|
||||
|
||||
test $have_tcp_server != "yes" && AC_DEFINE(NO_TCP_SERVER)
|
||||
|
||||
AC_ARG_ENABLE(src-addr-disc,
|
||||
[ --disable-src-addr-disc Disable the UDP source address discovery],
|
||||
adisc=$enableval)
|
||||
|
||||
AC_ARG_ENABLE(socket-locking,
|
||||
[ --enable-socket-locking Enable the UDP socket locking],
|
||||
slock=$enableval)
|
||||
|
||||
test $slock = "yes" && AC_DEFINE(SOCKET_LOCKING)
|
||||
|
||||
AC_ARG_ENABLE(poll,
|
||||
[ --disable-poll Disable poll(2) and use select(2)
|
||||
(default=enabled)],
|
||||
test $enableval != "yes" && AC_DEFINE(NO_POLL))
|
||||
|
||||
AC_ARG_ENABLE(new-rrs,
|
||||
[ --disable-new-rrs Disable new DNS RR types (obsolete, currently ignored)],
|
||||
newrrs=$enableval)
|
||||
|
||||
AC_ARG_ENABLE(strict-rfc2181,
|
||||
[ --enable-strict-rfc2181 Enforce strict RFC 2181 compliance],
|
||||
test $enableval = "yes" && AC_DEFINE(RFC2181_ME_HARDER))
|
||||
|
||||
AC_ARG_WITH(random-device,
|
||||
[ --with-random-device=device Specify random device other than
|
||||
/dev/random; default: C Library random() PRNG;
|
||||
special value arc4random for BSD C Library
|
||||
arc4random function (default on FreeBSD)],
|
||||
randomdev=$withval)
|
||||
|
||||
if test "$randomdev" = arc4random ; then
|
||||
AC_DEFINE(R_ARC4RANDOM)
|
||||
elif test "$randomdev" = random ; then
|
||||
AC_DEFINE(R_RANDOM)
|
||||
elif test "$randomdev" = default ; then
|
||||
AC_DEFINE(R_DEFAULT)
|
||||
else
|
||||
AC_DEFINE_UNQUOTED(RANDOM_DEVICE, "$randomdev")
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(underscores,
|
||||
[ --enable-underscores Allow _ in domain names (obsolete, currently ignored)],
|
||||
underscores=$enableval)
|
||||
|
||||
AC_ARG_WITH(default-id,
|
||||
[ --with-default-id=id Specify default uid/gid for pdnsd
|
||||
(default=nobody)],
|
||||
def_id=$withval)
|
||||
AC_SUBST(def_id)
|
||||
|
||||
AC_ARG_WITH(debug,
|
||||
[ --with-debug=level Specify debugging level (0 means no debug support)],
|
||||
AC_DEFINE_UNQUOTED(DEBUG, $withval))
|
||||
|
||||
AC_ARG_WITH(verbosity,
|
||||
[ --with-verbosity=level Specify default message verbosity],
|
||||
AC_DEFINE_UNQUOTED(VERBOSITY, $withval))
|
||||
|
||||
AC_ARG_WITH(hash-buckets,
|
||||
[ --with-hash-buckets=num Number of hash buckets to use (default=1024).
|
||||
The number actually used is the smallest power of two
|
||||
greater or equal to the number specified here.],
|
||||
powof2=1
|
||||
hashsz=0
|
||||
|
||||
while test $powof2 -lt "$withval"
|
||||
do
|
||||
powof2=`expr 2 '*' $powof2`
|
||||
hashsz=`expr $hashsz '+' 1`
|
||||
done
|
||||
AC_DEFINE_UNQUOTED(HASH_SZ, $hashsz)
|
||||
)
|
||||
|
||||
AC_ARG_ENABLE(hash-debug,
|
||||
[ --enable-hash-debug Debug hash tables (warning: massive output)],
|
||||
test $enableval = "yes" && AC_DEFINE(DEBUG_HASH))
|
||||
|
||||
AC_ARG_ENABLE(rcsids,
|
||||
[ --enable-rcsids Enable RCS IDs in executables (obsolete, currently ignored)],
|
||||
have_rcsids=$enableval)
|
||||
|
||||
AC_ARG_WITH(tcp-qtimeout,
|
||||
[ --with-tcp-qtimeout=secs Specify default tcp query timeout (default=30)],
|
||||
AC_DEFINE_UNQUOTED(TCP_TIMEOUT, $withval))
|
||||
|
||||
AC_ARG_ENABLE(tcp-subseq,
|
||||
[ --enable-tcp-subseq Enable multiple dns querys using one
|
||||
tcp connection],
|
||||
test $enableval = "yes" && AC_DEFINE(TCP_SUBSEQ))
|
||||
|
||||
AC_ARG_WITH(par-queries,
|
||||
[ --with-par-queries=num Specify default parallel query number (default=2)],
|
||||
AC_DEFINE_UNQUOTED(PAR_QUERIES, $withval))
|
||||
|
||||
AC_ARG_WITH(max-nameserver-ips,
|
||||
[ --with-max-nameserver-ips=num Specify maximum number of IP addresses used per nameserver obtained from NS records (default=3)],
|
||||
AC_DEFINE_UNQUOTED(MAXNAMESERVIPS, $withval))
|
||||
|
||||
AC_ARG_ENABLE(specbuild,
|
||||
[ --enable-specbuild Only used when building pdnsd from spec files],
|
||||
specbuild=$enableval)
|
||||
|
||||
AC_SUBST(specbuild)
|
||||
|
||||
AC_ARG_WITH(thread-lib,
|
||||
[ --with-thread-lib=lib Specify thread library, overriding automatic detection (for Linux only).
|
||||
Possible values: LinuxThreads,
|
||||
LinuxThreads2 (implements a fix for newer glibcs)
|
||||
or NPTL (Native POSIX Thread Library)],
|
||||
threadlib=$withval)
|
||||
|
||||
AC_SUBST(threadlib)
|
||||
|
||||
dnl Checks for programs.
|
||||
AC_PROG_CC
|
||||
AM_PROG_CC_STDC
|
||||
AM_PROG_CC_C_O
|
||||
AC_PROG_INSTALL
|
||||
|
||||
dnl For dbm subsystem libraries
|
||||
AC_PROG_RANLIB
|
||||
|
||||
if test "$target" = "autodetect" ; then
|
||||
AC_MSG_CHECKING([for autodetect build target])
|
||||
uname_sys=`uname`
|
||||
if test $? -ne 0 ; then
|
||||
AC_MSG_RESULT([failed])
|
||||
AC_MSG_ERROR([uname failed or was not found in path])
|
||||
else
|
||||
case "${uname_sys}" in
|
||||
Linux)
|
||||
AC_MSG_RESULT(Linux)
|
||||
AC_DEFINE(TARGET, TARGET_LINUX)
|
||||
target="Linux"
|
||||
;;
|
||||
FreeBSD|NetBSD|OpenBSD|Darwin)
|
||||
AC_MSG_RESULT("${uname_sys}")
|
||||
AC_DEFINE(TARGET, TARGET_BSD)
|
||||
target="BSD"
|
||||
;;
|
||||
CYGWIN*)
|
||||
AC_MSG_RESULT("${uname_sys}")
|
||||
AC_DEFINE(TARGET, TARGET_CYGWIN)
|
||||
target="cygwin"
|
||||
;;
|
||||
*)
|
||||
AC_MSG_RESULT([failed])
|
||||
AC_MSG_ERROR(
|
||||
[Your system type could not be identified. Try setting it manually using
|
||||
--with-target])
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
|
||||
#if test "$target" = BSD ; then
|
||||
# uname_sys=`uname`
|
||||
# if test "$uname_sys" = FreeBSD ; then
|
||||
# AC_MSG_CHECKING([for FreeBSD version])
|
||||
# osrel=`sysctl -n kern.osreldate`
|
||||
# if test $osrel -ge 500016 ; then
|
||||
# AC_MSG_RESULT([5.0 (>= 500016)])
|
||||
# freebsd_pthread="5"
|
||||
# else
|
||||
# AC_MSG_RESULT([<=5.0 (< 500016)])
|
||||
# freebsd_pthread="4"
|
||||
# fi
|
||||
# fi
|
||||
#fi
|
||||
|
||||
if test "$adisc" = "default"; then
|
||||
if test "$target" = "cygwin" ; then
|
||||
# Don't do UDP source address discovery on Cygwin platform by default.
|
||||
adisc="no"
|
||||
else
|
||||
adisc="yes"
|
||||
fi
|
||||
fi
|
||||
|
||||
test "$adisc" = "yes" && AC_DEFINE(SRC_ADDR_DISC)
|
||||
|
||||
|
||||
dnl Checks for libraries.
|
||||
if test "$target" = "Linux"; then
|
||||
AC_MSG_CHECKING([if we can compile and link with -pthread])
|
||||
old_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -pthread"
|
||||
AC_LINK_IFELSE([
|
||||
#include <pthread.h>
|
||||
|
||||
void *thread_func(void *data)
|
||||
{
|
||||
*((int *)data)=1;
|
||||
return data;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
pthread_t thread;
|
||||
void *retval;
|
||||
int val;
|
||||
|
||||
if(pthread_create(&thread, NULL, thread_func, &val))
|
||||
return 1;
|
||||
|
||||
if(pthread_join(thread,&retval))
|
||||
return 1;
|
||||
|
||||
return (*((int *)retval)!=1);
|
||||
}
|
||||
],
|
||||
gcc_pthread_flag="yes", gcc_pthread_flag="no")
|
||||
CFLAGS="$old_CFLAGS"
|
||||
AC_MSG_RESULT([$gcc_pthread_flag])
|
||||
|
||||
if test "$gcc_pthread_flag" = yes ; then
|
||||
thread_CFLAGS="-pthread"
|
||||
AC_SUBST(thread_CFLAGS)
|
||||
else
|
||||
AC_CHECK_LIB(pthread, pthread_create)
|
||||
fi
|
||||
fi
|
||||
if test "$target" = "BSD" -a `uname` != Darwin ; then
|
||||
# if test $freebsd_pthread = 4 ; then
|
||||
thread_CFLAGS="-pthread"
|
||||
AC_SUBST(thread_CFLAGS)
|
||||
# else
|
||||
# AC_CHECK_LIB(c_r, pthread_create, ,
|
||||
# AC_MSG_ERROR([You must have libc_r installed to build/run pdnsd!]))
|
||||
# fi;
|
||||
fi
|
||||
|
||||
if test "$target" = "Linux" -a "$threadlib" = default; then
|
||||
AC_MSG_CHECKING([if this is an NPTL-based system])
|
||||
old_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $thread_CFLAGS"
|
||||
AC_RUN_IFELSE([
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <pthread.h>
|
||||
|
||||
/* All this function does is return its PID (in a roundabout way). */
|
||||
void *thread_func(void *data)
|
||||
{
|
||||
*((int *)data)=getpid();
|
||||
return data;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
pthread_t thread;
|
||||
void *retval;
|
||||
int err,mainpid,thrdpid;
|
||||
|
||||
err=pthread_create(&thread, NULL, thread_func, &thrdpid);
|
||||
if(err) {
|
||||
fprintf(stderr,"pthread_create failed: %s\n",strerror(err));
|
||||
return 1;
|
||||
}
|
||||
err=pthread_join(thread,&retval);
|
||||
if(err) {
|
||||
fprintf(stderr,"pthread_join failed: %s\n",strerror(err));
|
||||
return 1;
|
||||
}
|
||||
mainpid=getpid();
|
||||
/* In LinuxThreads implementations, the pids of the threads will usually differ
|
||||
in a non Posix-compliant way. */
|
||||
fprintf(stderr,"main pid=%d, thread pid=%d\n",mainpid,*((int *)retval));
|
||||
return (*((int *)retval)!=mainpid);
|
||||
}
|
||||
],
|
||||
[
|
||||
AC_MSG_RESULT([yes])
|
||||
threadlib=nptl
|
||||
],
|
||||
[
|
||||
AC_MSG_RESULT([no])
|
||||
threadlib=linuxthreads
|
||||
],
|
||||
[
|
||||
AC_MSG_RESULT([couldn't run test program])
|
||||
threadlib=linuxthreads
|
||||
])
|
||||
CFLAGS="$old_CFLAGS"
|
||||
fi
|
||||
|
||||
if test "$threadlib" = nptl -o "$threadlib" = NPTL; then
|
||||
AC_DEFINE(THREADLIB_NPTL)
|
||||
elif test "$threadlib" = linuxthreads2 -o "$threadlib" = LinuxThreads2 -o "$threadlib" = lt2; then
|
||||
AC_DEFINE(THREADLIB_LINUXTHREADS2)
|
||||
fi
|
||||
|
||||
dnl Checks for header files.
|
||||
AC_HEADER_STDC
|
||||
AC_HEADER_SYS_WAIT
|
||||
AC_CHECK_HEADERS(fcntl.h malloc.h sys/ioctl.h sys/time.h syslog.h unistd.h)
|
||||
AC_CHECK_HEADERS(sys/types.h sys/socket.h net/if.h netinet/in.h sys/poll.h,,,
|
||||
[#include <stdio.h>
|
||||
#if STDC_HEADERS
|
||||
# include <stdlib.h>
|
||||
# include <stddef.h>
|
||||
#else
|
||||
# if HAVE_STDLIB_H
|
||||
# include <stdlib.h>
|
||||
# endif
|
||||
#endif
|
||||
#if HAVE_SYS_SOCKET_H
|
||||
# include <sys/socket.h>
|
||||
#endif
|
||||
])
|
||||
|
||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_C_CONST
|
||||
AC_TYPE_PID_T
|
||||
AC_TYPE_SIZE_T
|
||||
AC_HEADER_TIME
|
||||
AC_STRUCT_TM
|
||||
AC_CHECK_TYPES(socklen_t,, AC_DEFINE(socklen_t,int),[#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <net/if.h>
|
||||
#include <netinet/in.h>])
|
||||
AC_CHECK_TYPES([struct in6_addr, struct in_pktinfo, struct ifreq],,,[#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <net/if.h>
|
||||
#include <netinet/in.h>])
|
||||
|
||||
AC_MSG_CHECKING([for CPP C99 Variadic macro support])
|
||||
AC_COMPILE_IFELSE([
|
||||
#define a(...) junk(0,__VA_ARGS__)
|
||||
extern void junk(int i,...);
|
||||
int main()
|
||||
{
|
||||
a(0);
|
||||
a("a");
|
||||
a(0, "a", 1);
|
||||
return 0;
|
||||
}
|
||||
],
|
||||
cpp_c99_variadic="yes", cpp_c99_variadic="no")
|
||||
AC_MSG_RESULT([$cpp_c99_variadic])
|
||||
if test $cpp_c99_variadic = yes; then
|
||||
AC_DEFINE(CPP_C99_VARIADIC_MACROS)
|
||||
else
|
||||
if test "$GCC" != yes; then
|
||||
AC_MSG_ERROR([Compiler must support C99 or gcc variadic macros])
|
||||
fi;
|
||||
fi
|
||||
|
||||
dnl Checks for library functions.
|
||||
AC_FUNC_ALLOCA
|
||||
AC_PROG_GCC_TRADITIONAL
|
||||
AC_FUNC_MEMCMP
|
||||
AC_TYPE_SIGNAL
|
||||
AC_FUNC_VPRINTF
|
||||
AC_SEARCH_LIBS(nanosleep, rt)
|
||||
AC_SEARCH_LIBS(socket, socket,,,-lnsl)
|
||||
AC_SEARCH_LIBS(inet_aton, resolv)
|
||||
AC_CHECK_FUNCS(nanosleep gettimeofday mkfifo select socket strerror uname snprintf vsnprintf, true,
|
||||
AC_MSG_ERROR([One of the functions required for pdnsd were not found.]))
|
||||
AC_CHECK_FUNCS(poll, true, AC_DEFINE(NO_POLL))
|
||||
AC_CHECK_FUNCS(strdup strndup stpcpy stpncpy strlcpy mempcpy getline asprintf vasprintf getpwnam_r inet_ntop inet_pton)
|
||||
|
||||
AC_OUTPUT([
|
||||
pdnsd.spec
|
||||
Makefile
|
||||
file-list.base
|
||||
contrib/Makefile
|
||||
doc/Makefile
|
||||
doc/pdnsd.8
|
||||
doc/pdnsd.conf.5
|
||||
doc/pdnsd.conf
|
||||
src/Makefile
|
||||
src/pdnsd-ctl/Makefile
|
||||
src/rc/Makefile
|
||||
src/rc/RedHat/Makefile
|
||||
src/rc/RedHat/pdnsd
|
||||
src/rc/SuSE/Makefile
|
||||
src/rc/SuSE/pdnsd
|
||||
src/rc/Debian/Makefile
|
||||
src/rc/Debian/pdnsd
|
||||
src/rc/Slackware/Makefile
|
||||
src/rc/Slackware/rc.pdnsd
|
||||
src/rc/ArchLinux/Makefile
|
||||
src/rc/ArchLinux/pdnsd
|
||||
src/test/Makefile
|
||||
PKGBUILD
|
||||
])
|
|
@ -1,2 +0,0 @@
|
|||
|
||||
EXTRA_DIST = pdnsd_dhcp.pl dhcp2pdnsd change_pdnsd_server_ip.pl README
|
|
@ -1,323 +0,0 @@
|
|||
# Makefile.in generated by automake 1.11.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
|
||||
# Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
subdir = contrib
|
||||
DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.in
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
SOURCES =
|
||||
DIST_SOURCES =
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ALLOCA = @ALLOCA@
|
||||
AMTAR = @AMTAR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
GREP = @GREP@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build_alias = @build_alias@
|
||||
builddir = @builddir@
|
||||
cachedir = @cachedir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
def_id = @def_id@
|
||||
distribution = @distribution@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
fullversion = @fullversion@
|
||||
host_alias = @host_alias@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
packagerelease = @packagerelease@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
specbuild = @specbuild@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
thread_CFLAGS = @thread_CFLAGS@
|
||||
threadlib = @threadlib@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
EXTRA_DIST = pdnsd_dhcp.pl dhcp2pdnsd change_pdnsd_server_ip.pl README
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu contrib/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu contrib/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
tags: TAGS
|
||||
TAGS:
|
||||
|
||||
ctags: CTAGS
|
||||
CTAGS:
|
||||
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile
|
||||
installdirs:
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-generic
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-generic
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am:
|
||||
|
||||
.MAKE: install-am install-strip
|
||||
|
||||
.PHONY: all all-am check check-am clean clean-generic distclean \
|
||||
distclean-generic distdir dvi dvi-am html html-am info info-am \
|
||||
install install-am install-data install-data-am install-dvi \
|
||||
install-dvi-am install-exec install-exec-am install-html \
|
||||
install-html-am install-info install-info-am install-man \
|
||||
install-pdf install-pdf-am install-ps install-ps-am \
|
||||
install-strip installcheck installcheck-am installdirs \
|
||||
maintainer-clean maintainer-clean-generic mostlyclean \
|
||||
mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
|
@ -1,30 +0,0 @@
|
|||
Last revised: 27 July 2003 by Paul Rombouts
|
||||
|
||||
This directory contains user-contributed scripts for use with pdnsd.
|
||||
So far there are:
|
||||
|
||||
pdnsd_dhcp.pl, save_ram.pl
|
||||
A perl script contributed by Marko Stolle (derived from a script by
|
||||
Mike Stella) to watch a ISC DHCPD leases file and add local records for
|
||||
the hosts listed there. This makes pdnsd useable in a DHCP setup.
|
||||
Please look into the script for usage instructions (you will probably
|
||||
also need to customize some settings there).
|
||||
For details about save_ram.pl, please look into pdnsd_dhcp.pl
|
||||
|
||||
dhcp2pdnsd
|
||||
A rc script for pdnsd, also by Marko Stolle. You might need to change
|
||||
it slightly to make it run with your distro.
|
||||
|
||||
change_pdnsd_server_ip.pl
|
||||
A perl script contributed by Paul Rombouts for automatically updating
|
||||
the configuration file if the DNS server configuration has changed.
|
||||
For instance, you could place the following line in the script
|
||||
/sbin/ifup-local
|
||||
|
||||
/usr/local/sbin/change_pdnsd_server_ip.pl isplabel "$DNS" /etc/pdnsd.conf
|
||||
|
||||
where $DNS contains the IP addresses (in comma separated format) of the
|
||||
DNS servers obtained by DHCP negotiation. The perl script only
|
||||
overwrites /etc/pdnsd.conf if the DNS configuration has actually
|
||||
changed, in which case the previous configuration file is saved as
|
||||
/etc/pdnsd.conf.save
|
|
@ -1,124 +0,0 @@
|
|||
#!/usr/bin/perl -w
|
||||
#
|
||||
# A Perl script to change the ip addresses of dns servers
|
||||
# in the pdnsd configuration file.
|
||||
#
|
||||
# Written by Paul A. Rombouts
|
||||
#
|
||||
# This file Copyright 2002, 2004 Paul A. Rombouts
|
||||
# It may be distributed under the GNU Public License, version 2, or
|
||||
# any higher version. See section COPYING of the GNU Public license
|
||||
# for conditions under which this file may be redistributed.
|
||||
#
|
||||
|
||||
use strict;
|
||||
|
||||
unless(@ARGV) {die "Error: no label specified.\n"}
|
||||
my $label=shift;
|
||||
unless(@ARGV) {die "Error: no DNS addresses specified.\n"}
|
||||
my $dns_str=shift;
|
||||
my $pdnsd_conf='/etc/pdnsd.conf';
|
||||
if(@ARGV) {
|
||||
$pdnsd_conf=shift;
|
||||
if(@ARGV) {warn "Warning: spurious arguments ignored: @ARGV\n"}
|
||||
}
|
||||
|
||||
#unless($label =~ /^\".*\"$/) {$label="\"$label\""}
|
||||
#unless($dns_str =~ /^\".*\"$/) {$dns_str =~ s/^[\s,]*/\"/; $dns_str =~ s/[\s,]*$/\"/}
|
||||
#unless($dns_str =~ /\"\s*\,\s*\"/) {$dns_str =~ s/[\s,]+/","/g}
|
||||
|
||||
my @lines=();
|
||||
my $found_section=0;
|
||||
my $changed=0;
|
||||
my $ip_patt = qr/^((?:[^#]*?(?:\{|;))*?)(\s*ip\s*=\s*)("?[\w.:]+"?(?:\s*,\s*"?[\w.:]+"?)*)\s*;/;
|
||||
|
||||
open(CONFFILE,$pdnsd_conf) or die "Can't open $pdnsd_conf: $!\n";
|
||||
|
||||
while(<CONFFILE>) {
|
||||
if(/^\s*server\s*\{/) {
|
||||
my $sect_beg=$#lines+1;
|
||||
my $sect_end;
|
||||
my $found_label=0;
|
||||
LOOP: {
|
||||
do {
|
||||
push @lines,$_;
|
||||
if(/^(?:.*(?:\{|;))?\s*label\s*=\s*"?\Q$label\E"?\s*;/) {
|
||||
if($found_label++) {
|
||||
warn "Server section with multiple labels found.\n";
|
||||
close(CONFFILE);
|
||||
exit 2;
|
||||
}
|
||||
}
|
||||
if(/\}\s*$/) {
|
||||
$sect_end=$#lines;
|
||||
last LOOP;
|
||||
}
|
||||
} while(<CONFFILE>);
|
||||
}
|
||||
unless(defined($sect_end)) {
|
||||
warn "Server section without proper ending found.\n";
|
||||
close(CONFFILE);
|
||||
exit 2;
|
||||
}
|
||||
if(!$found_label) {next}
|
||||
if(!($found_section++)) {
|
||||
my $found_ip=0;
|
||||
for(my $i=$sect_beg; $i<=$sect_end;++$i) {
|
||||
if($lines[$i] =~ $ip_patt) {
|
||||
my $matched=''; my $rest;
|
||||
do {
|
||||
$rest=$';
|
||||
if(!($found_ip++)) {
|
||||
if($3 eq $dns_str) {
|
||||
$matched.=$&;
|
||||
}
|
||||
else {
|
||||
$matched.="$1$2$dns_str;";
|
||||
$changed=1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$matched.=$1;
|
||||
$changed=1;
|
||||
}
|
||||
} while($rest =~ $ip_patt);
|
||||
$lines[$i] = $matched.$rest;
|
||||
}
|
||||
}
|
||||
if(!$found_ip) {
|
||||
unless($lines[$sect_end] =~ s/\}\s*$/ ip=$dns_str;\n$&/) {
|
||||
warn "Can't add ip specification to server section labeled $label.\n";
|
||||
close(CONFFILE);
|
||||
exit 2;
|
||||
}
|
||||
$changed=1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
splice @lines,$sect_beg;
|
||||
$changed=1;
|
||||
}
|
||||
}
|
||||
else {push @lines,$_}
|
||||
}
|
||||
|
||||
close(CONFFILE) or die "Can't close $pdnsd_conf: $!\n";
|
||||
|
||||
if(!$found_section) {
|
||||
warn "No server sections labeled $label found.\n";
|
||||
exit 2;
|
||||
}
|
||||
elsif(!$changed) {
|
||||
exit 0;
|
||||
}
|
||||
|
||||
rename($pdnsd_conf,"$pdnsd_conf.save") or die "Can't rename $pdnsd_conf: $!\n";
|
||||
|
||||
unless((open(CONFFILE,">$pdnsd_conf") or (warn("Can't open $pdnsd_conf for writing: $!\n"),0)) and
|
||||
(print CONFFILE (@lines) or (warn("Can't write to $pdnsd_conf: $!\n"),0)) and
|
||||
(close(CONFFILE) or (warn("Can't close $pdnsd_conf after writing: $!\n"),0))) {
|
||||
rename("$pdnsd_conf.save",$pdnsd_conf) or die "Can't rename $pdnsd_conf.save: $!\n";
|
||||
exit 3;
|
||||
}
|
||||
|
||||
exit 1;
|
|
@ -1,45 +0,0 @@
|
|||
#! /bin/sh
|
||||
#
|
||||
# dhcp2pdnsd Start/Stop DHCP to DNS update script
|
||||
#
|
||||
# chkconfig: 345 96 99
|
||||
# description: DHCP to DNS update script
|
||||
# processname: dhcp2pdnsd.pl
|
||||
#
|
||||
# $Id: dhcp2pdnsd,v 1.1 2001/03/25 20:01:34 tmm Exp $
|
||||
|
||||
where="/usr/local/bin/"
|
||||
name="pdnsd_dhcp.pl"
|
||||
|
||||
# Source function library.
|
||||
. /etc/rc.d/init.d/functions
|
||||
|
||||
# Get config.
|
||||
. /etc/sysconfig/network
|
||||
|
||||
# See how we were called.
|
||||
case "$1" in
|
||||
start)
|
||||
$where$name > /dev/null 2> /dev/null &
|
||||
action "Starting DHCP to DNS update script: " /bin/true
|
||||
;;
|
||||
stop)
|
||||
p=`ps h -C $name | awk '{print $1}'`
|
||||
[ $p -gt 0 ] 2> /dev/null && kill $p && action "Stopping DHCP to DNS update script: " /bin/true
|
||||
[ $p -gt 0 ] 2> /dev/null || action "Stopping DHCP to DNS update script: " /bin/false
|
||||
;;
|
||||
status)
|
||||
p=`ps h -C $name | awk '{print $1}'`
|
||||
[ $p -gt 0 ] 2> /dev/null && echo 'running as '$p
|
||||
[ $p -gt 0 ] 2> /dev/null || echo 'not running'
|
||||
;;
|
||||
restart|reload)
|
||||
$0 stop
|
||||
$0 start
|
||||
;;
|
||||
*)
|
||||
echo "Usage: dhcp2pdnsd {start|stop|status|restart|reload}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit 0
|
|
@ -1,246 +0,0 @@
|
|||
#!/usr/bin/perl
|
||||
# $Id: pdnsd_dhcp.pl,v 1.2 2001/03/25 20:01:34 tmm Exp $
|
||||
##########################################################################
|
||||
#
|
||||
# Filename: pdnsd_dhcp.pl
|
||||
# Description: Dynamic DNS-DHCP update script for pdnsd
|
||||
# Author: Mike Stella
|
||||
# Modified by: Marko Stolle
|
||||
# Created: November 19, 2001
|
||||
# Last Updated: February 28, 2001
|
||||
# Email: fwd2m@gmx.de
|
||||
#
|
||||
###########################################################################
|
||||
#
|
||||
# This code is Copyright (c) 1998-2001 by Mike Stella and Marko Stolle
|
||||
#
|
||||
# NO WARRANTY is given for this program. If it doesn't
|
||||
# work on your system, sorry. If it eats your hard drive,
|
||||
# again, sorry. It works fine on mine. Good luck!
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
###########################################################################
|
||||
#
|
||||
# This script reads a dhcpd.leases file and dynamically updates pdnsd with
|
||||
# hostname and ip information.
|
||||
#
|
||||
# It assumes that your DHCP server recieves hostnames from the
|
||||
# clients, and that your clients offer their hostnames to the server.
|
||||
# Some versions of Linux DHCP clients don't do that. I use ISC's
|
||||
# DHCPD, found at http://www.isc.org - though others may work just
|
||||
# fine.
|
||||
#
|
||||
# This version of the script updates the pdnsd database. The status
|
||||
# control socket of pdnsd has to be enabled (psnsd -d -s).
|
||||
#
|
||||
###########################################################################
|
||||
#
|
||||
# 02/20/2001 - first working version
|
||||
# 02/21/2001 - security patches by Thomas Moestl
|
||||
# 02/22/2001 - re-read dhcpd.leases if ttl has expireds since last update
|
||||
# 02/24/2001 - try to get domainname if not specified
|
||||
# 02/28/2001 - randomized temporary filename
|
||||
# added possibility to save some RAM (read below)
|
||||
#
|
||||
###########################################################################
|
||||
|
||||
|
||||
# You may save some memory if you use absolute values with sysopen
|
||||
# in sub update_dns and don't use tmpnam()..
|
||||
# Just switch the '#' in front of the 'until sysopen' in the sub
|
||||
# update_dns, check the necessary modes on your system using save_ram.pl
|
||||
# and add a '#' in front of the following three lines.
|
||||
# Not using the tmpnam() function may open a security breach on systems
|
||||
# with not absolute trustworthy local users (Risk: a user may write a
|
||||
# script which creates files with the same names as this script and block
|
||||
# it that way. Unlikely because the filenames are now even without tmpnam()
|
||||
# randomized and an attacker has to create a very large number of files.)
|
||||
|
||||
use Fcntl;
|
||||
use strict;
|
||||
use POSIX qw(tmpnam);
|
||||
|
||||
$|=1;
|
||||
|
||||
###########################################################################
|
||||
### Globals - you can change these as needed
|
||||
|
||||
# Domain name
|
||||
# if not changed script will try to get it from the system
|
||||
my $domain_name = "domain";
|
||||
|
||||
# DHCPD lease file
|
||||
my $lease_file = "/var/lib/dhcp/dhcpd.leases";
|
||||
|
||||
# path to pdnsd-ctl
|
||||
my $pdnsd_ctl = "/usr/local/sbin/pdnsd-ctl";
|
||||
|
||||
# owning name server for the newly added records
|
||||
my $nameserver = "localhost.";
|
||||
|
||||
# TTL (Time To Live) for the new records
|
||||
my $ttl = "86400";
|
||||
|
||||
# number of seconds to check the lease file for updates
|
||||
my $update_freq = 30;
|
||||
|
||||
my $debug = 0;
|
||||
|
||||
###########################################################################
|
||||
### Don't mess with anything below unless you REALLY need to modify the
|
||||
### code. And if you do, please let me know, I'm always interested in
|
||||
### in improving this program.
|
||||
|
||||
# Make a pid file
|
||||
`echo $$ > /var/run/pdnsd_update.pid`;
|
||||
|
||||
my $logstr;
|
||||
my $modtime = 0;
|
||||
my $temp_dir = -d '/tmp' ? '/tmp' : $ENV{TMP} || $ENV{TEMP};
|
||||
|
||||
use vars qw (%db);
|
||||
|
||||
my $version = "1.03";
|
||||
|
||||
|
||||
###########################################################################
|
||||
# Main Loop
|
||||
|
||||
# try to find domainname if necessary
|
||||
if ($domain_name eq "domain") {
|
||||
$domain_name = `dnsdomainname`;
|
||||
}
|
||||
else {
|
||||
$domain_name = "$domain_name\n";
|
||||
}
|
||||
|
||||
while (1) {
|
||||
|
||||
# check the file's last updated time, if it's been changed, update
|
||||
# the DNS and save the time. Update DNS even if there a no changes on
|
||||
# the leases file if ttl since last DNS update has expired.
|
||||
# This will ALWAYS run once - on startup, since $modtime starts at zero.
|
||||
|
||||
|
||||
my @stats = stat ($lease_file);
|
||||
|
||||
|
||||
if (($stats[9] > $modtime) or (time >= $modtime+$ttl)){
|
||||
|
||||
# clear the old hash
|
||||
undef %db;
|
||||
|
||||
printf STDERR "updating DNS with dhcpd.leases\n";
|
||||
$modtime = time;
|
||||
&read_lease_file;
|
||||
&update_dns;
|
||||
}
|
||||
|
||||
# wait till next check time
|
||||
sleep $update_freq;
|
||||
|
||||
} # end main
|
||||
###########################################################################
|
||||
|
||||
|
||||
### write out the import file
|
||||
sub update_dns {
|
||||
my ($ip, $hostname, $fname);
|
||||
|
||||
do { $fname = tmpnam() }
|
||||
until sysopen(DNSFILE, $fname, O_WRONLY|O_CREAT|O_EXCL, 0600);
|
||||
# do { $fname = "$temp_dir/d2d".int(rand(time())) }
|
||||
# until sysopen(DNSFILE, $fname, 1|64|128, 0600);
|
||||
|
||||
while (($hostname,$ip) = each (%db)) {
|
||||
print DNSFILE "$ip $hostname.$domain_name";
|
||||
}
|
||||
close DNSFILE;
|
||||
|
||||
system ("$pdnsd_ctl source $fname $nameserver $ttl");
|
||||
unlink($fname);
|
||||
}
|
||||
|
||||
|
||||
### reads the lease file & makes a hash of what's in there.
|
||||
sub read_lease_file {
|
||||
|
||||
unless (open(LEASEFILE,$lease_file)) {
|
||||
#`logger -t dns_update.pl error opening dhcpd lease file`;
|
||||
print STDERR "Can't open lease file\n";
|
||||
return;
|
||||
}
|
||||
|
||||
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
|
||||
my $curdate = sprintf "%02d%02d%02d%02d%02d%20d%20d",
|
||||
($year+1900),($mon+1),$mday,$hour,$min,$sec;
|
||||
|
||||
## Loop here, reading from LEASEFILE
|
||||
while (<LEASEFILE>) {
|
||||
my ($ip, $hostname, $mac, $enddate,$endtime);
|
||||
|
||||
if (/^\s*lease/i) {
|
||||
|
||||
# find ip address
|
||||
$_ =~ /^\s*lease\s+(\S+)/;
|
||||
$ip = $1;
|
||||
|
||||
# do the rest of the block - we're interested in hostname,
|
||||
# mac address, and the lease time
|
||||
while ($_ !~ /^}/) {
|
||||
$_ = <LEASEFILE>;
|
||||
# find hostname
|
||||
if ($_ =~ /^\s*client/i) {
|
||||
#chomp $_;
|
||||
#chop $_;
|
||||
$_ =~ /\"(.*)\"/;
|
||||
$hostname = $1;
|
||||
|
||||
# change spaces to dash, remove dots - microsoft
|
||||
# really needs to not do this crap
|
||||
$hostname =~ s/\s+/-/g;
|
||||
$hostname =~ s/\.//g;
|
||||
}
|
||||
# get the lease end date
|
||||
elsif ($_ =~ /^\s*ends/i) {
|
||||
$_ =~ m/^\s*ends\s+\d\s+([^;]+);/;
|
||||
$enddate = $1;
|
||||
$enddate =~ s|[/: ]||g;
|
||||
}
|
||||
}
|
||||
# lowercase it - stupid dhcp clients
|
||||
$hostname =~ tr/[A-Z]/[a-z]/;
|
||||
|
||||
($debug < 1 ) || print STDERR "$hostname $ip $enddate $curdate\n";
|
||||
|
||||
# Store hostname/ip in hash - this way we can do easy dupe checking
|
||||
if (($hostname ne "") and ($enddate > $curdate)) {
|
||||
$db{$hostname} = $ip;
|
||||
}
|
||||
}
|
||||
}
|
||||
close LEASEFILE;
|
||||
}
|
||||
|
||||
### left around for testing
|
||||
sub print_db {
|
||||
my ($key,$value);
|
||||
|
||||
while (($key,$value) = each (%db)) {
|
||||
print "$key - $value\n";
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue