libubus: use list_empty/list_first_entry in ubus_process_pending_msg