examples/xep0060.lua
changeset 24 25552b21d3fb
parent 22 6460b020825d
child 25 38c68c285e41
equal deleted inserted replaced
23:e441162b1386 24:25552b21d3fb
   163 		end )
   163 		end )
   164 end
   164 end
   165 
   165 
   166 main.command ( 'subscribe',
   166 main.command ( 'subscribe',
   167 	function ( args )
   167 	function ( args )
   168 		pubsub_subscribe ( main.current_buddy (), args )
   168 		args = parse_args ( args )
       
   169 		pubsub_subscribe ( args.t or main.current_buddy (), args )
   169 	end )
   170 	end )
   170 main.command ( 'unsubscribe',
   171 main.command ( 'unsubscribe',
   171 	function ( args )
   172 	function ( args )
   172 		pubsub_unsubscribe ( main.current_buddy (), args )
   173 		args = parse_args ( args )
       
   174 		pubsub_unsubscribe ( args.t or main.current_buddy (), args )
   173 	end )
   175 	end )
   174 main.command ( 'configure_node',
   176 main.command ( 'configure_node',
   175 	function ( args )
   177 	function ( args )
   176 		pubsub_configure_node ( main.current_buddy (), args )
   178 		args = parse_args ( args )
       
   179 		pubsub_configure_node ( args.t or main.current_buddy (), args )
   177 	end )
   180 	end )
   178 main.command ( 'subscriptions',
   181 main.command ( 'subscriptions',
   179 	function ( args )
   182 	function ( args )
   180 		pubsub_list_subscriptions ( main.current_buddy (), args )
   183 		args = parse_args ( args )
       
   184 		pubsub_list_subscriptions ( args.t or main.current_buddy (), args )
   181 	end )
   185 	end )
   182 main.command ( 'subscription',
   186 main.command ( 'subscription',
   183 	function ( args )
   187 	function ( args )
   184 		local node, jid, state, id = args:match ( '(.-)%s+(.-)%s+(.-)%s+(.+)' )
   188 		args = parse_args ( args )
   185 		if not node then
   189 		local node, jid, state, id = args[1], args[2], args[3], args[4]
   186 			node, jid, state = args:match ( '(.-)%s+(.-)%s+(.+)' )
   190 		pubsub_modify_subscription ( args.t or main.current_buddy (), node, jid, state, id )
   187 		end
       
   188 		pubsub_modify_subscription ( main.current_buddy (), node, jid, state, id )
       
   189 	end )
   191 	end )
   190 
   192 
   191 commands_help['subscribe']      = "node_name\n\nSends pubsub subscription request to specified node of current buddy."
   193 commands_help['subscribe']      = "node_name\n\nSends pubsub subscription request to specified node of current buddy."
   192 commands_help['unsubscribe']    = "node_name\n\nSends pubsub unsubscription request to specified node of current buddy."
   194 commands_help['unsubscribe']    = "node_name\n\nSends pubsub unsubscription request to specified node of current buddy."
   193 commands_help['configure_node'] = "node_name\n\nSends pubsub node configuration request to specified node of current buddy."
   195 commands_help['configure_node'] = "node_name\n\nSends pubsub node configuration request to specified node of current buddy."