summary refs log tree commit diff stats
path: root/src/common/dbus/example.py
blob: 08bfdac316db527c68ff3c161fbbe3d17b85a3be (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#! /usr/bin/python

import dbus

bus = dbus.SessionBus()
proxy = bus.get_object('org.xchat.service', '/org/xchat/Remote')
remote = dbus.Interface(proxy, 'org.xchat.connection')
path = remote.Connect ("example.py",
		       "Python example",
		       "Example of a D-Bus client written in python",
		       "1.0")
proxy = bus.get_object('org.xchat.service', path)
xchat = dbus.Interface(proxy, 'org.xchat.plugin')

channels = xchat.ListGet ("channels")
while xchat.ListNext (channels):
	name = xchat.ListStr (channels, "channel")
	print "------- " + name + " -------"
	xchat.SetContext (xchat.ListInt (channels, "context"))
	xchat.EmitPrint ("Channel Message", ["John", "Hi there", "@"])
	users = xchat.ListGet ("users")
	while xchat.ListNext (users):
		print "Nick: " + xchat.ListStr (users, "nick")
	xchat.ListFree (users)
xchat.ListFree (channels)

print xchat.Strip ("\00312Blue\003 \002Bold!\002", -1, 1|2)
el="LocalAppDataPlatform" /> <Import Project="..\..\win32\hexchat-xp.props" /> </ImportGroup> <PropertyGroup Label="UserMacros" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <LinkIncremental>false</LinkIncremental> <TargetName>$(PythonOutput)</TargetName> <OutDir>$(HexChatBin)</OutDir> <IntDir>$(HexChatObj)$(ProjectName)\</IntDir> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <LinkIncremental>false</LinkIncremental> <TargetName>$(PythonOutput)</TargetName> <OutDir>$(HexChatBin)</OutDir> <IntDir>$(HexChatObj)$(ProjectName)\</IntDir> </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ClCompile> <PrecompiledHeader> </PrecompiledHeader> <Optimization>MaxSpeed</Optimization> <FunctionLevelLinking>true</FunctionLevelLinking> <IntrinsicFunctions>true</IntrinsicFunctions> <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;PYTHON_EXPORTS;$(OwnFlags);%(PreprocessorDefinitions)</PreprocessorDefinitions> <AdditionalIncludeDirectories>$(Glib);$(PythonPath)\include;..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <MultiProcessorCompilation>true</MultiProcessorCompilation> </ClCompile> <Link> <SubSystem>Windows</SubSystem> <GenerateDebugInformation>true</GenerateDebugInformation> <EnableCOMDATFolding>true</EnableCOMDATFolding> <OptimizeReferences>true</OptimizeReferences> <ModuleDefinitionFile>python.def</ModuleDefinitionFile> <AdditionalDependencies>"$(PythonLib).lib";$(DepLibs);%(AdditionalDependencies)</AdditionalDependencies> <AdditionalLibraryDirectories>$(DepsRoot)\lib;$(OutDir);$(PythonPath)\libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> </Link> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ClCompile> <PrecompiledHeader> </PrecompiledHeader> <Optimization>MaxSpeed</Optimization> <FunctionLevelLinking>true</FunctionLevelLinking> <IntrinsicFunctions>true</IntrinsicFunctions> <PreprocessorDefinitions>WIN32;_WIN64;_AMD64_;NDEBUG;_WINDOWS;_USRDLL;PYTHON_EXPORTS;$(OwnFlags);%(PreprocessorDefinitions)</PreprocessorDefinitions> <AdditionalIncludeDirectories>$(Glib);$(PythonPath)\include;..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <MultiProcessorCompilation>true</MultiProcessorCompilation> </ClCompile> <Link> <SubSystem>Windows</SubSystem> <GenerateDebugInformation>true</GenerateDebugInformation> <EnableCOMDATFolding>true</EnableCOMDATFolding> <OptimizeReferences>true</OptimizeReferences> <ModuleDefinitionFile>python.def</ModuleDefinitionFile> <AdditionalDependencies>"$(PythonLib).lib";$(DepLibs);%(AdditionalDependencies)</AdditionalDependencies> <AdditionalLibraryDirectories>$(DepsRoot)\lib;$(OutDir);$(PythonPath)\libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> </Link> </ItemDefinitionGroup> <ItemGroup> <None Include="python.def" /> </ItemGroup> <ItemGroup> <ClCompile Include="python.c" /> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> </ImportGroup> </Project>